Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub cmdCall_Click()
- Dim b As Integer
- a = 10
- b = 15
- Print a; b;
- Call mySub(a, b)
- Print a; b
- End Sub
- Private Sub mySub(x As Integer, y As Integer)
- x = 11
- y = 16
- End Sub
- What is the output of the following program?
- a. 10 15 11 16
- b. 10 15 10 15
- c. Syntax error
- d. None of the above
- Answer: c
- Explanation: The first argument is of data type Variant while the type of first parameter is Integer.
- Private Sub cmdCall_Click()
- Dim a As Integer
- Dim b As Integer
- a = 10
- b = 15
- Print a; b;
- Call mySub(a, b)
- Print a; b
- End Sub
- Private Sub mySub(x As Single, y As Integer)
- x = 11
- y = 16
- End Sub
- What is the output of the following program?
- a. 10 15 11 16
- b. 10 15 11 16
- c. Syntax error
- d. None of the above
- Answer: c
- Explanation: We told mySub to take x by reference, and as a Single, but when we called it, we passed an Integer.
- Private Sub cmdCall_Click()
- Dim a As Integer
- Dim b As Integer
- a = 10
- b = 15
- Print a; b;
- Call mySub((a), b)
- Print a; b
- End Sub
- Private Sub mySub(x As Integer, y As Integer)
- x = 11
- y = 16
- End Sub
- What is the output of the following program?
- a. 10 15 11 16
- b. 10 15 10 16
- c. 10 15 10 15
- d. Syntax error
- Answer: b
- The variable is overriden and passed by value (using an extra pair of brackets).
- Private Sub cmdCall_Click()
- Dim a As Integer
- Dim b As Integer
- a = 10
- b = 15
- Print a; b;
- Call mySub(a , a)
- Print a; b
- End Sub
- Private Sub mySub(x As Integer, y As Integer)
- x = 11
- y = 16
- End Sub
- What is the output of the following program?
- a. 10 15 11 16
- b. 10 15 16 16
- c. 10 15 16 15
- d. Syntax error
- Answer: c
- The variable a is passed twice, so it now has two memory locations.
- 4. How many asterisks will be printed after clinking on Command1?
- Private Sub Command1_Click()
- Dim a As Integer
- a = 1
- Do While (a <= 4)
- Call Mysub
- a = a + 1
- Loop
- End Sub
- Private Sub Mysub()
- Print "**" ;
- End Sub
- a. 4
- b. 6
- c. 8
- d. 10
- Answer: c
- 6. What is the output of the following block of code?
- Private Sub cmdDisplay_Click()
- Dim x As Integer, j As Integer
- j = 0
- For j = 2 To 4
- Call Add1(j)
- x = x + j
- Next j
- Print x
- End Sub
- Private Sub Add1(num As Integer)
- num = num + 1
- End Sub
- a. 8
- b. 9
- c. 6
- d. 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement