Visual Basic 6 MCQs

Visual Basic 6 MCQs

Our experts have gathered these Visual Basic 6 MCQs through research, and we hope that you will be able to see how much knowledge base you have for the subject of Visual Basic 6 by answering these 100+ multiple-choice questions.
Get started now by scrolling down!

1:

An ADO dynamic property is:

A.   A property that changes value at runtime

B.   A value defined by the user

C.   A value defined by the operating system

D.   A property that dynamically resizes as needed to accommodate database parameters

E.   A property implemented by the OLE DB service provider

2:

Which of the following cannot be included in the Open method of the recordset?

A.   Cursor Type

B.   User Name

C.   Active Connection

D.   CursorLocation

E.   LockType

F.   Source

3:

What does the controls collection contain?

A.   A list of all controls on a form

B.   A list of all the controls used by your program

C.   A list of all text boxes on a form

D.   A list of all visible controls

E.   The names of all control arrays on the form

4:

You are creating a client application that calls ActiveX DLLs. Which of the following properties of the Err object provides the name of a component that sends an error back to the client application?

A.   Number

B.   Description

C.   CompName

D.   Component

E.   Source

F.   Text

G.   Desc

H.   None of the above

5:

Global Procedures and Global Variables are declared in:

A.   Form Modules

B.   Standard (Code) Modules

C.   Class Modules

D.   Resource files

E.   ActiveX Controls

F.   Data Environment

6:

Only Controls with a ________ property such as Picturebox, Toolbox, Statusbar etc. can be placed on an MDI form:

A.   Showtips

B.   Negotiate

C.   Align

D.   BorderStyle = 0

E.   Visible

F.   Locked

G.   Enabled

H.   Tag

7:

Whenever the current record is about to change, Visual Basic generates the ______ event:

A.   Validate

B.   UpdateRecords

C.   UpdateControls

D.   BeginTrans

E.   BeginMove

F.   Update

8:

Which of the following will provide the best aggregate performance for a query that is not executed repeatedly?

A.   Direct execution

B.   Stored procedures

C.   Prepared statements

D.   Data Environment

E.   ADO Data Control

9:

The _______ property enables Visual Basic to draw complete images in memory before displaying them on the Screen.

A.   AutoRedraw = True

B.   AutoRedraw = False

C.   Refresh

D.   PaintPicture

10:

Which event of an ActiveX control data provider runs every time a bound control extracts data through the provider?

A.   GetDataMember

B.   GetDataField

C.   GetDataProperty

D.   GetDataRow

E.   GetData

F.   GetFields

G.   GetRows

H.   RetrieveData

11:

Which event should you use to store property values into the PropertyBag?

A.   Terminate

B.   ReadProperties

C.   StoreProperties

D.   WriteProperties

E.   SaveProperties

F.   CommitProperties

12:

One can convert a Visual Basic Application into ActiveX Document using:

A.   Visual Database Manager

B.   Application Wizard

C.   ActiveX Document Migration Wizard

D.   Package and Deployment Wizard

13:

Which event should be used to resize an ActiveX control as the user modifies the size of the control implementation on a form?

A.   Resize

B.   Paint

C.   Repaint

D.   Initialize

E.   Change

F.   ReDimension

G.   Dimension

H.   Any of the above

14:

The ______ function can be used to run any .com, .exe, .bat or .pif file from a Visual Basic program.

A.   Shell

B.   Substr

C.   SetAttr

D.   CStr

E.   Exec

F.   Perform

G.   Do

H.   None of the above

15:

Consider the following program code:

(i) Dim FileName as String

Open FileName For Input As #FreeFile

(ii) Dim FileName as String

FileNum = FreeFile

Open FileName For Input As #FileNum

A.   Both (i) and (ii) are correct

B.   Only (i) is correct

C.   Only (ii) is correct

D.   (i) contains a logical error

E.   (ii) contains an error

F.   Both (i) and (ii) contain errors

16:

Which function or method will you use to get a count of the maximum index limit of an array?

