You are on page 1of 8

1. The Visual Basic Code Editor will 7.

Sizing Handles make it very easy to resize


automatically detect certain types of errors as virtually any control when developing
you are entering code. applications with Visual Basic. When working
A. True in the Form Designer, how are these sizing
B. False handles displayed?
Ans: A A. A rectangle with 4 arrows, one in each
corner, around your control.
2. Keywords are also referred to as reserved
B. A 3-D outline around your control.
words.
C. A rectangle with small squares around
A. True
your control.
B. False
D. None of the above.
Ans: A
Ans: C
3. The divide-and-conquer-method of problem
8. The Properties window plays an important
solving breaks a problem into large, general
role in the development of Visual Basic
pieces first, then refines each piece until the
applications. It is mainly used
problem is manageable.
A.to change how objects look and feel.
A. True
B. when opening programs stored on a hard
B. False
drive.
Ans: A
C. to allow the developer to graphically
design program components.
D. to set program related options like
4. Visual Basic responds to events using which
Program Name, Program Location, etc.
of the following?
Ans: A
A. a code procedure
B. an event procedure
9. When creating a new application in Visual
C. a form procedure
Basic, you are asked to supply a name for
D. a property
the program. If you do not specify a name, a
Ans: B
default name is XXXXX XXXXX is this default
name?
5. When the user clicks a button, _________ is
A. Wapplication followed by a number.
triggered.
B. Application followed by a number.
A. an event
C. WindowsApplication.
B. a method
D. WindowsApplication followed by a
C. a setting
number.
D. a property
Ans: C,B
Ans: A
10. Which of the properties in a control’s list of
6. What property of controls tells the order they
properties is used to give the control a
receive the focus when the tab key is pressed
meaningful name?
during run time?
A. Text
A. Focus order
B. ContextMenu
B. Focus number
C. ControlName
C. Tab index
D. Name
D. Control order
Ans: D
Ans: C
11. Pseudocode is 17. What is the correct statement when declaring
A. data that have been encoded for security. and assigning the value of 100 to an Integer
B. the incorrect results of a computer variable called numPeople
program. A. Dim numPeople =
C. a program that doesn’t work. B. Dim numPeople = Int(100)
D. the obscure language computer personnel C. numPeople = 100
use when speaking. D. Dim numPeople As Integer = 100
E. a description of an algorithm similar to a Ans: D
computer language.
Ans: E 18. Which of the following arithmetic operations
has the highest level of precedence?
12. An algorithm is defined as: A. + –
A. a mathematical formula that solves a B. * /
problem. C. ^ exponentiation
B. a tempo for classical music played in a D. ( )
coda. Ans: C
C. a logical sequence of steps that solve a
problem. 19. What value will be assigned to the numeric
D. a tool that designs computer programs variable x when the following statement is
and draws the user interface. executed? x = 2 + 3 * 4
Ans: C A. 20
B. 14
13. A variable declared inside an event C. 92
procedure is said to have local scope D. 234
A. True Ans: B
B. False
Ans: A 20. Which of the following is a valid name for a
variable?
14. A variable declared outside of an event A. Two_One
procedure is said to have class-level scope. B. 2One
A. True C. Two One
B. False D. Two.One
Ans: A Ans: A

15. Option Explicit requires you to declare every 21. Keywords in Visual Basic are words that
variable before its use. A. should be used when naming variables.
A. True B. are used to name controls, such as
B. False TextBox1, Command2, etc.
Ans: A C. have special meaning and should not be
used when naming variables.
16. The value returned by InputBox is a string. D. are used as prefixes for control names
A. True (such as txt, btn, lbl, and lst).
B. False Ans: C
Ans: A
22. To continue a long statement on another line,
use:
A. an underscore character. 28. Asc(“A”) is 65. What is displayed by
B. an ampersand character. txtBox.Text = Chr(65) & “BC”?
C. Ctrl + Enter. A. ABC
D. a space followed by an underscore B. A BC
character. C. 656667
Ans: A D. Not enough information is available.
Ans: A
23. What is the proper syntax when using a
message dialog box? 29. Which of the following expressions has as its
A. MessageBox.Show(“Hi there”, “Hi”) value the words “Hello World? surrounded by
B. MessageBox.Show(Hi there, Hi) quotation marks?
C. MessageBox.Show “Hi There”, “Hi” A. “Hello World”
D. MessageBox.Show Hi There, Hi B. Chr(34) & “Hello World”
Ans: A C. Chr(34) & Hello World & Chr(34)
D. Chr(34) & “Hello World” & Chr(34)
24. What will be the output of the following Ans: A
statement? txtBox.Text =
FormatCurrency(1234.567) 30. Which of the following is true?
A. $1234.567 A. “Cat” = “cat”
B. 1,234.57 B. “Cat” < “cat”
C. $1234.57 C. “Cat” > “cat”
D. $1,234.57 D. Relational operators are only valid for
Ans: D numeric values.
Ans: B
25. The following lines of code are correct. If age
>= 13 And < 20 Then txtOutput.Text = “You 31. Which of the following is a valid Visual Basic
are a teenager.” End If conditional statement?
A. True A. 2 < n < 5
B. False B. 2 < n Or < 5
Ans: B C. 2 < n Or 5
D. (2 < n) Or (n < 5)
26. Given that x = 7, y = 2, and z = 4, the Ans: D
following If block will display “TRUE”. If (x >
y) Or (y > z) Then txtBox.Text = “TRUE” End 32. The three main logical operators are
If ________, _________, and ________.
A. True A. And, Or, Not
B. False B. And, Not, If
Ans: A C. Or, Not, If
D. False, And, True
27. Asc(“A”) is 65. What is Asc(“C”)? Ans: A
A. 66
B. 67 33. Which value for x would make the following
C. 68 condition true: x >= 5
D. “C” A. x is equal to 7
Ans: B B. x is equal to 5
C. x is equal to 5.001
D. all of the above A. True
Ans: D B. False
Ans: A
34. Which value for x would make the following
condition true: Not (x >= 5) 41. A single Case statement can contain multiple
A. x is equal to 7 values.
B. x is equal to 4 A. True
C. x is equal to 5.001 B. False
D. x is equal to 5.001 Ans: A
Ans: B
42. You can specify a range of values in a Case
35. Which value for x would make the following clause by using the To keyword.
condition true: (x >= 5) And (x <= 6) A. True
A. x is equal to 7 B. False
B. x is equal to 5 Ans: A
C. x is equal to 5.001
Ans: B,C 43. A variable declared inside a Select Case
block cannot be referred to by code outside
36. Constructs in which an If block is contained of the block.
inside another If block are called: A. True
A. multi-If blocks B. False
B. nested If blocks Ans: A
C. sequential If blocks
D. none of the above 44. Suppose that the selector in a Select Case
Ans: B block is the string variable myVar. Which of
the following is NOT a valid Case clause?
37. One may use an If block within a Select Case A. Case “Adams”
block. B. Case “739”
A. True C. Case (myVar.Substring(0, 1)
B. False D. Case myVar.Length
Ans: A Ans: D

38. One may use a Select Case block within an If 45. Different items appearing in the same value
block. list of a Select Case block must be separated
A. True by a ____________.
B. False A. semi colon
Ans: A B. comma
C. colon
39. Select Case choices are determined by the D. pair of quotation marks
value of an expression called a selector. Ans: B
A. True
B. False 46. Which Case clause will be true whenever the
Ans: A value of the selector in a Select Case block is
between 1 and 5 or is 8?
40. Items in the value list must evaluate to a A. Case 1 To 8
literal of the same type as the selector B. Case 1 To 5, 8
C. Case 1 To 8, 5 D. None of the above.
D. Case 1 To 5; 8 Ans: A
Ans: B
51. Suppose a variable is passed by value to a
47. Which Case clause will be true whenever the parameter of a Sub procedure, and the
value of the selector in a Select Case block is parameter has its value changed inside the
greater than or equal to 7? Sub procedure. What will the value of the
A. Case Is >7 variable be after the Sub procedure has
B. Case Is = 8 executed?
C. Case Is >= 7 A. It will have the newly modified value from
D. Case Is <= 8 inside the Sub procedure.
Ans: C B. Its value can? it be determined without
more information
48. What type of items are valid for use in the C. It will retain the value it had before the call
value list of a Case clause? to the Sub procedure
A. literals D. None of the above.
B. variables Ans: C
C. expressions
D. all of the above 52. The declaration statement for a class-level
Ans: D variable should be placed __________.
A. inside an event procedure
49. What happens to a variable declared locally B. inside a general procedure
inside a Sub procedure after the procedure C. anywhere in the program region, except
terminates? inside a procedure
A. It maintains its value even after the End D. above the statement Public Class
Sub statement executes. frmName
B. It ceases to exist after the End Sub Ans: C
statement executes.
C. It loses its value temporarily after the End 53. Variables declared inside a procedure are
Sub statement executes, but regains that said to have ________________.
value upon re-entry to the Sub procedure. A. local scope
D. It is reset to its default value. B. procedure-level scope
Ans: B C. class-level scope
D. none of the above
50. Suppose a variable is passed by reference to Ans: A
a parameter of a Sub procedure, and the
parameter has its value changed inside the 54. What will be the output of the following
Sub procedure. What will the value of the program when the button is clicked?
variable be after the Sub procedure has Private Sub btnDisplay_Click(…) Handles
executed? btnDisplay.Click
A. It will have the newly modified value from Dim number As Double = 3
inside the Sub procedure. DoubleAndSquare(number)
B. Its value can? it be determined without txtBox.Text = CStr(number)
more information. End Sub
C. It will retain the value it had before the call Sub DoubleAndSquare(ByRef myVar As
to the Sub procedure Double)
myVar = myVar + myVar C. They can be reused easily.
myVar = myVar * myVar D. They make it possible for a team of people
A. 3 to work together on a single program.
B. 36 Ans: B
C. 6
D. 0 59. Which one of the following is true about
Ans: B arguments and parameters?
A. Arguments appear in Call statements;
55. Suppose the variable myName is declared in parameters appear in Sub statements.
a Dim statement in two different Sub B. Parameters appear in Call statements;
procedures. Which statement is true? arguments appear in Sub statements.
A. The program will malfunction when it is C. They are synonymous terms.
executed. D. They are completely unrelated in a
B. When the value of myName is changed in program.
one Sub procedure, it will also be changed in Ans: A
the other Sub procedure.
C. Visual Basic’s smart editor will alert you 60. Each individual variable in the list student(0),
that this is an error before the program is student(1), student(2) is known as a(n)
executed. A. subscript
D. The two variables will be local to their B. dimension
respective Sub procedures. C. element
Ans: D D. type
Ans: C
56. Which of the following statements is
guaranteed to pass the variable numVar by 61. The statement Const TAX_RATE As
value to the Sub procedure Tally? Doubleface=Calibri size=2> is not valid.
A. Tally(numVar) A. True
B. Tally(ByVal numVar) B. False
C. Tally((numVar)) Ans: A
D. Tally(ByVal numVar As Double) 63. Function names should be suggestive of
Ans: D the role performed. The names also must
conform to the rules for naming variables.
57. The ______________ of a Sub procedure A. True
are vehicles for passing numbers and strings B. False
to the Sub procedure. Ans: A
A. Call Statements
B. arguments 62. The input to a user-defined function can
C. parameters consist of one or more values.
D. variables declared inside A. True
Ans: C B. False
Ans: A
58. Which of the following is NOT a reason for
using procedures? 63. Both the input and output of a Function
A. They break a complex problem down into procedure can consist of several values.
smaller pieces. A. True
B. They make a program run faster. B. False
Ans: B 69. The arguments appearing in a Call statement
must match the parameters in the appropriate
66. Suppose you want to write a procedure Sub or Function header in all but one of the
that takes three numbers, num1, num2, and following ways. Which one?
num3; and returns their sum, product, and A. Number of arguments
average. It is best to use a Function B. Names of arguments
procedure for this task. C. Data type of arguments
A. True D. Order of arguments
B. False Ans: B
Ans: B
70. What will be the output of the following
64. Although a function can return a value, it program when the button is clicked?
cannot directly display information in a text Private Sub btnDisplay_Click(…) Handles
box. btnDisplay.Click
A. True Dim word, result As String
B. False word = “Benjamin”
Ans: B result = Rotate(word)
result = Rotate(result & word)
65. Function procedures can invoke other result = Rotate(result)
Function procedures. txtBox.Text = result
A. True End Sub
B. False Function Rotate(ByVal var As String) As
Ans: A String
Dim varlength As Integer
66. A Function may return up to two values. varlength = var.Length
A. True Return var.Substring(1) & var.Substring(0, 1)
B. False End Function
Ans: B A. jaminBBenjaminen
B. BenjaminBenjamin
67. The input to a user-defined function can C. njaminBe
consist of: D. None of the above
A. a single value Ans: A
B. one or more values
C. no values 71. What is displayed when the button is clicked?
D. All of the above Private Sub btnDisplay_Click(…) Handles
Ans: D btnDisplay.Click
Dim a, b as String
68. Variables appearing in the header of a Dim x as Integer
Function procedure are called a = “How now brown cow.”
____________. b = “brown”
A. values of the function x = FindIt(a, b)
B. parameters txtBox.Text = CStr(x)
C. coordinates End Sub
D. arguments Function FindIt(ByVal z1 as String, ByVal z2
Ans: B as String) As Integer
Dim x as Integer
x = z1.IndexOf(z2)
End Function
“How now”
A. 8
B. 0
C. An error
D. None of the above
Ans: D

72. A Do While loop checks the While condition


before executing the statements in the loop.
A. True
B. False
Ans: A
76. A Do?Loop Until block is always executed
at least once
A. True
B. False
Ans: A

73. A counter variable is normally incremented or


decremented by 1.
A. True
B. False
Ans: A

74. The value of the control variable should not


be altered within the body of a For?Next loop.
A. True
B. False
Ans: B

75. The body of a For…Next loop in Visual Basic


will always be executed once no matter what
the initial and terminating values are.
A. True
B. False
Ans: B

76. The body of a For…Next loop in Visual Basic


will always be executed once no matter what
the initial and terminating values are. 
duplicate question?
A. True
B. False
Ans: B

You might also like