Which event is triggered when a user clicks on a button in a Visual Basic form?
a) Button_Click
b) Mouse_Click
c) Click_Event
d) Button_Click_Event
Explanation: The "Button_Click" event is triggered when a user clicks on a button in a Visual Basic form, allowing developers to define actions or operations to be performed in response to the button click.
How can you add comments in Visual Basic code?
a) // This is a comment
b) /* This is a comment */
c) ' This is a comment
d) <! -- This is a comment -->
Explanation: In Visual Basic, comments are added using the single quote ('), which allows developers to insert explanatory notes or remarks within the code without affecting the program's functionality.
What is the default scope of a variable declared within a Visual Basic module?
a) Public
b) Private
c) Protected
d) Friend
Explanation: In Visual Basic, when a variable is declared within a module without specifying an access modifier, its default scope is "Private," meaning it is accessible only within that module.
Which statement is used to exit a loop prematurely in Visual Basic?
a) exit
b) break
c) continue
d) Exit For/While
Explanation: In Visual Basic, the "Exit For" or "Exit While" statement is used to exit a loop prematurely, allowing the program to proceed to the next statement outside the loop.
Which event is triggered when a Visual Basic form is first loaded?
a) Form_Load
b) Form_Start
c) Form_Initialize
d) Form_Open
Explanation: The "Form_Load" event is triggered when a Visual Basic form is first loaded, allowing developers to perform initialization tasks, and set default values for controls before the form is displayed to the user.
What is the extension used for a Visual Basic class file?
a) . cls
b) . vbclass
c) . vbc
d) .class
Explanation: Visual Basic class files commonly use the ".cls" file extension to represent a class module containing the code and definition of a class.