Visual Basic MCQs

Visual Basic MCQs

Try to answer these 100+ Visual Basic MCQs and check your understanding of the Visual Basic subject.
Scroll down and let's begin!

1: If, Then, Else are examples of:

A.   variables

B.   events

C.   conditionals

D.   operators

2: Which of the following, when inputted into the command prompt, will successfully launch the Visual Basic script file_name.vbs?

A.   All of these are correct

B.   wscript file_name.vbs

C.   cscript file_name.vbs

D.   Pressing enter after you write: file_name.vbs

3: Visual Basic 6.0 has been replaced by:

A.   VB.NET

B.   Visual Studio

C.   Visual C++

D.   C++

4: The three types of Visual Basic operators are:

A.   arithmetic, relational, and logical

B.   plus, minus, multiply

C.   divide, multiply, plus

D.   add, divide, multiply

5: Visual Basic can do which of the following?

A.   Develop Windows applications

B.   Create executable files (EXE files)

C.   All are correct

D.   Create DLL files

E.   Create ActiveX controls

6: Visual Basic applications display a Windows style screen called a form.

A.   True

B.   False

7: When you save a project as an executable file, you are actually:

A.   deleting

B.   decompiling

C.   compiling

D.   coding

8: LoadPicture is a function of an Image control that can:

A.   format the border of the image

B.   change the color of the image

C.   delete an existing picture

D.   populate the picture with an image from a specified directory

9: A variable can be assigned a value.

A.   False

B.   True

10: Which character must be placed at the beginning of a line to indicate that it is a comment (not considered part of the code)?

A.   "

B.   #

C.   +

D.   -

E.   '

11: To declare a variable in Visual Basic, you must use the ___________ function:

A.   Dim

B.   Loop

C.   Declare

D.   Private Sub

12: The code to cancel out of a Loop event is:

A.   Clear

B.   Cancel

C.   Exit Do

D.   Delete Loop

13: What is the proper syntax for adding items to a listbox?

A.   listbox.setnewitem = item

B.   listbox.newitem.add(item)

C.   listbox.items.item(item).register

D.   listbox.items.add(item)

E.   listbox.itemmenu.add(item)

14: The default file type for a Visual Basic project is:

A.   .vbo

B.   .mvb

C.   .frm

D.   .vbp

15: How to declare a variable in VB?

A.   All of these

B.   Dim (Variable) AS (Datatype)

C.   Declare @(Variable) (Datatype)

D.   (Datatype) (Variable);

16: What keyword(s) end every procedure

A.   Stop

B.   End

C.   End Sub

D.   Stop Procedure

E.   Ending

17: Press _________ to run a program.

A.   F5

B.   F4

C.   F7

D.   F6

18: Which control can be data bound?

A.   Label

B.   Textbox

C.   Checkbox

D.   All of these

19: Visual Basic is an ____________ driven language.

A.   event

B.   assembly

C.   adjective

D.   asp

20: What keyword starts every procedure?

A.   For

B.   Begin

C.   Start

D.   Sub

E.   With

21: Visual Basic is derived from:

A.   C++

B.   BASIC

C.   Qbasic

D.   Assembly

22: Once you complete a program, you can compile it into a _________ file.

A.   .exe

B.   .vb

C.   .vbp

D.   .html

23: To create a function that returns a value you must use a:

A.   none of these

B.   sub

C.   procedure

D.   function

24: How do you enter in comments without having an output?

A.   */

B.   @

C.   '

D.   %

E.   %%

25: To show a form, use the ____________ command.

A.   visible

B.   appear

C.   display

D.   show

26: The programmer can enter, edit, and view the language of Visual Basic in the:

A.   document

B.   form explorer

C.   project explorer

D.   code window

27: The Enterprise Edition of Visual Basic is aimed at:

A.   C++

B.   network oriented clients

C.   file sharing

D.   decompiling

28: Integer is an example of a:

A.   variable

B.   data type

C.   number

D.   procedure

29: Visual Basic is considered a ___________ programming language.

A.   high level

B.   mid-level

C.   assembly level

D.   low level

30: The '&' symbol is the safest _________ operator to use in Visual Basic.

A.   Relational

B.   Boolean

C.   Arithmetic

D.   Concatenation

31: What is MAPI ?

A.   Messaging Application Programming Interfere

B.   Messaging Application Programming Interface

C.   None of the Above

D.   Messaging Administration Programming Interface

E.   Messaging Application Programming Interchange

32: Can you access and modify the Windows Registry by using VB Scripting?

