Review question for the second exam Q1)Which one of the following is true about arguments and parameters? A. Arguments appear in Call statements; parameters appear in Sub statements. B. Parameters appear in Call statements; arguments appear in Sub statements. C. They are the same terms. D. They are completely unrelated in a program. Q2)One of the following is a valid sub procedure definition: A. Private Sub Procedure1(x) As Integer B. Private Sub 1stprocedure(x As Integer) C. Private Sub Procedure1(x As Integer) D. Private Sub Procedure1(Integer x) Q3)Given sub procedure Private Sub Output (n As Integer, s As String) PicBox.Print n; s End Sub Which of the following may be a calling statement for the procedure Change? A. Call Output (5, "55") B. Call Output ("hi", 5) C. n = “78” Call Output (6, n) D. n = 78 Call Output (6, n) E. A and C Q4)Which of the following is a valid sub procedure calling statement: A. Call S B. x = S C. Print S D. All of the above Q5)What is the output of the following code: Private Sub Command1_Click() Dim x As Integer x=2 Call Change(x, x + 1) Print x End Sub Private Sub Change(a As Integer, b As Integer) Print a; b; End Sub A. 2 3 4 B. 2 3 3 C. 2 3 2 D. 2 3 1 Q6)What is the output of the following code: Private Sub Command1_Click() Dim x As Integer x=2 Call sub1(x, x ^ x + Sqr(25)) Print x End Sub Private Sub sub1(a As Integer, b As Integer) Print a; b; End Sub A. 2 6 2 B. 2 6 6 C. 2 9 9 D. 2 9 2 Q7)What is the output of the following code: Private Sub Command1_Click() Dim num As Single num = 3 Call Cube(num) Print num End Sub Private Sub Cube(n As Single) n=n*n*n End Sub A. 3 B. 9 C. 27 D. 18 A. All of the above Q8)The following code is valid: Private Sub Command1_Click() Dim a As Integer, b As Integer Call add(a, b) End Sub Private Sub add(a As Integer) PicBox.Print a End Sub A. True B. False Q9)The following code is valid: Private Sub Command1_Click() Dim a As Integer, b As Integer Call add(a, b) End Sub Private Sub add(a As Integer, b As String) PicBox.Print a End Sub A. True B. False Q10)What is the output of this code? Private Sub Command1_Click() Dim a As Integer a=1 Call add(a) Print a End Sub Private Sub add(b As Integer) b=0 a=3 End Sub A. 3 B. 0 C. 1 D. none of the above Q11)What is the output of the following code: Private Sub Command1_Click() Dim a As Integer, b As Integer a=1 b=3 Call change(a, b) PicBox.Print a - b; End Sub Private Sub change(a As Integer, b As Integer) PicBox.Print a - b; a=a-b End Sub A. -2 -5 B. -2 -3 C. -2 2 D. 2 1 Q12)What is the output of this code? Private Sub Command1_Click() Dim c As Integer, d As Integer c=1 d=2 Call add(c, d) Print c; d End Sub Private Sub add(d As Integer, c As Integer) c=c+1 d=d+2 End Sub A. 3 3 B. 3 2 C. 2 4 D. 3 5 Q13)What is the output of the following code: Private Sub Command1_Click() Dim name As String name = "Hi " ‘ there is a space after Hi Call part(name) Print n & name End Sub Private Sub part(n As String) Print n & n & "All "; ‘ There is a space after All End Sub A. Hi Hi All B. Hi Hi All Hi C. Hi Hi All Hi Hi All D. Hi Hi All Hi Hi All Hi Q14)What is the output of the following code: Private Sub Command1_Click() Dim n As Integer n=3 Call Proc(n) Print n; Call Proc(n + 1) Print n; End Sub Private Sub proc(n As Integer) n=n+2 End Sub A. 5 8 B. 5 7 C. 5 5 D. 5 6 Q15)How many times the statement print "Good Luck" will be executed Dim i as integer,j as integer for i=4 To 6 for j=4 To i print "Good Luck" Next j Next i A. 3 B. 4 C. 6 D. 9 Q16)How many times the statement print "Good Luck" will be executed Dim i as integer,j as integer for i=0 To 3 for j=0 To 0 print "Good Luck" Next j Next i A. 3 B. 4 C. 0 D. 6 Q17)What is the output of the following code Dim a as integer a=5 for a=3 To 1 step -1 print a; Next a print a A. 3 2 1 1 B. 3 2 1 0 C. 5 3 2 1 D. 5 3 2 0 Q18)How many times the following code executes the print statement a=0 Do Print a + 1 Loop Until a <= 10 A. 1 B. 0 C. 10 D. 11 Q19)How many times the following code executes the print statement a=1 Do Until a < 10 Print a + 2 Loop A. 0 B. 1 C. 4 D. 5 Q20)What is value of x after the following code executes? f = True x = 10 Do While (f) If (x / 4 = 1) Then f = False x=x-1 Loop print x A. 3 B. 0 C. 8 D. 7 Q21) Assume that the file Data.txt contains the following entries: 1, 9, 5, 3, 7, 4, 9, 2, 1, 1, 5 and the file Numbers.txt contains the following entries: 2,4,5,1 What is the output of the following code? Dim y As Integer Open "Data.txt" For Input As #1 Open "Numbers.txt" For Input As #2 Do Input #1, x If x < 7 Then Input #2, y End If Print x + y; Loop Until EOF(1) Or EOF(2) A. 3 11 9 8 12 5 B. 3 13 10 4 C. 3 13 10 4 7 4 9 2 1 1 5 D. 3 9 9 8 7 5 Q22)When passing arguments to a sub procedure: B. The number of arguments and parameters must match. C. The data type of each argument must match its corresponding parameter. D. The names of arguments and parameters must be the same E. A and B