First Review

advertisement
Q1)”GUI” is an acronym for -------------------.
a. Graphical User Interchange
b. Graphical User Interface
c. Global User Interchange
d. Graphics Units Interface
Q2)Visual Basic .NET console applications begin executing at Main, although it may not be the
first procedure in your program.
a. True
b. False
Q3) Object-Oriented Programming is easier to understand, correct and modify than structured
programming
a. True
b. False
Q5) What is the output of the following statement?
7 Mod 3 * -2 + 12 \ 6 / 2 + 1
a.
b.
c.
d.
e.
f.
7
4
3
-6
6
9.6
Q6) Which is the correct hierarchy for arithmetic operators (from those evaluated first to those
evaluated last)?
a. ^, * /, Mod,\,+ b. * /, + -, ^, Mod
c. ( ), ^, * /, \,+ -, Mod
d. ( ), ^, * /, \,+ e. ( ), ^, * /, \,&,+ -
Q7) Which of the following is True?
a.
b.
c.
d.
e.
Cat" = "cat"
"Cat" > "cat"
"Cat" >= "cat"
"Cat" <> "Cat"
"Cat" < "cat"
Q8) The value of C after executing the following statements is:
Dim X As Integer = 5, Y As Integer = 35
Dim C As Integer = 6
C = X + 2 - 3 ^ 2 / (X * 2 - 1)
a.
b.
c.
d.
6
30
35
5
Q9) What is the output of the code below?
S1 = "Amal"
S2 = " amal" 'there is a space!
Num = 10
IF (S1 > S2) Then
Num = 100
Else
Num = 50
EndIf
Console.WriteLine(num)
a.
b.
c.
d.
e.
10
100
150
50
Nothing
Q10) The value of the following expression?
2 * 3 - 2 - 7 / 3 Mod 2 > 2
a.
b.
c.
d.
True
4
3.67
False
Q11) What is the output of the following code?
Dim x As Integer = 1
Dim y As Integer = 2
Dim z As Integer = 4
If (x > y) Or (y > z) Then
Console.WriteLine("TRUE")
ElseIf (x > y) And (y > z) Then
Console.WriteLine("FALSE")
Else
Console.WriteLine("Else")
End If
a.
b.
c.
d.
nothing will be printed
FALSE
TRUE
Else
Q12) What will be the output of the following program?
Dim x As Single, y As Single, z As Single
x = 3
y = 3
If x > y Then
z = x + y
Else
z = y - x
End If
Console.WriteLine(z)
a.
b.
c.
d.
e.
6
3
0
-3
z
Q13) Which of the following is not true?
a. In a Do While/Loop you may not enter the body of the structure, while in Do/Loop While
you’ll enter at least once.
b. Loop statement jumps to the header of the repetition structure, while Next
increments/decrements the counter, then jumps to the header of the For structure.
c. In a Do/Loop While structure you check the truth of the condition to continue looping,
while in Do/Loop Until structure you check for falsity to continue.
d. All are true.
Q14) How many times the "Do While" loop will be executed?
Dim x As Integer, y As Integer
x = 0
Do While x < 10
x = x + 1
y = 1
Do Until y = 3
x = x + y
y = y + 1
Loop
Loop
a.
b.
c.
d.
e.
2
0
1
3
10
Q15) What is the output of the following code?
Dim num As Integer = 4
Do While num < 10
num = num + 1
Console.Write(num)
Loop
a.
b.
c.
d.
456789
5 6 7 8 9 10
4 5 6 7 8 9 10
5 6 7 8 9 10 11
Q16) What is the output of the following code?
Dim x As Integer, y As Integer = 4
y = 0
Do Until x > 3
Console.Write("{0}" & vbTab, y)
x = x + 1
y = y + x + 1
Loop
a.
b.
c.
d.
0 2 5 9 14
02 4 6
0259
0 2 5
Q17) What is the output of the following code?
Dim i As Integer = 2
For i = 0 To 6 Step 2
Console.WriteLine(i)
Next i
a.
b.
c.
d.
246
0246
024
2222
Q18) What is the output of the following code?
Dim
x =
y =
z =
For
i
2
3
1
i
x
y
z
i
As Integer, x As Integer, y As Integer, z As Integer
=
=
=
=
=
x
x
y
z
i
To y * 2 Step z
+ 1
+ 1
* 3
+ 2
Next
Console.Write(i & " " & x & " " & y & " " & z)
a.
b.
c.
d.
Infinite For loop.
8459
8231
None of the above
Q19) What is the value of "i" after the following code is executed?
Dim i As Integer= 3
For i = 1 To 5.8 Step 1
Console.WriteLine(i)
Next i
a.
b.
c.
d.
e.
5
6
7
1
3
Q20) What is the value of "i" after the following code is executed?
Dim i As Decimal = 3
For i = 1 To 5.8 Step 1
Console.WriteLine(i)
Next i
a.
b.
c.
d.
e.
6
5
3
1
6.8
Q22) If amount=71234.76, the statement String.Format("{0:N}", amount) will generate:
A. 71235
B. 71,234.8
C. $71,234.70
D. 7.123476E+004
E. 71,234.70
F. 71,234.7
Q23). The Scientific notation of 237804.4 is
A. 2.378E+05
B. 2.378044E+005
C. 237804.4
D. 2378044E-001
E. None
Q24) In the statement MessageBox.Show, if you omit the title part, then ------.
a. The project name will be displayed in the title of the message box.
b. The statement "MessageBox Title" will be displayed in the title of the message box.
c. Nothing will be displayed in the title of the message box.
d. Error will be generated.
What is the output of the following code?
Dim x As Integer, c As Integer
x = 2
Do While x < 10
For c = 1 To x Step 2
Select Case x
Case 3 To 5
Console.Write(x & " ")
Case 6, 2 To 4
Exit Do
Case Else
Console.Write(x & "$")
End Select
x = x + 2
Next
Loop
Console.Write("Finished " & x)
What is the output of the following code?
Dim x As Integer, y As Integer, num As Integer
x = 2
num = x ^ 3 - x
Select Case num
Case 3 - x, x
Console.WriteLine("Buckle my shoe.")
Case Is <= 4
Console.WriteLine("Shut the door.")
Case x + 3 To x * 3
Console.WriteLine("Pick up sticks.")
Case Else
Console.WriteLine("Start all over again.")
End Select
What is the output of the following code?
Dim str1 As String = "PROZAC"
Select Case str1
Case "PROzac"
Console.WriteLine("Pick up sticks.")
Case "A" To "P"
Console.WriteLine("Buckle my shoe.")
Case Is > "P"
Console.WriteLine("Shut the door.")
Case Else
Console.WriteLine("Start all over again.")
End Select
How many times the write statement will be executed?
Dim i As Integer, j As Integer = 5
For i = 0 To 5
For j = i + 2 To i Step -1
If j = i Then
Console.Write("{0} ", i)
Exit For
End If
Next
Next
How many times the write statement will be executed?
Dim counter As Integer
Do Until counter > 10
Console.Write("{0} ", counter)
If counter = 5 Then
Exit Do
End If
counter += 1
Loop
What is the value of i after the execution ends?
Dim i As Integer, counter As Integer
For i = 1 To 5
Do Until counter > 10
If counter = 5 Then
Exit For
End If
counter += 1
Loop
Next
Console.Write("{0} ", i)
What is the output of the following code?
Dim x As Integer = 5, y As Integer = 15
Console.WriteLine(Not x = y Xor y > x AndAlso y <> 15)
What is the output of the following code?
Dim x As Integer = 5, y As Integer = 15
Console.WriteLine(y \ x <> 0 Xor x = y / 3 OrElse Not 2 <> 1 AndAlso
"H" & "Ell" < "Hello")
Download