Answer those Assignment question
PART A-MULTIPLE CHOICE QUESTIONS (1 mark each / total 10 marks)
1. After the execution of the following program,
Dim x As Integer = 0
For i As Integer = 1 To 2
For j As Integer = 12 To 10 Step -1
xt=i
Next j
Next i
the value of the variable x is
A. 8
B. 9
C. 10
D. None of above
2. After the execution of the following program,
Dim x As Integer = 10
Dim y As Integer = 1
While (x > 1)
y=x+1
x= x – 1
End While
the value of the variable y is
ndows
2. After the execution of the following program,
Dim x As Integer = 10
Dim y As Integer = 1
While (x > 1)
y=x+1
X=X-1
End While
the value of the variable y is
A. 1
B. 2
C. 3
D. None of above
3. After the execution of the following program,
Dim x As Integer = 10
Dim y As Integer = 1
Do
y=x+1
X=X-1
Loop Until (x< 1)
the value of the variable y is
A. 1
B. 2
C. 3
D. None of above
e
3. After the execution of the following program,
Dim As Integer = 10
Dim y As Integer =1
Do
y=x+1
X=X-1
Loop Until (x< 1)
the value of the variable y is
A. 1
B. 2
C. 3
D. None of above
1
4. After the execution of the following program,
Dim x(As Integer = {10, 20, 30)
Dim y As Integer = 0
For Each i As Integer In x
For Each j As Integer In x
If (i = j) Then
y+=1
End If
Next j
Next i
the value of the variable y is
A. 1
B. 2
c 3
e
A
4. After the execution of the following program,
Dim x() As Integer = {10, 20, 30)
Dim y As Integer = 0
For Each i As Integer In x
For Each j As Integer In x
If (i =j) Then
y+= 1
End If
Next j
Next i
the value of the variable y is
A. 1
B. 2
C. 3
D. None of above
5. After the execution of the following program,
Dim x() As Boolean = {False, True, False}
Dim y As String = "Guess"
For Each i As Boolean In x
If (Not i) Then
y &=y
End If
Next
the value of the variable y is
A. Guess
B. Guess Guess
C. Guess Guess Guess
D. GuessGuess Guess Guess
0
BE
e
Dimy
For Each i As Boolean In x
If (Not i) Then
y &=y
End If
Next
the value of the variable y is
A. Guess
B. Guess Guess
C. GuessGuessGuess
D. Guess Guess Guess Guess
6. Suppose that the VB.NET subroutine “Simple" is defined as follows:
Sub Simple (ByRef a As Integer, ByVal b As Integer)
Dim temp As Integer
temp = a
a=b
b = temp
End Sub
Which of the following VB.NET code segments is illegal and thus will result in a compiling
error?
A. Dim a As Integer = 1
Dim b As Integer = 3
Simple(a, b)
B. Dim a As Integer = 1
Simple(a, 3)
C. Dim a As Integer = 1
Simple(a, a+2)
D. Simple(1, 3)