We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 22
V.B 6.0
Gi fre visattasc tutorblogspot.com/2017/01A7sualbsi-multple-choce-qvestons hil
Visual Basic Multiple Choice Questions and Answers
1. The Visual Basic Code Editor will automatically detect certain types of errors as you are entering
code.
A True
B. False
Ans: A
2. Keywords are also referred to as reserved words.
A True
B. False
Ans: A
3. The divide-and-conquer-method of problem solving breaks a problem into large, general pieces
first, then refines each piece until the problem is manageable,
A True
B. False
Ans: A
4, Visual Basic responds to events using which of the following?
A.acode procedure
B. an event procedure
C.a form procedure
D.a property
Ans: B
5. When the user clicks a button, is triggered
Aan event
B.amethod
C.a setting
D.a property
Ans: A
6. What property of controls tells the order they receive the focus when the tab key is pressed
during run time?
A Focus order
B. Focus number
C. Tab index
D. Control order
Ans: C
7. Sizing Handles make it very easy to resize virtually any control when developing applications with
Visual Basic, When working in the Form Designer, how are these sizing handles displayed?
‘A Arectangle with 4 arrows, one in each corner, around your control.
B. A3-D outline around your control.C.A rectangle with small squares around your control
D. None of the above.
Ans: C
8. The Properties window plays an important role in the development of Visual Basic applications. It
is mainly used
Ato change how objects look and feel.
B. when opening programs stored on a hard drive.
C. to allow the developer to graphically design program components.
D. to set program related options like Program Name, Program Location, ete.
‘Ans: A
9. When creating a new application in Visual Basic, you are asked to supply a name for the program.
Ifyou do not specify a name, a default name is XXXXX XXXXX is this default name?
‘A. Wapplication followed by a number.
B, Application followed by a number.
C. WindowsApplication.
D. WindowsApplication followed by a number.
Ans: CB
10. Which of the properties in a control's list of properties is used to give the control a meaningful
name?
A Text
B, ContextMenu
C.ControlName
D. Name
Ans: D
11. Pseudocode is
‘A. data that have been encoded for security.
B, the incorrect results of a computer program.
C.a program that doesn’t work.
D. the obscure language computer personnel use when speaking.
E. a description of an algorithm similar to a computer language
Ans: E
12. An algorithm is defined as:
‘A.a mathematical formula that solves a problem.
B. a tempo for classical music played in a coda.
C.a logical sequence of steps that solve a problem.
D. a tool that designs computer programs and draws the user interface.
Ans: C
13. A variable declared inside an event procedure is said to have local scope
ATrue
B. False
Ans: A.
14.A variable declared outside of an event procedure is said to have class-level scope.
A. True
B. FalseAns: A
15, Option Explicit requires you to declare every variable before its use
A True
B. False
Ans: A
16. The value returned by InputBox is a string,
ATrue
B. False
Ans: A
17. What is the correct statement when declaring and assigning the value of 100 to an Integer
variable called numPeople
A. Dim numPeople =
B, Dim numPeople = Int(100)
C.numPeople = 100
D. Dim numPeople As Integer = 100
Ans: D
18. Which of the following arithmetic operations has the highest level of precedence?
AdH
Bt/
C.* exponentiation
0.)
Ans: C
19, What value will be assigned to the numeric variable x when the following statement is executed?
x=2+344
A.20
B14
92
D.234
Ans: B
20. Which of the following is a valid name for a variable?
‘A. Two_One
B.20ne
C. Two One
D. Two.One
Ans: A
21. Keywords in Visual Basic are words that,
A. should be used when naming variables.
B. are used to name controls, such as TextBox1, Command2, ete.
C.have special meaning and should not be used when naming variables.
D. are used as prefixes for control names (such as txt, btn, Ibl, and Ist).
Ans: C
22, To continue a long statement on another line, use:
A.an underscore character.
B. an ampersand character.C.Ctrl + Enter.
D. a space followed by an underscore character.
Ans: A
23. What is the proper syntax when using a message dialog box?
‘A. MessageBox.Show("Hi there”, °Hi")
B, MessageBox Show(Hi there, Hi)
C. MessageBoxShow "Hi There", "Hi"
D. MessageBox Show Hi There, Hi
Ans: A
24, What will be the output of the following statement? txtBox Text
A. $1234.567
B, 1,234.57
€. $1234.57
D. $1,234.57
Ans: D
25. The following lines of code are correct. If age >= 13 And < 20 Then txtOutput Text = "You are a
teenager.” End If
A True
B. False
Ans: B
‘ormatCurrency(1234.567)
26. Given that x = 7, y = 2, and z = 4, the following If block will display “TRUE”. If (x > y) Or (y > 2)
Then txtBox.Text = “TRUE” End If
A. True
B. False
Ans: A
27. Asc("
A66
B.67
C68
D."c"
Ans: B
is 65. What is Asc("C")?
28. Asc{’A’) is 65. What is displayed by txtBox.Text = Chr(65) & "BC"?
A. ABC
B.ABC
C. 656667
D. Not enough information is available.
Ans: A.
29. Which of the following expressions has as its value the words "Hello World? surrounded by
quotation marks?
A. “Hello World”
B. Chr(34) & “Hello World”
C. Chr(34) & Hello World & Chr(34)
D. Chr(34) & “Hello World” & Chr(34)
Ans: A.30. Which of the following is true?
A."Cat" = “cat”
B."Cat" < “cat”
C."Cat” > “cat”
D. Relational operators are only valid for numeric values.
Ans: B
31. Which of the following is a valid Visual Basic conditional statement?
A2= 5
A.xis equal to 7
B. xis equal to 5
C.xis equal to 5.001
D. all of the above
Ans: D
34, Which value for x would make the following condition true: Not (x >= 5)
A.xis equal to 7
Bx is equal to 4
C.xis equal to 5.001
D. xis equal to 5.001
Ans: B
35, Which value for x would make the following condition true: (x >= 5) And (x <= 6)
Axis equal to 7
B. xis equal to 5
C.xis equal to 5.001
Ans: B,C
36. Constructs in which an If block is contained inside another If block are called
A. multi-If blocks
B. nested If blocks
C. sequential If blocks
D. none of the above
Ans: B
37. One may use an If block within a Select Case block.
A True
B. False
Ans: A
38. One may use a Select Case block within an If block.A True
B, False
Ans: A
39, Select Case choices are determined by the value of an expression called a selector.
A True
B. False
Ans: A
40. Items in the value list must evaluate to a literal of the same type as the selector
A True
B. False
‘Ans: A
41, A single Case statement can contain multiple values,
A True
B. False
Ans: A
42, You can specify a range of values in a Case clause by using the To keyword.
A True
B. False
Ans: A
43, A variable declared inside a Select Case block cannot be referred to by code outside of the
block.
A Tue
B. False
‘Ans: A
44, Suppose that the selector in a Select Case block is the string variable myVar. Which of the
following is NOT a valid Case clause?
A.Case "Adams"
B. Case "739"
C. Case (myVar-Substring(0, 1)
D. Case myVar.Length
‘Ans: D
45, Different items appearing in the same value list of a Select Case block must be separated by a
A. semi colon
B, comma
C.colon
D. pair of quotation marks
Ans: B
46, Which Case clause will be true whenever the value of the selector in a Select Case block is
between 1 and 5 or is 8?
A Case 1708
B.Case 1705,8
C.Case 1108,5
D. Case 1 To 5:8
Ans: B47. Which Case clause will be true whenever the value of the selector in a Select Case block is
greater than or equal to 7?
A. Case Is >7
B. Case Is = 8
C. Case Is
D. Case Is
Ans: C
48, What type of items are valid for use in the value list of a Case clause?
A. literals
B. variables
C. expressions
D. all of the above
Ans: D
49, What happens to a variable declared locally inside a Sub procedure after the procedure
terminates?
A. It maintains its value even after the End Sub statement executes.
B, It ceases to exist after the End Sub statement executes.
Cilt loses its value temporarily after the End Sub statement executes, but regains that value upon re-
entry to the Sub procedure
D. Itis reset to its default value.
‘Ans: B
50. Suppose a variable is passed by reference to a parameter of a Sub procedure, and the
parameter has its value changed inside the Sub procedure. What will the value of the variable be
after the Sub procedure has executed?
A. It will have the newly modified value from inside the Sub procedure.
B. Its value can?t be determined without more information.
C. It will retain the value it had before the call to the Sub procedure
D. None of the above.
Ans: A
51. Suppose a variable is passed by value to a parameter of a Sub procedure, and the parameter has
its value changed inside the Sub procedure. What will the value of the variable be after the Sub
procedure has executed?
A Itwill have the newly modified value from inside the Sub procedure.
B. Its value can?t be determined without more information
C. It will retain the value it had before the call to the Sub procedure
D. None of the above.
Ans: C
52. The declaration statement for a class-level variable should be placed
A inside an event procedure
B. inside a general procedure
C. anywhere in the program region, except inside a procedure
D. above the statement Public Class frmName
Ans: C53. Variables declared inside a procedure are said to have
A local scope
B. procedure-level scope
C. class-level scope
D. none of the above
Ans: A
54, What will be the output of the following program when the button is clicked?
Private Sub btnDisplay Click(..) Handles btnDisplay.Click
Dim number As Double = 3
DoubleAndSquare(number)
txtBox Text = CStr(number)
End Sub
Sub DoubleAndSquare(ByRef myVar As Double)
myVar = myVar + myVar
myVar = myVar * myVar
AB
B.36
C6
D.o
Ans: B
55. Suppose the variable myName is declared in a Dim statement in two different Sub procedures.
Which statement is true?
‘A The program will malfunction when it is executed.
B, When the value of myName is changed in one Sub procedure, it will also be changed in the other
Sub procedure.
C. Visual Basic’s smart editor will alert you that this is an error before the program is executed.
D. The two variables will be local to their respective Sub procedures.
Ans: D
56. Which of the following statements is guaranteed to pass the variable numVar by value to the
Sub procedure Tally?
A.Tally(numVar)
B, Tally(ByVal numVar)
C.Tally((numVan))
D. Tally(ByVal numVar As Double)
Ans: D
57. The of a Sub procedure are vehicles for passing numbers and strings to the Sub
procedure.
A. Call Statements
B. arguments
C. parameters
D. variables declared inside
Ans: €
58. Which of the following is NOT a reason for using procedures?
A. They break a complex problem down into smaller pieces
B, They make a program run faster.
C. They can be reused easily.D. They make it possible for a team of people to work together on a single program.
Ans: B
59, 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 synonymous terms.
D. They are completely unrelated in a program.
Ans: A
60.Each individual variable in the list student(0), student(1), student(2) is known as a(n)
A. subscript
B, dimension
C.element
D. type
Ans:
62. The statement Const TAX_RATE As Doubleface=Calibri size=2> is not valid.
A True
B. False
Ans: A
63. Function names should be suggestive of the role performed. The names also must conform to
the rules for naming variables.
A True
B. False
Ans: A
64. The input to a user-defined function can consist of one or more values.
A True
B. False
‘Ans: A
65. Both the input and output of a Function procedure can consist of several values.
A True
B. False
Ans: B
66, Suppose you want to write a procedure that takes three numbers, num1, num2, and num3; and
returns their sum, product, and average. It is best to use a Function procedure for this task.
ATrue
B. False
Ans: B
67. Although a function can return a value, it cannot directly display information in a text box.
ATrue
B. False
Ans: B
68, Function procedures can invoke other Function procedures.
A True
B. False
Ans: A69. A Function may return up to two values.
A True
B. False
Ans: B
70. The input to a user-defined function can consist of:
Aa single value
B. one or more values
C.no values
D. All of the above
‘Ans: D
71. Variables appearing in the header of a Function procedure are called
A. values of the function
B. parameters
C. coordinates
D. arguments
Ans: B
72. The arguments appearing in a Call statement must match the parameters in the appropriate Sub
or Function header in all but one of the following ways. Which one?
‘A. Number of arguments
B, Names of arguments
C. Data type of arguments
D. Order of arguments
Ans: B
73. What will be the output of the following program when the button is clicked?
Private Sub btnDisplay_Click(..) Handles btnDisplay.Click
Dim word, result As String
word = “Benjamin”
result = Rotate(word)
result = Rotate(result & word)
result = Rotate(result)
txtBox Text = result
End Sub
Function Rotate(ByVal var As String) As String
Dim varlength As Integer
varlength = var.Length
Return var Substring(1) & var Substring(0, 1)
End Function
A jaminBBenjaminen
B, BenjaminBenjamin
C.njaminBe
D. None of the above
Ans: A
74, What is displayed when the button is clicked?
Private Sub btnDisplay Click(..) Handles btnDisplay.Click
Dim a, b as String
Dim x as Integera = "How now brown cow."
b = "brown"
x= Findlt(a, b)
txtBox Text = CStr(x)
End Sub
Function Findlt(ByVal 21 as String, ByVal 22 as String) As Integer
Dim x as integer
x= z1,IndexOf(z2)
End Function
How now"
AB
Bo
C.An error
D. None of the above
Ans: D
75. A Do While loop checks the While condition before executing the statements in the loop.
ATrue
B. False
Ans: A
76. A Do?Loop Until block is always executed at least once
A True
B. False
Ans: A
77. A counter variable is normally incremented or decremented by 1
A True
B. False
Ans: A.
78. The value of the control variable should not be altered within the body of a For?Next loop.
A True
B. False
Ans: B
79. 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
80. 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
Visual Basic Multiple Choice Questions and Answers1. The Visual Basic Code Editor will automatically detect certain types of errors as you are entering
code.
A True
B. False
Ans: A
2. Keywords are also referred to as reserved words.
A True
B. False
Ans: A
3. The divide-and-conquer-method of problem solving breaks a problem into large, general pieces
first, then refines each piece until the problem is manageable.
A True
B. False
‘Ans: A
4, Visual Basic responds to events using which of the following?
A.a code procedure
B. an event procedure
C.a form procedure
D.a property
Ans: B
5. When the user clicks a button, is triggered.
Aan event
B.a method
C.asetting
D.a property
Ans: A.
6. What property of controls tells the order they receive the focus when the tab key is pressed
during run time?
A. Focus order
B. Focus number
C. Tab index
D. Control order
Ans: C
7. Sizing Handles make it very easy to resize virtually any control when developing applications with
Visual Basic. When working in the Form Designer, how are these sizing handles displayed?
‘A. Arectangle with 4 arrows, one in each corner, around your control.
B. A3-D outline around your control
C.A rectangle with small squares around your control
D. None of the above.
Ans: C
8. The Properties window plays an important role in the development of Visual Basic applications. It
is mainly used
‘Ato change how objects look and feel
B, when opening programs stored on a hard drive.C. to allow the developer to graphically design program components.
D. to set program related options like Program Name, Program Location, etc.
Ans: A.
9. When creating a new application in Visual Basic, you are asked to supply a name for the program.
Ifyou do not specify a name, a default name is XXXXX XXXXX is this default name?
‘A. Wapplication followed by a number.
B, Application followed by a number.
C. WindowsApplication.
D. WindowsApplication followed by a number.
Ans: CB
10. Which of the properties in a control's list of properties is used to give the control a meaningful
name?
A Text
B. ContextMenu
C.ControlName
D. Name
Ans: D
11. Pseudocode is
‘A. data that have been encoded for security.
B, the incorrect results of a computer program.
C.a program that doesn’t work.
D. the obscure language computer personnel use when speaking.
E. a description of an algorithm similar to a computer language.
Ans: E
12. An algorithm is defined as:
‘A.a mathematical formula that solves a problem.
B. a tempo for classical music played in a coda.
C.a logical sequence of steps that solve a problem.
D. a tool that designs computer programs and draws the user interface.
Ans: C
13. A variable declared inside an event procedure is said to have local scope
A True
B. False
Ans: A
14. A variable declared outside of an event procedure is said to have class-level scope.
A True
B. False
Ans: A
15. Option Explicit requires you to declare every variable before its use
A True
B. False
Ans: A
16. The value returned by InputBox is a string,
A True
B. FalseAns: A
17. What is the correct statement when declaring and assigning the value of 100 to an integer
variable called numPeople
‘A. Dim numPeople =
B, Dim numPeople = int(100)
C.numPeople = 100
D. Dim numPeople As Integer = 100
Ans: D
18. Which of the following arithmetic operations has the highest level of precedence?
At
Ba/
C. 4 exponentiation
DB.)
Ans: C
19, What value will be assigned to the numeric variable x when the following statement is executed?
x=2+344
A.20
B14
c.92
D.234
Ans: B
20. Which of the following is a valid name for a variable?
‘A. Two_One
B.20ne
C. Two One
D.Two.One
Ans: A
21. Keywords in Visual Basic are words that
A. should be used when naming variables.
B. are used to name controls, such as TextBox1, Command2, etc
C.have special meaning and should not be used when naming variables.
D. are used as prefixes for control names (such as txt, btn, Ibl, and Ist)
Ans: C
22. To continue a long statement on another line, use:
‘A. an underscore character.
B, an ampersand character,
C.Ctel + Enter.
D. a space followed by an underscore character.
Ans: A
23. What is the proper syntax when using a message dialog box?
‘A. MessageBox.Show("Hi there”, “Hi")
B. MessageBox Show(Hi there, Hi)
C. MessageBox. Show “Hi There’, "Hi"
D. MessageBox Show Hi There, HiAns: A
24, What will be the output of the following statement? txtBox Text = FormatCurrency(1234.567)
A.$1234.567
B, 1,234.57
C.$123457
D. $1,234.57
Ans: D
25. The following lines of code are correct. If age >= 13 And < 20 Then txtOutput Text = "You are a
teenager.” End If
ATrue
B. False
Ans: B
26. Given that x = 7, y = 2, and z = 4, the following If block will display "TRUE". If (x > y) Or (y > 2)
Then txtBox Text = “TRUE” End If
ATrue
B. False
Ans: A
27. Asc(’A"
A606
B67
C8
Dec"
Ans: B
is 65. What is Asc("C")?
28. Asc("A’) is 65. What is displayed by txtBoxText = Chr(65) & "BC"?
AABC
B.ABC
C. 656667
D. Not enough information is available.
Ans: A
29, Which of the following expressions has as its value the words "Hello World? surrounded by
quotation marks?
A. "Hello World!
B. Chr(34) & “Hello World”
C. Chr(34) & Hello World & Chr(34)
D. Chr(34) & "Hello World” & Chr(34)
Ans: A
30. Which of the following is true?
A. "Cat" = “cat”
B. "Cat" < “cat”
C."Cat” > “cat”
D. Relational operators are only valid for numeric values.
Ans: B
31. Which of the following is a valid Visual Basic conditional statement?A2en<5
B.2= 5
A.xis equal to 7
B. xis equal to 5
C.xis equal to 5.001
D. all of the above
Ans: D
34, Which value for x would make the following condition true: Not (x >= 5)
Axis equal to 7
B.x is equal to.4
C. xis equal to 5.001
D. xis equal to 5.001
Ans: B
35. Which value for x would make the following condition true: (x >= 5) And (x <= 6)
A.xis equal to 7
B. xis equal to 5
C.xis equal to 5.001
Ans: B,C
36. Constructs in which an If block is contained inside another If block are called
‘A. multi-If blocks
B. nested If blocks
C. sequential If blocks
D. none of the above
Ans: B
37. One may use an If block within a Select Case block.
A True
B. False
Ans: A
38, One may use a Select Case block within an If block.
ATrue
B. False
Ans: A
39, Select Case choices are determined by the value of an expression called a selector.
ATrue
B. False
Ans: A40. Items in the value list must evaluate to a literal of the same type as the selector
A True
B. False
‘Ans: A
41. A single Case statement can contain multiple values.
A True
B. False
Ans: A
42, You can specify a range of values in a Case clause by using the To keyword
A True
B. False
Ans: A
43, A variable declared inside a Select Case block cannot be referred to by code outside of the
block.
A True
B. False
‘Ans: A
44, Suppose that the selector in a Select Case bloc
following is NOT a valid Case clause?
A. Case “Adams”
B. Case "739"
C. Case (myVarSubstring(0, 1)
D. Case myVar.Length
‘Ans: D
45, Different items appearing in the same value list of a Select Case block must be separated by a
the string variable myVar. Which of the
A. semi colon
B. comma
C.colon
D. pair of quotation marks
Ans: B
46, Which Case clause will be true whenever the value of the selector in a Select Case block is
between 1 and 5 or is 8?
A Case 1708
B,Case 1705,8
C.Case 1108, 5
D. Case 170 5:8
Ans: B
47. Which Case clause will be true whenever the value of the selector in a Select Case block is
greater than or equal to 7?
A. Case Is >7
B. Case Is = 8
C.Case ls
D. Case Is <= 8
Ans: C
48, What type of items are valid for use in the value list of a Case clause?A literals
B. variables
C. expressions
D. all of the above
Ans: D
49, What happens to a variable declared locally inside a Sub procedure after the procedure
terminates?
A. It maintains its value even after the End Sub statement executes.
B. It ceases to exist after the End Sub statement executes.
Cilt loses its value temporarily after the End Sub statement executes, but regains that value upon re-
entry to the Sub procedure.
D. Itis reset to its default value
Ans: B
50. Suppose a variable is passed by reference to a parameter of a Sub procedure, and the
parameter has its value changed inside the Sub procedure. What will the value of the variable be
after the Sub procedure has executed?
A. It will have the newly modified value from inside the Sub procedure.
B. Its value can?t be determined without more information,
C. It will retain the value it had before the call to the Sub procedure
D. None of the above.
Ans: A
51. Suppose a variable is passed by value to a parameter of a Sub procedure, and the parameter has
its value changed inside the Sub procedure. What will the value of the variable be after the Sub
procedure has executed?
A. It will have the newly modified value from inside the Sub procedure.
B. Its value can?t be determined without more information
C. It will retain the value it had before the call to the Sub procedure
D. None of the above.
Ans: C
52. The declaration statement for a class-level variable should be placed
A. inside an event procedure
B, inside a general procedure
C. anywhere in the program region, except inside a procedure
D. above the statement Public Class frmName
Ans: C
53. Variables declared inside a procedure are said to have
A local scope
B, procedure-level scope
C. class-level scope
D. none of the above
Ans: A
54, What will be the output of the following program when the button is clicked?
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim number As Double = 3DoubleAndSquare(number)
txtBox.Text = CStr(number)
End Sub
Sub DoubleAndSquare(ByRef myVar As Double)
myVar = myVar + myVar
myVar = myVar * myVar
AB
8.36
C6
D.o
Ans: B
55. Suppose the variable myName is declared in a Dim statement in two different Sub procedures.
Which statement is true?
‘A. The program will malfunction when it is executed.
B. When the value of myName is changed in one Sub procedure, it will also be changed in the other
Sub procedure.
C. Visual Basic’s smart editor will alert you that this is an error before the program is executed.
D. The two variables will be local to their respective Sub procedures.
Ans: D
56. Which of the following statements is guaranteed to pass the variable numVar by value to the
Sub procedure Tally?
A Tally(numVar)
B, Tally(ByVal numVar)
C. Tally((numVar))
D. Tally(ByVal numVar As Double)
‘Ans: D
57. The of a Sub procedure are vehicles for passing numbers and strings to the Sub
procedure.
A Call Statements
B. arguments
C. parameters
D. variables declared inside
Ans: C
58. Which of the following is NOT a reason for using procedures?
A. They break a complex problem down into smaller pieces
B, They make a program run faster.
C. They can be reused easily.
D. They make it possible for a team of people to work together on a single program.
Ans: B
59. 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 synonymous terms.
D. They are completely unrelated in a program.
Ans: A
60.Each individual variable in the list student(0), student(1), student(2) is known as a(n)A. subscript
B, dimension
C.element
D. type
Ans: C
62. The statement Const TAX_RATE As Doubleface=Calibri size=2> is not valid
A True
B. False
Ans: A
68. Function names should be suggestive of the role performed. The names also must conform to
the rules for naming variables.
A True
B. False
‘Ans: A
64. The input to a user-defined function can consist of one or more values.
A True
B. False
Ans: A
65. Both the input and output of a Function procedure can consist of several values.
A True
B. False
Ans: B
66. Suppose you want to write a procedure that takes three numbers, num1, num2, and num3; and
returns their sum, product, and average. It is best to use a Function procedure for this task.
ATrue
B. False
Ans: B
67. Although a function can return a value, it cannot directly display information in a text box.
A True
B. False
Ans: B
68. Function procedures can invoke other Function procedures.
A. True
B. False
Ans: A
69. A Function may return up to two values.
A True
B, False
Ans: B
70. The input to a user-defined function can consist of:
Aa single value
B. one or more values
C.no values
D. All of the aboveAns: D
71. Variables appearing in the header of a Function procedure are called
‘A.values of the function
B, parameters
C. coordinates
D. arguments
Ans: B
72. The arguments appearing in a Call statement must match the parameters in the appropriate Sub
or Function header in all but one of the following ways. Which one?
‘A. Number of arguments
B, Names of arguments
C. Data type of arguments
D. Order of arguments
Ans: B
73, What will be the output of the following program when the button is clicked?
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim word, result As String
word = “Benjamin’
Rotate(word)
Rotate(result & word)
result = Rotate(result)
txtBox Text = result
End Sub
Function Rotate(ByVal var As String) As String
Dim varlength As Integer
varlength = var.Length
Return varSubstring(1) & varSubstring(0, 1)
End Funetion
A. jaminBBenjaminen
B, BenjaminBenjamin
C.njaminBe
D. None of the above
Ans: A
74, What is displayed when the button is clicked?
Private Sub btnDisplay_Click(...) Handles btnDisplay Click
Dim a, b as String
Dim x as Integer
a = "How now brown cow.”
x = Findit(a, b)
txtBox.Text
End Sub
Function Findit(ByVal 21 as String, ByVal 22 as String) As Integer
Dim x as Integer
x = z1IndexOf(z2)
End Function
‘Str(x)“How now"
AB
B.O
C.An error
D. None of the above
Ans: D
75. 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
ATrue
B. False
Ans: A.
77. A counter variable is normally incremented or decremented by 1
A True
B. False
Ans: A
78. The value of the control variable should not be altered within the body of a For?Next loop.
A True
B. False
Ans: B
79, The body of a For...Next loop in Visual Basic will always be executed once no matter what the
initial and terminating values are.
ATrue
B. False
Ans: B
80. 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