Home
MCQS
VB.Net MCQ Quiz Hub
VB.Net Mcq Question Set 9
Choose a topic to test your knowledge and improve your VB.Net skills
1. If the padCharacter is omitted from the syntax of the padLeft or PadRight, the default is ______
Space
*
/
?
2. The _______ method pads the string on left, that is, it inserts the padded characters at the beginning of string.
PadLeft
PadRight
PadFront
PadBegin
3. To determine whether a string has specific sequence of characters, use _________
Contains method
Specific method
Sequence method
Check method
4. The ________ argument in syntax of Contains method represents the sequence of arguments you are searching.
subString
SearchString
String
Seq
5. The Contains Method returns ______________ value.
Integer
Void
Boolean
Strings
6. The Indexof method returns _________ value.
Integer
Boolean
Void
String
7. What output will be returned if the following Visual Basic code is executed? strCityState = "Nashville, TN" blnIsContained = strCityState.Contains("TN")
True
False
11
12
8. What output will be returned if the following Visual Basic code is executed? strCityState = "Nashville, TN" intCharIndex = strCityState.IndexOf("TN")
True
False
11
12
9. What output will be returned if the following Visual Basic code is executed? strCityState = "Nashville, TN" intCharIndex = strCityState.IndexOf("Tn")
True
False
11
-1
10. ______ method is used for accessing any number of characters in a String.
Substring
Contains
IndexOf
CharAt
11. _______ argument in the Substring syntax specifies number of characters you want to access.
numCharToAccess
CharAccess
numAccess
ToAccess
12. The _______ operator allows you to use pattern matching characters to determine whether one String is equal to another String.
Like
Pattern
Match
StringMatch
13. The ______ in a pattern represents one character only.
?
*
#
**
14. The ______ in a pattern represents zero or more characters.
?
*
#
**
15. The _______ in a pattern represents a single digit.
?
*
#
**
16. The Like operator returns _______________ value.
Integer
Boolean
String
Float
17. Which of the following expressions evaluates to True when the strPart variable contains the string “123X45”?
strPart Like “999[A-Z]99”
strPart Like “######”
strPart Like “###[A-Z]##”
strPart Like “##??##”
18. In the following code, the while loop will execute if strId would have been ______ Do While strId Like "###*"
123ABC
Fgh2
Xzya
Xyza
19. In the following code, the body of If will execute if txtState.Text contains? If txtState.Text Like "K*" Then
K
K123
K4
4K
20. In the following code, the body of If will execute if strFirst contains? If strFirst.ToUpper Like "B?LL" Then
Bill
Lii
LL1
123
21. In the following code, the body of If will execute if strFirst contains? If strFirst.ToUpper Like "T[OI]M" Then
TIM
TM
IM
OM
22. You use _______ to include one or more menus on a Windows form.
Menu control
Menu strip control
Form control
Menu properties
23. The list of items displayed by menu title are known as _______
Items
Menu list
Menu items
Lists
24. Each of the options on the submenu are referred to as ________
Menu items
Submenu items
Submenu lists
Options
25. ________ is used to visually group together related items on a menu or submenu.
Separator line
Separator bar
Line
Bar
26. Each menu element is considered as _______
Class
Object
Instance
Member
27. The programmer use _______ property to refer to menu element in code.
Text
Code
Name
Element
28. The ____________ indicates the purpose of the menu element.
Caption
Text
Name
Properties
29. ______ capitalization is used for menu item captions.
Book title
Sentence
Line
Title
30. Each menu title should have an unique __________
Access key
Property
Caption
Lists
31. Each menu item should have an _______ that is unique within its menu.
Access key
Property
Caption
Lists
32. A simple variable, also called as a ________ variable, is one that is unrelated to any other variable in memory.
Changing
Dynamic
Static
Scalar
33. When you group together related variables, the group is referred to as _________
Array
List
Relation
Variable group
34. Using array in a program is efficient because ________
It shortens the program.
The program compiles faster
Number of variables are reduced.
Data is accessed faster
35. Data in an array can be distinguished using _______ number.
Reference
Subscript
Array
ID
36. If array is of String type all values are _________ by default.
null
Null
0
Nothing
37. The act of initializing array is also called as _______
Populating an array
Assigning array
Initializing
Factoring and array
38. What is the value of len in the following Visual Basic code? Dim strCities() As String = {"Bombay", "Chennai", "Ladakh", "Tamil Nadu"} Dim len As Integer len = strCities.Length()
4
0
3
5
39. What is wrong with the following statement? Dim strCities As String = {"Bombay", "Chennai", "Ladakh", "Tamil Nadu"}
static keyword missing
array elements should be initialized using single quotes
array elements should be in square brackets
array name should be strCities()
40. What is the result of the following statements? Dim strCities() As String = {"Bombay", "Chennai", "Ladakh", "Tamil Nadu"} strCities(2)=”Kolkata”
Compilation Error
Runtime Error
strCity array is {“Bombay”, “Ladakh”, “Kolkata”,”Tamil Nadu”}
strCity array is {“Bombay”, “Chennai”,”Kolkata”, “Tamil Nadu”}
41. Which of the following declares a five-element one-dimensional array?
Dim dblAmounts(4) As Double
Dim dblAmounts(5) As Double
Dim dblAmounts(4) As Double = {3.55, 6.70, 8, 4, 2.34}
Dim dblAmounts() As Double={3.55, 6.70, 8, 4, 2.34,1.45}
42. The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. The statement intSales(3) = intSales(3) + 10 will .
replace the 500 amount with 10
replace the 500 amount with 510
replace the 900 amount with 10
replace the 900 amount with 910
43. The strItems array is declared as follows: Dim strItems(20) As String. The intSub variable keeps track of the array subscripts and is initialized to 0. Which of the following Do clauses will process the loop instructions for each element in the array?
Do While intSub > 20
Do While intSub < 20
Do While intSub >= 20
Do While intSub <= 20
44. The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. Which of the following If clauses determines whether the intSub variable contains a valid subscript for the array?
If intSales(intSub) >= 0 AndAlso intSales(intSub) < 4 Then
If intSales(intSub) >= 0 AndAlso intSales(intSub) <= 4 Then
If intSub >= 0 AndAlso intSub < 4 Then
If intSub >= 0 AndAlso intSub <= 4 Then
45. The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}. Which of the following blocks of code correctly calculates the average value stored in the array? The intTotal, intSub, and dblAvg variables contain the number 0 before the loops are processed.
Do While intSub < 4 intNums(intSub) = intTotal + intTotal intSub = intSub + 1 Loop dblAvg = intTotal / intSub
Do While intSub < 4 intTotal = intTotal + intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / intSub
Do While intSub < 4 intTotal = intTotal + intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / intSub − 1
Do While intSub < 4 intTotal = intTotal + intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / (intSub − 1)
46. The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. Which of the following loops will correctly add 100 to each array element? The intSub variable contains the number 0 before the loops are processed.
Do While intSub <= 4 intSub = intSub + 100 Loop
Do While intSub <= 4 intSales = intSales + 100 Loop
Do While intSub < 5 intSales(intSub) =intSales(intSub) + 100 Loop
Do While intSub <6 intSales(intSub) = intSales(intSub) + 100 Loop
47. What will be assigned to the dblAvg variable after the code has been executed? Do While intSub < 4 intNums(intSub) = intTotal + intTotal intSub = intSub + 1 Loop dblAvg = intTotal / intSub Dim intNums() As Integer = {10, 5, 7, 2}. The intTotal, intSub, and dblAvg variables contain the number 0 before the loops are processed.
0
5
6
8
48. What will be assigned to the dblAvg variable after the code has been executed? Do While intSub < 4 intTotal = intTotal + intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / intSub Dim intNums() As Integer = {10, 5, 7, 2}. The intTotal, intSub, and dblAvg variables contain the number 0 before the loops are processed.
0
5
6
8
49. What will be assigned to the dblAvg variable after the code has been executed? Do While intSub < 4 intTotal = intTotal + intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / intSub – 1 Dim intNums() As Integer = {10, 5, 7, 2}. The intTotal, intSub, and dblAvg variables contain the number 0 before the loops are processed.
0
5
6
8
50. What will be assigned to the dblAvg variable after the code has been executed? Do While intSub < 4 intTotal = intTotal + intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / (intSub − 1) Dim intNums() As Integer = {10, 5, 7, 2}. The intTotal, intSub, and dblAvg variables contain the number 0 before the loops are processed.
0
5
6
8
Submit