Quiz 5
comp 125-609, Goldwasser
Tuesday, 12 October 1999
This quiz covers the following cumulative material:
(alphabetical, with new topics shown in italics)
Name: _________________________
Please Circle the one correct answer. If I can't tell which ONE is
circled, it will unfortunately be marked wrong.
1. Which of the following would be a legal way to declare a
two-dimensional integer array for holding a matrix with 5
rows and 10 columns?
(A) Dim Matrix(5 x 10) As Integer
(B) Dim Matrix(1 to 5, 1 to 10) As Integer
(C) Dim Matrix(5 to 10) As Integer
(D) Dim Matrix(1 to 5)(1 to 10) As Integer
2. Which of the following is NOT a legal way to create a new
control array or to add a control to an existing control
array? (assuming we are working with TextBox's)
(A) Give a new TextBox the same name as an existing TextBox at
design time.
(B) Copy and then Paste an existing TextBox at design time.
(C) Type Dim myarray(1 to 10) As TextBox to create ten
TextBox's at run time
(D) Type Load myarray(5) to add to an existing control
array at run time.
3. Assume that we want a control array of 10 command buttons
which appear on the screen with each one immediately to the
right of the previous one. We will place the first control
at design time and name it cmd(1), and the rest will be
created by the following code:
Private Sub Form_Load()
Dim X As Integer
For X = 2 to 10 Do
Load cmd(X)
[----------]
cmd(X).Visible = True
Loop
End Sub
For this code to accomplish our goal, what line could appear in place
of "[----------]"?
(A) cmd(X).Left = cmd(X-1).Left + cmd(X-1).Width
(B) cmd(X).Left = cmd(X-1).Right
(C) cmd(X).Left = cmd(X-1).Left + 500
(D) cmd(X).Left = cmd(X-1).Width
4. After reaching a breakpoint when debugging, which of the
following is NOT a valid method for obtaining the current
value of a variable
(A) Setting another breakpoint at the "Dim" statement for that variable
(B) Pointing the mouse above the variable name in the code window
(C) Creating a Watch for the variable
(D) Printing the variable using the Immediate Window
5. When you add a Watch while using the debugger, you are asked
to select a "Watch Type" from one of three choices. Which
of the following is NOT among these choices?