Quiz 3
1. What is an infinite loop?
-A
OR
-A
�2. What will
the following Visual Basic code print?
Dim x As Integer
x=10
If x=1 Then
������������������ Print �pizza�
ElseIf x=2 Then
������������������ Print �hamburger��������������� sushi
Else������������������������������������������ chocolate cake
������������������ Print �sushi�
End If
Print �chocolate cake�
3. When the following Visual Basic code is run, how
many times will �Ontogeny recapitulates phylogeny� be
printed out?
Dim x As Integer
x = 0�������������������������������������������������� ������������������ 5
times
Do While x < 10
��� �������������� Print
�Ontogeny recapitulates phylogeny�
��� �������������� x
= x + 2
4. Look at the
following code. After this code is run, what will the values of i, j, and k be?
Dim Option Explicit
Dim i as Integer,
j as Integer, k As Integer
Private Sub add (x
as Integer, y As Integer, r as Integer)
������������������ r = x + y
End Sub
Private Sub Form_Load()
i = 0����������������������������������������� i = 6
j = 0����������������������������������������� j = 3
k = 0���������������������������������������� k = 3�
Call add (3, i, j)
Call add (i, j, k)
Call add (j, k, i)
End Sub
5. �In Visual
Basic, what does Rnd do?
����������� Generates a pseudo-random decimal number between 0 and 1,
not including 0 or 1