A.   UBound function

B.   LBound function

C.   Substr function

D.   Bound Control method

E.   Limit method

F.   UpperLimit method

G.   Upper method

H.   MaxArray function

17:

Which property of the ProgressBar determines how much of the bar is filled?

A.   Min

B.   Max

C.   Value

D.   CurrentVal

E.   FillValue

F.   Fill

G.   BarComplete

18:

In order to change the mouse pointer shape from glass to watch-glass, the property to be used is:

A.   MousePointer

B.   Picture

C.   Menu

D.   PointerStyle

E.   Pointer

F.   Cursor

G.   CursorStyle

H.   CursorShape

19:

The caption and the name properties of the command button:

A.   Are one and the same

B.   Can be different at times

C.   Are actually not properties

20:

In order to access a file in Non-textual format, you have to open file in:

A.   Ascii Format

B.   Binary Format

C.   Input Mode

D.   Output mode

E.   Append mode

F.   Read Mode

21:

What is the extension of the Visual Basic project file that stores the design of a user control.

A.   .ctx

B.   .ctl

C.   .ctr

D.   .ocx

E.   .vbp

F.   .dll

G.   .ucl

H.   .utl

22:

After a Dynaset type recordset has been created and opened, further searching is possible using the:

A.   LookUp method

B.   Seek method

C.   Locate method

D.   FindNext method

E.   Search method

23:

Which method of the Recordset object should you use to navigate multiple recordsets returned by a stored procedure?

A.   NewRecordset

B.   NavigateRecordset

C.   OpenNextRecordset

D.   NextRecordset

E.   SkipRecordset

F.   PreviousRecordset

G.   JumpRecordset

H.   GoTORecordset

24:

In order to provide a transparent background to the Form, you must change the _________ property to _______.

A.   BackStyle, Opaque

B.   BackColor, White

C.   BackStyle, Transparent

D.   BackColor, Parent Window's Color

E.   ZOrder, 0

F.   BackColor, Transparent

25:

Which event procedure is called only if AutoRedraw property is set to false:

A.   Form_GotFocus

B.   Form_Paint

C.   Form_Activate

26:

Which events enable you to determine which key was pressed by the user?

A.   Click and KeyPress

B.   Click, KeyUp and KeyDown

C.   KeyUp and KeyDown

D.   KeyPress, KeyUp and KeyDown

E.   Click, KeyPress, KeyUp and KeyDown

27:

The Kill command in Visual Basic is used for:

A.   Stopping the current process

B.   Deleting files

C.   Terminating the application

D.   Stopping the current thread

E.   Debugging the application

F.   Error handling

G.   None of the above

28:

Which method would you use to get a free or unused File identifier while opening any file:

A.   FreeFile

B.   GetFileNum

C.   GetFile

D.   GetBytes

E.   NextFile

F.   File

G.   GetNextFile

H.   None of the above

29:

 What data type is the HelpContextID?

A.   String

B.   Integer

C.   Single

D.   Double

E.   Long

F.   Char

G.   Float

30:

Which event is fired when a text box loses focus?

A.   LostFocus

B.   FocusLost

C.   RemoveFocus

D.   FocusAway

E.   NoFocus

F.   Leavefocus

31:

Message Boxes can hold a maximum of _______ characters.

A.   256

B.   512

C.   1024

D.   2046

E.   4092

F.   5000

G.   10000

H.   No limit

32:

Which of the following is the only valid Resume statement in an error handler?

A.   Resume prior

B.   Resume previous

C.   Resume later

D.   Resume next

E.   Resume before

F.   Resume to

G.   Resume statement

H.   Resume application

33:

To store pictures in an array, Visual Basic provides the _____ control.

A.   PictureClip

B.   ImageList

C.   PictureBox

D.   Image Box

E.   Timer Control

F.   ListView

G.   Common Dialog

H.   DataGrid

34:

Which is the only event of the timer control?

A.   Timer

B.   TimeElapsed

C.   TimeOver

