CMPS 209 Final, Fall 2015
American University of Beirut · Computers and Programming for the Sciences · 8 pages · Ms. Hayat Bohsali
More CMPS 209 files
Show the text of this final exam
Department of Computer Science
Fall 2006
CMPS 209 – Final exam- Sample Questions
90 minutes
1/8
Instructions:
1. Make sure that you have one answer sheet and a question booklet of 8 pages.
2. Everything you write on the answer sheet should be in HB-2 pencil.
3. Write your name and ID number on both the question and answer sheet.
ID NUMBER
FULL NAME
SECTION
ROOM
Nicely 500
Wing D
WHCR
SEAT
NUMBER
INSTRUCTOR
Mr. Wassim Mukaddam
Mrs. Hayat Bohsali
SIGNATURE
Department of Computer Science
Fall 2006
CMPS 209 – Final Exam-Sample Questions
90 minutes
2/8
I. Programming
As part of its advertisement campaign, “Cinema for all” is giving special season’s discounts on the prices of
tickets for groups. The original price per ticket for an adult is L.L. 8000 and for a child is L.L. 5000. The special
season’s offer is summarized in the following table:
Special Season’s Discounts
Child
Price per ticket= L.L.4000
Number of tickets
Discount rate
≥ 40
35 %
Adult
≥ 70
50 %
We would like to build a VB.Net application that calculates the cinema fee for a group of people during the
discount season. The program takes as input, the number of child tickets, as well as the number of adult tickets.
Before processing the input to calculate the fee, the program validates input in the following manner:
•
For child tickets: The program assumes that the user correctly enters a number into the textbox. The
program should reset any negative input to zero.
•
For adult tickets: In case the input for adult tickets is not a number, the program should repeatedly ask
the user to reenter the number of adult tickets up to two times using an inputbox. In case after the
second trial the input for adult tickets is still not a number, the program should then display a message
box saying: “Error: Exceeded number of trials” and discontinue the event procedure.
The graphical user interface for the “Cinema for All” project is shown below along with the skeleton of the
click event procedure for btnCompute.
Sample Output1: Assume the user wanted to buy 10
child tickets and 100 adult tickets, the program will
display:
Sample Output2: Assume the user wanted to buy 10
child tickets and 0 adult tickets, the program will
display:
Department of Computer Science
Fall 2006
CMPS 209 – Final Exam-Sample Questions
90 minutes
3/8
Your handwriting should be readable so that it can be graded.
Private Sub btnCompute_Click (ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnComputeFee.Click
………………………………………………………………………………………………………………………………………………….
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
End Sub
Department of Computer Science
Fall 2006
CMPS 209 – Final Exam-Sample Questions
90 minutes
4/8
II. SAMPLE Multiple Choice
1. The program's processing steps are grouped into logically-related programming statements called
a) modules
b) unit
c) object
d) component
2. The ____ structure involves repeating a sequence until a condition is met.
a) loop
b) sequence
c) conditional
d) selection
3. The issues that deal with the collection and use of data about individuals is
a) access
b) property
c) accuracy
d) privacy
4. Privacy is primarily a(n) ____ matter.
a) ethical
b) legal
c) security
d) business
5. People who gain unauthorized access to computers for the purpose of doing damage are called
____.
a) employees
b) hackers
c) members of organized crime
d) crackers
6. When a hard disk crashes, it is an example of a ____ type of computer security threat.
a) natural hazard
b) criminal
c) technological failure
d) civil strife
7. A ____ acts as a security buffer between a company's private network and all external networks.
a) firewall
b) password
c) disaster recovery plan
d) virus checker
8. As much as ____ percent of the total lifetime cost for an application program is for maintenance.
a) 40%
b) 50%
c) 60%
d) 75%
Department of Computer Science
Fall 2006
CMPS 209 – Final Exam-Sample Questions
90 minutes
5/8
9. Most Web-enabled devices follow a standard known as
a) FireWire
b) Bluetooth
c) TCP/IP
d) Wi-FI
10. A term relating to sending data to a satellite is
a) uplink
b) downlink
c) modulate
d) demodulate
11. The capacity of a communication channel is measured in
a) bandwidth
b) bit capacity
c) baud rate
d) data flow
12. A computer network must contain at least this number of computers.
a) two
b) a few
c) twenty
d) hundreds
13. This type of network provides access to regional service providers and typically span distances
greater than 100 miles.
a) LAN
b) MAN
c) WAN
d) WLAN
14. Which of the following is smallest ?
a) desktop System Unit
b) notebooks System Unit
c) PDA System Unit
d) tablet PC's
15. This type of memory is commonly called temporary or volatile storage .
a) RAM
b) ROM
c) Flash memory
d) virtual memory
16. Which binary coding scheme is typically used for microcomputers?
a) Unicode
b) ASCII
c) EBCDIC
d) None of the above
Department of Computer Science
Fall 2006
CMPS 209 – Final Exam-Sample Questions
90 minutes
6/8
17. Which of the following is another name for a chip?
a) Silicon chip
b) Integrated circuit
c) Semiconductor
d) All of the above
18. Computers require ______ _______ to power their electronic components and to represent data
and instructions.
a) direct concurrency (DC).
b) direct current (DC).
c) direct adapters (DC).
d) direct units (DU).
19. A variety of specialized processing chips has been developed called
a) central processing unit (CPU).
b) microprocessor chips.
c) coprocessor chips.
d) control units.
20. Select one of the following that is a basic element of every communication system.
a) Sending and receiving devices
b) Communication channel
c) Data transmission specification
d) All of the above
21. The concept of linking people and resources via computer networks is known as
a) computer linkage.
b) embedded system communication (ESC).
c) connectivity.
d) objectivity.
22. A modulator-demodulator is more commonly known as the
a) communication module.
b) satellite receiver.
c) modem.
d) serial data port.
23. The term used as a measurement of a communication channel's data capacity is
a) broadband.
b) bandwidth.
c) protocol.
d) data flow.
24. The standard protocol (communication rules for exchange of data) of the Internet is
a) TCP/IP.
b) Novell Netware.
c) Banyan Vines.
d) Peer-To-Peer Lines.
Department of Computer Science
Fall 2006
CMPS 209 – Final Exam-Sample Questions
90 minutes
7/8
25. The central host computer or file server in a star network maintains control with its connecting
devices through
a) sharing.
b) networking.
c) enterprise computing.
d) polling.
26. The network strategy extensively used throughout the Internet is a
a) terminal network system.
b) peer-to-peer network system.
c) client/server network system.
d) none of the above.
27. Which of the following is the best data Type to use for a variable that will store the number of
students registered in CMPS 209 this semester?
a) Decimal
b) Integer
c) Single
d) String
e) None of the above
28. Which of the following constants tells Visual Basic to advance to the next line?
a) Advance
b) VbGoToNewLine
c) VbAdvance
d) VbReturn
e) None of the above
29. Assume the form contains two frame controls: one frame control contains two option buttons; the
other frame control contains three check boxes. What is the total number of option buttons and
check boxes that can be selected at any one time?
a) One
b) Two
c) Three
d) Four
e) Five
30. What is the result of the expression 23 - 32 / 4 ^ 2 + 6
a) -47
b) 27
c) –2
d) 11.0625
e) none of the above
31. Which of the following is a valid condition for an If..Then.. Else statement
a) Val(txtAge.txt > 65)
b) Val(lblprice.caption) > 0 and < 10
c) Cursales > 100 and curCost <=1000
d) UCase(strState) = “Alaska” Not and Ucase(strState)= “Hawaii”
e) None of the above
Department of Computer Science
Fall 2006
CMPS 209 – Final Exam-Sample Questions
90 minutes
8/8
32. Which of the following will prompt the user for a number, then correctly assign the user’s
response to the sngNum Variable?
a) InputBox(“Enter the street number:”,”Number”) = sngNum
b) sngNum= InputBox(“Enter the street number:”,”Number”)
c) Number= val(InputBox(“Enter the street number:”,”sngNum”))
d) sngNum= val(InputBox(“Enter the street number:”,”Number”))
e) None of the above
33. Assume the intNumber variable contains the number 200. What value will be in the intNumber
variable after the following selection structure is processed?
If intNumber <=100 Then
intNumber= intNumber*2
ElseIf intNumber >500 Then
intNumber= intNumber*3
EndIf
a) 0
b) 200
c) 400
d) 600
34. What is the output of the following nested if statement when X=209 ?
If X>10 then
MsgBox “X is in the order of 10’s”
Elseif X>100 then
MsgBox “X is in the order of 100’s”
Elseif X>1000 then
MsgBox “X is in the order of 1000’s”
Else
MsgBox “X is between 0 and 10 ”
End If
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
************* END OF EXAM *************