Contents

Which method is used to display a message box with a message and an OK button in Visual Basic?
a) ShowMessage()              
b) MsgBox()
c) DisplayAlert()  
d) MessageBox ()

b

Explanation: The "MsgBox()" method is used to display a message box with a message and an OK button in Visual Basic.


What is the default extension of a Visual Basic source code file?
a) .vba                                  
b) .vb
c) .vs                                      
d). vbasic

b

Explanation: The default extension of a Visual Basic source code file is ".vb".


Which keyword is used to dynamically allocate memory for an array in Visual Basic?
a) Dim                                   
b) Alloc
c) New                                   
d) Array

c

Explanation: The "New" keyword is used to dynamically allocate memory for an array in Visual Basic during runtime.


What is the purpose of the "ByVal" keyword when passing arguments to a subroutine or function in Visual Basic?
a) It specifies that the argument is passed by reference.            
b) It indicates that the argument is optional.
c) It indicates that the argument is passed by value.
d) It is used to declare a variable.

c

Explanation: The "ByVal" keyword in Visual Basic indicates that the argument is passed by value, passing a copy of the argument's value to the subroutine or function.


Which control in Visual Basic is used to display images on a form?
a) PictureControl
b) ImageView
c) ImageBox                       
d) PictureBox

d

Explanation: The "PictureBox" control in Visual Basic is used to display images on a form, supporting the dynamic loading and display of various image formats.


What is the purpose of the "Inherits" keyword in Visual Basic?
a) It is used to create a new instance of a class.
b) It specifies the access level of a member in a class.
c) It indicates that a class is derived from another class.        
d) It is used to handle exceptions in the application.

c

Explanation: The "Inherits" keyword in Visual Basic indicates that a class is derived from another class, enabling inheritance and the extension of properties and behaviors.