Contents

In Visual Basic, how do you display a message box with Yes and No buttons and get the user's response?
a) MsgBox ("Question", vbYesNo)                                                               
b) MessageBox.Show("Question", MessageBoxButtons.YesNo)
c) MessageBox.Show("Question", MessageBoxButtons.YesNoCancel)  
d) MsgBox ("Question", vbYesNoCancel)

b

Explanation: The MessageBox.Show() method displays a message box with Yes and No buttons.


Which control in Visual Basic is used to display a list of items in a scrollable box?
a) ScrollBox                         
b) ListBox
c) ListView                           
d) ScrollList

b

Explanation: The ListBox control in Visual Basic is used to display a list of items in a scrollable box.


What is the purpose of the "Mod" operator in Visual Basic?
a) It performs division of two numbers and returns the quotient.             
b) It calculates the remainder after dividing two numbers.
c) It checks if a number is even or odd.
d) It compares two numbers and returns true if they are =.

b

Explanation: The Mod operator in Visual Basic calculates the remainder after dividing the two numbers.


How do you access the individual characters of a string in Visual Basic?
a) By using the CharAt() method    
b) By treating the string as an array and accessing elements by index
c) By using the Substring () function
d) By converting the string to an array of characters

b

Explanation: Individual characters of a string in Visual Basic can be accessed by treating the string as an array and accessing elements by index.


In Visual Basic, what is the purpose of the "OrElse" operator?
a) It performs a logical AND operation on two Boolean expressions.     
b) It performs a logical OR operation on two Boolean expressions.
c) It checks if two variables reference the same object in memory.         
d) It is used to concatenate strings.

b

Explanation: The OrElse operator in Visual Basic performs a logical OR operation on two Boolean expressions.


Which control in Visual Basic is used to display a calendar-like control for selecting dates?
a) DateControl    
b) CalendarView
c) DatePicker                       
d) MonthCalendar

d

Explanation: The MonthCalendar control in Visual Basic is used to display a calendar-like control for selecting dates.