A.   No

B.   Yes

C.   You can read but cannot write

33: How do you prevent the screen from flickering while running a macro?

A.   Application.ScreenUpdating = True

B.   Application.ScreenUpdating = False

C.   Application.Visible = True

D.   Application.DisplayAlerts = False

E.   Application.Visible = False

34: B=2 C=3 What does A=B=C output?

A.   6

B.   True

C.   False

D.   2

E.   3

35: What code will adjust the Zoom Level on a worksheet in Excel to 80%?

A.   ActiveWindow.Zoom = 80

B.   ActiveWindow.Zoom = -20

C.   ActiveWindow.Zoom.Adjust = 80

D.   Application.Zoom = 80

E.   Zoom = 80

36: What type of executable can VB6 not produce?

A.   Standard EXE

B.   Native DLL

C.   ActiveX EXE

D.   ActiveX Control

E.   ActiveX DLL

37: MDI is an IDE developed by Microsoft and stands for:

A.   Microsoft Data Interface

B.   Multiple Data Interface

C.   Multiple Document Interface

D.   Microsoft Document Interface

38: What keyword ends a For loop?

A.   Done

B.   Next

C.   End

D.   End Loop

E.   End For

39: Lower bound of arrays in VB 6 is

A.   1

B.   Determined by a compiler switch

C.   Default is 0. Can be set to 1 by "Option Base 1"

D.   0

E.   Default is 1. Can be set to 0 by "Option Base 0"

40: What is the difference between LockPessimistic and LockOptimistic ADO locking types.

A.   LockPessimistic Locks the row automatically. LockOptimistic Locks the only when initiated by code.

B.   There is no difference

C.   LockPessimistic Locks the row once after any edits occur. LockOptimistic Locks the row only when Update is called.

D.   LockPessimistic Locks the row only when Update is called. LockOptimistic Locks the row once after any edits occur.

41: Which of the following is a correct example of Windows API import declaration in VB6

A.   Public External Sub RtlMoveMemory Lib "Kernel32" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)

B.   Import Function "RtlModelMemory" Alias "CopyMemory" From "Kernel32" ([Pointer] lpvDest As Any, [Pointer] lpvSource As Any, ByVal cbCopy As Long)

C.   Import Function "RtlModelMemory" As "CopyMemory" From "Kernel32" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)

D.   DllImport Sub CopyMemory From "Kernel32" Original "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)

E.   Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)

42: What does Option Explicit refer to?

A.   All variables must be declared before use. Their type is not required.

B.   variables are defined automatically

C.   All variables with their types must be declared before use.

D.   Options for all built in controls is restricted.

43: What is the max size allowed in characters for Msgbox Prompt and Input Box?

A.   1024

B.   512

C.   2048

D.   256

E.   780

44: Dim x, y as integer. What is x and y data type?

A.   x as variant and y as integer

B.   Both are integers

C.   Wrong declaration

45: Which of the following is NOT the value of StartUpPosition property in Visual Basic 6?

A.   1 - CenterOwner

B.   0 - Manual

C.   3 - Windows Default

D.   2 - CenterScreen

E.   4 - Automatic

46: True or False? In Visual Basic 6, to enable automatic re-painting of MDI Form, we have to set AutoRedraw=True

A.   False

B.   True

47: To debug VB 6 applications with source code using a native debugger like Visual Studio, one must

A.   "Compile to Native Code" and enable "Create Symbolic Debug Info"

B.   select "Start with Full Compile" from "Run" menu

C.   add "NATIVE=1:DEBUG=1" to "Conditional Compilation Arguments"

D.   "Compile to P-Code" and enable "Create Symbolic Debug Info"

E.   Attach to VB6.exe from Visual Studio

48: In Visual Basic 6, How will you disable/hide the control box on a form?

A.   Using Windows API

B.   By Setting ControlBox Property to False or by using Windows API

C.   By Setting ControlBox Property to True

D.   By Setting ControlBox Property to False

E.   By Passing parameter FALSE to Forms SHOW Method

49: Which one of the following property pages is not provided by Visual Basic 6

A.   StandardColor

B.   StandardPicture

C.   StandardLayout

D.   StandardFont

E.   StandardDataFormat

50: How do you make a property default in VB 6?

A.   Decorate it with "<Default>" attribute

B.   You can not

C.   Rename your property to "Default"

D.   Using "Option Default Property 'propertyname'" in "General Declarations" section

E.   Set "Procedure ID" property of property to "(Default)" in "Procedure Attributes" dialog