CMPS 209 Final, Fall 2004
American University of Beirut · Computers and Programming for the Sciences · 10 pages
More CMPS 209 files
Show the text of this final exam
American University ; j canal SS
of Beirut lame ay UN EhSIP
LIBKARY
OF BEIRUT
Department of Computer Science Fall 04-05 ~~
CMPS 209 ~ Final exam . 90 minutes
CAME SON VERSIT
. LEBKARY
Instructions: [L OF BEIRUT
1. Make sure that you have one answer sheet and a question booklet of 10 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 Bliss 203
SEAT
NUMBER
Mrs. Hayat Bohsali
INSTRUCTOR Mr. Wassim Mukaddam
Ms. Afaf Tabsh
SIGNATURE
Department of Computer Science Fall 04-05
CMPS 209 - Final exam 90 minutes
Programming (20 %)
You are hired by ABC Postal Services to develop an application that computes the
delivery charges. Three factors are considered when calculating the delivery charges
of packages: weight of the package, package type, and type of delivery.
The interface for the application is as follows:
optLetter
optBox
xt Weight
cmdCalculate
Fill in the visual basic code for the event procedure of cmdCal culate to help
compute the delivery charges of a package. The company allows two types of
packages (letter or box), and two types of delivery service (Fast or Regular).
« ABC Postal Services computes the delivery charges according to the
following table:
Weight <50 grams Weight 250 grams
Letter 2250 LL. 20 L.L. per gram
Box 4000 L.L. 90 L.L. per gram
When the fast delivery option is selected, 50 % of the amount of the bill is
added to the bill.
The calculated amount should be displayed on a message box.
Assume that the weight entered by the user is always a number.
Use constants and variables in your code.
Sample output for a shipment
packaged as a letter whose
weight is 250 gram sent using
fast delivery service is:
Department of Computer Science Fall 04-05
CMPS 209 - Final exam
90 minutes
Sfour handwriting should be readable $0 that it can be graded.
Option Explicit
Private Sub cmdCalculate_Click()
Department of Computer Science Fall 04-05
CMPS 209 — Final exam 90 minutes
Flowcharts (10 %)
Develop a flowchart for a program that asks the user to enter two numbers. In case the first
number is double the second number, the program will display the sum and the product of the
two numbers entered by the user/ Otherwise, the program will keep on subtracting three from
the larger number until it becomes less than or equal to the smaller. When done, the program
will display how many times it repeated the subtraction step.
Department of Computer Science Fall 04-05
CMPS 209 — Final exam 90 minutes
SAMPLE Multiple Choice (70%)
1, Which binary coding scheme is typically used for microcomputers?
a) Unicode
b) ASCII
c) EBCDIC
d) None of the above
. Which of the following is another name for a chip?
a) Silicon chip
b) Integrated circuit
c) Semiconductor
d) All of the above
. 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).
. A variety of specialized processing chips has been developed:called
a) central processing unit (CPU).
b) microprocessor chips.
c) coprocessor chips.
d) control units.
. How many bits are there in a:byte?:
a) 20
b) 4
c) 16
d) 8
. The most common type of monitor used in offices and homes is this kind of monitor.
a) Liquid:crystal.display
b) Data projectors
c) Cathode-ray tube
d) None ofthe above
. The most common types of output are
a) text, resolutions, and graphics.
b) graphics, resolution, and pixels.
c) text, graphics, audio, and video.
d) text, graphics, and input.
. Which of the following is not an example of an input device?
a) Mouse
b) Scanner
c) Printer
d) Keyboard
Department of Computer Science Fall 04-05
CMPS 209 - Final exam 90 minutes
. The most common way to input data into a computer is with a
a) light pen.
b) keyboard.
c) scanner.
d) touch screen.
. Which of the following devices performs a function similar to that of a mouse?
a) Touch surface
b) Touch screen
c) Wand reader
d) Light pen
. Voice recognition systems use:
a) head tracking, a sound card, and special software.
b) a joystick, a sound card, and special software.
c) a microphone, a sound card, and special software.
d) amicrophone, an alternative mouse, and special software.
. One of the following is not an example of a floppy diskette.
a) Zip disk
b) SuperDisk
c) Hard disk
d) HiFD disk
. Floppy disks utilize this to protect the disk from accidentally erasing data.
a) Write-protect notch
b) Lock-up notch
c) Storage-protect notch
d) Read Only notch
. The internal hard disk‘of'a:system unit is also called a
a) hard-disk cartridge.
b) PC card hard disk.
c) fixed disk.
d) hard-disk:pack.
. For most microcomputer systems, the internal hard drive disk is designated as the
a) D Drive.
b) A Drive.
c) J Drive.
d) C Drive.
. A typical microcomputer's internal hard disk has a
a) motor, system board, and read/write heads.
b) motor, read/write heads, and four metallic platters sealed inside a container.
c) read/write heads, system board, and a jewel box.
d) none of the above
Department of Computer Science Fall 04-05
CMPS 209 - Final exam 90 minutes
17. Which of the following secondary storage devices does not have moving parts?
a) Hard disks
b) Solid-state storage devices
c) Read/write heads
d) All of the above
. Three types of compact disks include CD-ROM, CD-R, and
a) CD-W.
b) CD-RAM.
c) CD-DVD.
d) CD-RW.
_ 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
. 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.
. A modulator-demodulator is more:commonly known as the
a) communication module.
b) satellite receiver.
c) modem.
d) serial data port.
_ The term used as'a‘measurement of a communication channel's data capacity is
a) broadband.
b) bandwidth.
c) protocol.
d) data flow.
. 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.
. 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.
Department of Computer Science Fall 04-05
CMPS 209 — Final exam 90 minutes
25,
26,
27.
28.
29,
30.
31.
The network strategy extensively used throughout the Intemet is a
a) terminal network system.
b) peer-to-peer network system.
c) client/server network system.
d) none of the above.
Which of the following is the best data Type to use for a variable that will always
contain whole numbers in the range 0 to 20,000?
a) Currency
b) Integer
c) Long
d) Single
e) Variant
Which of the following constants tells Visual Basic to advance to the next line?
a) Advance
b) VbGoToNewLine
c) VWbAdvance
d) VbReturn
e) None of the above
You can use a(n) control to execute code at regular intervals.
a) Clock
b) Interval
c) Time
d) Timer
e) None of the above
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
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
Which of the following is a valid condition for an If..Then.. Else statement
a) Val(txtAge.txt > 65)
b) Val(ibiprice.caption) > 0 and < 10
c) Cursales > 100 and curCost <=1000
d) UCase(strState) = “Alaska” Not and Ucase(strState)= “Hawaii”
e) None of the above
8/10
Department of Computer Science Fall 04-05
CMPS 209 - Final exam 90 minutes
32. Assume you want to compare the string contained in the Text property of the txtName
control. With the name Bob. Which of the following conditions should you use in the
If....Then...Else statement?(Be sure the condition will handle Bob, BOB,bob, and so
on.)
a) TxtName.text="BOB”
b) Txtname.text=Ucase(““BOB”)
c) Txtname.text=Ucase(“Bob”)
d) Ucase(txtName.Text)="Bob”
e) Ucase(txtName.Text)= “BOB”
_ 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
_ Assume the intNumber variable contains the number 200. What value will be in the
intNumber variable after the following selection structure is processed?
Tf intNumber <=100 Then
intNumber= intNumber*2
ElseIf intNumber >500 Then
intNumber= intNumber*3
EndIf
a) 0
b) 200
c) 400
d) 600
35, 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 xX>100
MsgBox “X is in the order of 100’s”
Blseif X>1000
MsgBox “X is in the order of 1000's”
Else
MsgBox “X is between 0 and 10 ”
Department of Computer Science Fall 04-05
CMPS 209 — Final exam 90 minutes
36. Write a VB statement to display the message box shown below:
amani ‘ youiteed tim for 3 dey.
Teach a man‘to fish and you feed bim For-a Mfetime.
37. What goes wrong when a user clicks on the cmdButton control? Explain your answer
Private Sub cmdButton_Click()
Dim intOne As Integer, intTwo As Integer, intThree As
Integer
intOne = 25000
intTwo = intOne
intThree = intOne + intTwo
MsgBox intThree
End Sub
KAKKKKKEKRKEKKA END OF EXAM KARKAKKKKKKKKAE