D.   Reset

E.   TimeOut

F.   Restart

G.   Freeze

H.   Stop

35:

Consider the following subprogram:

        Sub ChangeText(ByVal X as String,Y as String)

          Y = X

        End Sub

If you are calling it using the following code:

            Call ChangeText(Form1.Caption,Y$)

A.   The Caption of Form1 will change to the value contained in Y$

B.   The Caption of Form1 will not change

C.   The Caption changes at random intervals after the function call

D.   The code is incorrect

36:

If one needs to use an ampersand(&) in a Label but does not want it to be an Access Key, the _______ property of the label must be set to False.

A.   Caption

B.   ClipControls

C.   UseMnemonic

D.   LinkMode

E.   Locked

F.   Label

G.   ZOrder

H.   Visible

37:

What is the sequence of events when a form is unloaded?

A.   QueryUnload, Unload and Terminate

B.   QueryUnload, Terminate and Unload

C.   QueryUnload and Unload

D.   Unload only

E.   Terminate, QueryUnload and Unload

F.   Terminate, Unload and QueryUnload

G.   Unload, QueryUnload and Terminate

H.   Unload, Terminate and QueryUnload

38:

What is the default value for the scalemode property of the form?

A.   Twip

B.   Point

C.   Pixel

D.   Character

E.   Centimeter

F.   Inches

G.   Millimeters

39:

Which property of the Err object returns the numeric value associated with the most recent runtime error?

A.   Description

B.   No

C.   Number

D.   Source

E.   Errorcode

F.   Num

G.   Code

40:

The event Lost_Focus of one object results in _____ of the other object:

A.   Got_Focus

B.   Lost_Focus

C.   Mouse_click

D.   Refresh

E.   Validate

F.   Load

G.   Activate

H.   Initialize

41:

Which of the following ADO recordset types provides the greatest degree of concurrency?

A.   Static

B.   Forward-only

C.   Dynamic

D.   Keyset

E.   Read only

F.   Keyset and Dynamic

42:

The ______ property is used to show Tool Tips or Help Balloons when the mouse rests on the object:

A.   ToolTipText

B.   Tag

C.   Dragmode

D.   ShowTips

E.   Help

F.   Tip

G.   ShowHelp

H.   Tab

43:

Which of the following can be shown to the user using the Common Dialog control in VB?

A.   Common messages passed to Windows

B.   Open dialog box

C.   Windows explorer

D.   Input box

E.   Message box

F.   Error messages

G.   Help

H.   None of the above

44:

Which property of the form changes the form's title?

A.   Name

B.   Heading

C.   Caption

D.   Text

E.   Title

45:

In order to enable the DBGridControl or the MSFlexGrid Control to display the contents of a table or query, you need to set only the ______ property:

A.   DataSource

B.   Connection

C.   RecordSource

D.   TableType

E.   RecordType

F.   DataType

46:

The _______ property changes the tab order at runtime:

A.   Tab stop

B.   Tab key

C.   Tab order

D.   Tab index

47:

Which of the following tools can be used to change the value of a variable or property during break mode of an application?

A.   Watch window

B.   Immediate window

C.   Callstack

D.   Locals window

E.   Debug object

48:

You want the code of the close command button to execute upon pressing the ESC key, even though the focus may be on another control in the form. Which property of the command button would you set to true?

A.   Cancel

B.   Escape

C.   Exit

D.   Focus

E.   Default

F.   Losefocus

G.   ExecEvent

H.   FireEvent

49:

Which collection of an ActiveX control enumerates all of the properties that can be bound to a data source?

A.   DataFields

B.   DataMembers

C.   DataBindings

D.   DataProperties

E.   DataBase

F.   DataColumns

50:

Which of the following situations would not cause the Initialize event of an ActiveX control to occur?

A.   When a control is placed on a form at design time

B.   When a form designer containing a control is closed

C.   When a form is run

D.   When a compiled application containing a control executes

E.   When an application terminates and re-enters design-time for the host application