Olete.in
Articles
Mock Tests
🧪 VBScript MCQ Quiz Hub
VBScript Mcq Question Set 2
Choose a topic to test your knowledge and improve your VBScript skills
1. A single Case statement can contain multiple values.
True
False
all of the above
None of the mentioned
2. You can specify a range of values in a Case clause by using the To keyword.
True
False
all of the above
None of the mentioned
3. A variable declared inside a Select Case block cannot be referred to by code outside of the block.
True
False
all of the above
None of the mentioned
4. Suppose that the selector in a Select Case block is the string variable myVar. Which of the following is NOT a valid Case clause?
Case “Adams”
Case “739”
Case (myVar.Substring(0, 1)
Case myVar.Length
5. Different items appearing in the same value list of a Select Case block must be separated by a ______
semi colon
comma
colon
pair of quotation marks
6. 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?
Case 1 To 8
Case 1 To 5, 8
Case 1 To 8, 5
Case 1 To 5; 8
7. Which Case clause will be true whenever the value of the selector in a Select Case block is greater than or equal to 7?
Case Is >7
Case Is = 8
Case Is >= 7
Case Is <= 8
8. What type of items are valid for use in the value list of a Case clause?
literals
variables
expressions
All of the above
9. What happens to a variable declared locally inside a Sub procedure after the procedure terminates?
It maintains its value even after the End Sub statement executes.
It ceases to exist after the End Sub statement executes.
It loses its value temporarily after the End Sub statement executes, but regains that value upon re-entry to the Sub procedure.
It is reset to its default value.
10. 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?
It will have the newly modified value from inside the Sub procedure.
Its value can?t be determined without more information.
It will retain the value it had before the call to the Sub procedure
None of the above.
11. : 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?
It will have the newly modified value from inside the Sub procedure.
Its value can?t be determined without more information
It will retain the value it had before the call to the Sub procedure
None of the above.
12. The declaration statement for a class-level variable should be placed _____
inside an event procedure
inside a general procedure
anywhere in the program region, except inside a procedure
above the statement Public Class frmName
13. Variables declared inside a procedure are said to have _____
local scope
procedure-level scope
class-level scope
none of the above
14. 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
3
36
6
0
15. Suppose the variable myName is declared in a Dim statement in two different Sub procedures. Which statement is true?
The program will malfunction when it is executed.
When the value of myName is changed in one Sub procedure, it will also be changed in the other Sub procedure.
Visual Basic’s smart editor will alert you that this is an error before the program is executed.
The two variables will be local to their respective Sub procedures.
16. Which of the following statements is guaranteed to pass the variable numVar by value to the Sub procedure Tally?
Tally(numVar)
Tally(ByVal numVar)
Tally((numVar))
Tally(ByVal numVar As Double)
17. The _________ of a Sub procedure are vehicles for passing numbers and strings to the Sub procedure.
Call Statements
arguments
parameters
variables declared inside
18. Which of the following is NOT a reason for using procedures?
They break a complex problem down into smaller pieces.
They make a program run faster.
They can be reused easily.
They make it possible for a team of people to work together on a single program.
19. Which one of the following is true about arguments and parameters?
Arguments appear in Call statements; parameters appear in Sub statements.
Parameters appear in Call statements; arguments appear in Sub statements.
They are synonymous terms.
They are completely unrelated in a program.
20. Each individual variable in the list student(0), student(1), student(2) is known as a(n)
subscript
dimension
element
Type
21. The statement Const TAX_RATE As Doubleface=Calibri size=2> is not valid.
True
False
all of the above
None of the mentioned
22. Function names should be suggestive of the role performed. The names also must conform to the rules for naming variables.
True
False
all of the above
None of the mentioned
23. The input to a user-defined function can consist of one or more values.
True
False
all of the above
None of the mentioned
24. Both the input and output of a Function procedure can consist of several values.
True
False
all of the above
None of the mentioned
25. 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.
True
False
all of the above
None of the mentioned
26. Although a function can return a value, it cannot directly display information in a text box.
True
False
all of the above
None of the mentioned
27. Function procedures can invoke other Function procedures.
True
False
all of the above
None of the mentioned
28. A Function may return up to two values.
True
False
all of the above
None of the mentioned
29. The input to a user-defined function can consist of:
a single value
one or more values
no values
All of the above
30. Variables appearing in the header of a Function procedure are called ____
values of the function
parameters
coordinates
arguments
31. 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?
Number of arguments
Names of arguments
Data type of arguments
Order of arguments
32. 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
jaminBBenjaminen
BenjaminBenjamin
njaminBe
None of the above.
33. 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.” b = “brown” x = FindIt(a, b) txtBox.Text = CStr(x) End Sub Function FindIt(ByVal z1 as String, ByVal z2 as String) As Integer Dim x as Integer x = z1.IndexOf(z2) End Function “How now”
8
0
An error
None of the above
34. A Do While loop checks the While condition before executing the statements in the loop.
True
False
all of the above
None of the mentioned
35. A Do?Loop Until block is always executed at least once
True
False
all of the above
None of the mentioned
36. A counter variable is normally incremented or decremented by 1.
True
False
all of the above
None of the mentioned
37. The value of the control variable should not be altered within the body of a For?Next loop.
True
False
all of the above
None of the mentioned
38. The body of a For…Next loop in Visual Basic will always be executed once no matter what the initial and terminating values are.
True
False
all of the above
None of the mentioned
39. 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?
True
False
all of the above
None of the mentioned
Submit