MCQs > IT & Programming > Visual Basic 6 MCQs > Basic Visual Basic 6 MCQs

Basic Visual Basic 6 MCQ

1.

Labels do not respond to _____ and ______ events.

Answer

Correct Answer: Got_Focus , Lost_Focus

Note: This Question is unanswered, help us to find answer for this one

2.

You try to initialize a new Object variable with the following line but receive an error. What could be the possible cause? Set MyVar = New Classname

Answer

Correct Answer: MyVar has not been declared

Note: This Question is unanswered, help us to find answer for this one

3.

Which line of the following code contains an error?

1 public Sub Command1_Click()

2 Dim str As String

str = "Hello World"

3 i = val(str)

4 length = len(str)

5 Msgbox "No Of Characters in " & str & " = " & CStr(length)

6 End Sub

Answer

Correct Answer: Error on line 3

Note: This Question is unanswered, help us to find answer for this one

4.

In Visual Basic, which method can you use to send key strokes to other Window applications?

 

Answer

Correct Answer: SendKeys

Note: This Question is unanswered, help us to find answer for this one

5.

Which property of the ListView control determines which field a sort is based on?

Answer

Correct Answer: Sorted

Note: This Question is unanswered, help us to find answer for this one

6.

How do you make a control gray and inaccessible in VB?

Answer

Correct Answer: Set enabled to false

Note: This Question is unanswered, help us to find answer for this one

7.

Which of the following is the valid stepping option? 

Answer

Correct Answer: Step Over

Note: This Question is unanswered, help us to find answer for this one

8.

Which of the following is not an element of the ADO model? 

Answer

Correct Answer: Error

Note: This Question is unanswered, help us to find answer for this one

9.

The vbCritical symbol displays:

Answer

Correct Answer: A critical message icon

Note: This Question is unanswered, help us to find answer for this one

10.

To destroy an object and free the memory space occupied by it, the keyword used is:

Answer

Correct Answer: Kill

Note: This Question is unanswered, help us to find answer for this one

11.

To save a file in a RichTextBox Control and a picture in a Picture Box Control, you will use the _________ and __________ statements, respectively:

Answer

Correct Answer: RichText1.SaveFile, Picture1.SavePicture

Note: This Question is unanswered, help us to find answer for this one

12.

Which of the following compiled elements does not run in process?

Answer

Correct Answer: ActiveX EXE

Note: This Question is unanswered, help us to find answer for this one

13.

The _____ of the Visual Basic IDE displays a list of all the files of an application:

Answer

Correct Answer: Project window

Note: This Question is unanswered, help us to find answer for this one

14.

Which object is used for error handling? 

Answer

Correct Answer: Err

Note: This Question is unanswered, help us to find answer for this one

15.

To deactivate the Form UnLoad event, you make the following change in the function definiton:

            Private Sub Query_Unload(Cancel as Integer,UnloadMode as Integer)

To prevent the Form from closing, you will set the:

Answer

Correct Answer: Cancel parameter to 1

Note: This Question is unanswered, help us to find answer for this one

16.

How many root nodes can a TreeView control have?

Answer

Correct Answer: 1

Note: This Question is unanswered, help us to find answer for this one

17.

Which form event would you use to activate a pop-up menu when the user clicks the right mouse button?

Answer

Correct Answer: MouseUp

Note: This Question is unanswered, help us to find answer for this one

18.

Which of the following locking types will lock a recordset only during an Update process and not immediately when the data modifications are requested?

Answer

Correct Answer: Optimistic

Note: This Question is unanswered, help us to find answer for this one

19.

Which of the following statements forces inline error handling?

Answer

Correct Answer: On Error Resume Next

Note: This Question is unanswered, help us to find answer for this one

20.

Which parameter of the Execute method of the Connection object returns the number of records that the operation affected?

Answer

Correct Answer: RecordsAffected

Note: This Question is unanswered, help us to find answer for this one

21.

Which of the following procedure types will execute when you assign a value to a property of an object?

Answer

Correct Answer: Property Let

Note: This Question is unanswered, help us to find answer for this one

22.

You are creating an ActiveX component that raises user-defined errors. What is the valid range of error numbers that you can use for user-defined errors?

Answer

Correct Answer: 513-65535

Note: This Question is unanswered, help us to find answer for this one

23.

Which of the following is the only drag related event?

Answer

Correct Answer: DragDrop

Note: This Question is unanswered, help us to find answer for this one

24.

The _______ method resets the contents of bound controls to their original values when the user clicks on the cancel button.

Answer

Correct Answer: UpdateControls

Note: This Question is unanswered, help us to find answer for this one

25.

Which three methods does the collection object support?

Answer

Correct Answer: Add, Remove, Count

Note: This Question is unanswered, help us to find answer for this one

26.

What is the purpose of the Class Builder add-in in Visual Basic:

Answer

Correct Answer: To create new classes and define their properties, methods & events

Note: This Question is unanswered, help us to find answer for this one

27.

How do you create a read only property in a form?

Answer

Correct Answer: Create only a Property Get procedure

Note: This Question is unanswered, help us to find answer for this one

28.

If the CancelError Property of the CommonDialog Box is set to true then which of the following statement is true:

Answer

Correct Answer: A runtime error can result if the user clicks the cancel button

Note: This Question is unanswered, help us to find answer for this one

29.

You want to display the code and the description of an error. What would be the correct syntax?

Answer

Correct Answer: Msgbox err.number & err.description

Note: This Question is unanswered, help us to find answer for this one

30.

The _______ method loads the form named 'Form1' in to memory and also displays it.

Answer

Correct Answer: Form1.Show

Note: This Question is unanswered, help us to find answer for this one

31.

A project group is a Project which:

Answer

Correct Answer: Consists of several Projects

Note: This Question is unanswered, help us to find answer for this one

32.

Which parameter of the WriteProperty method can be omitted but should be included to increase the efficiency of the control?

Answer

Correct Answer: PropBag

Note: This Question is unanswered, help us to find answer for this one

33.

A prepared statement is:

Answer

Correct Answer: Compiled query cached on the server

Note: This Question is unanswered, help us to find answer for this one

34.

You are creating an ActiveX component that raises user-defined errors. Which of the following statements correctly raises an error to the client with error number 20000?

Answer

Correct Answer: Err.Raise vbObjectError + 20000

Note: This Question is unanswered, help us to find answer for this one

35.

Which of the following debug tools would you use to locate your current position in a series of embedded procedure calls?

Answer

Correct Answer: Callstack

Note: This Question is unanswered, help us to find answer for this one

36.

Which of the following are not properties of Command Button:

Answer

Correct Answer: Multi-Line

Note: This Question is unanswered, help us to find answer for this one

37.

How can you keep the user from exiting a form by clicking the Close button?

Answer

Correct Answer: Place code in the QueryUnload event

Note: This Question is unanswered, help us to find answer for this one

38.

Which event occurs only once in the entire life cycle of an ActiveX control?

Answer

Correct Answer: Initialize

Note: This Question is unanswered, help us to find answer for this one

39.

The interval property of the Timer control specifies the time in:

Answer

Correct Answer: Milliseconds

Note: This Question is unanswered, help us to find answer for this one

40.

Which of the following approaches to data modifications is the least efficient?

Answer

Correct Answer: Updating through a cursor using a recordset

Note: This Question is unanswered, help us to find answer for this one

41.

Which event of a text box would you use for validating the data entered by the user?

Answer

Correct Answer: Validate

Note: This Question is unanswered, help us to find answer for this one

42.

Variables that allow sharing of values across event procedures are called:

Answer

Correct Answer: Module level variable

Note: This Question is unanswered, help us to find answer for this one

43.

What do CurrentX and CurrentY return?

Answer

Correct Answer: Current X and Y co-ordinates of mousepointer

Note: This Question is unanswered, help us to find answer for this one

44.

Name the only property supported by a collection?

Answer

Correct Answer: None of the above

Note: This Question is unanswered, help us to find answer for this one

45.

The ____ function returns the numeric value from a string expression:

Answer

Correct Answer: Val

Note: This Question is unanswered, help us to find answer for this one

46.

In order to overlap the controls (say a command button) during design time, we use the 'Send To Back' or 'Bring To Front' option from the Edit menu. To change it dynamically (i.e. during program execution) we need to change:

Answer

Correct Answer: ZOrder property

Note: This Question is unanswered, help us to find answer for this one

47.

What you must do before making calls to an ActiveX DLL project in the same Project Group?

Answer

Correct Answer: Compile the DLL

Note: This Question is unanswered, help us to find answer for this one

48.

Which events allow you to determine if a Control or Shift key was pressed by the user?

Answer

Correct Answer: KeyUp and KeyDown

Note: This Question is unanswered, help us to find answer for this one

49.

The Load & Activate events are associated with:

Answer

Correct Answer: Form

Note: This Question is unanswered, help us to find answer for this one

50.

Which method will you use to remove a form from the Screen but retain it in memory?

Answer

Correct Answer: Hide method

Note: This Question is unanswered, help us to find answer for this one

51.

Which property procedure is used to retrieve the value of a property?

Answer

Correct Answer: GetProperty

Note: This Question is unanswered, help us to find answer for this one

52.

The _______ function enables a VB application to make use of the idle time and to respond periodically to events

Answer

Correct Answer: DoEvents

Note: This Question is unanswered, help us to find answer for this one

53.

Which of the following will perform a direct execution of a Command object?

Answer

Correct Answer: The Execute method

Note: This Question is unanswered, help us to find answer for this one

54.

What does the forms collection contain?

Answer

Correct Answer: A list of all forms in a project

Note: This Question is unanswered, help us to find answer for this one

55.

The settings for the Color properties in Visual Basic are indicated by:

Answer

Correct Answer: Hexadecimal Coding

Note: This Question is unanswered, help us to find answer for this one

56.

A __________ control defaults to displaying the files in the current directory:

Answer

Correct Answer: File List Box

Note: This Question is unanswered, help us to find answer for this one

57.

 Which of the following statements should you write to cause the component to fire an event?

Answer

Correct Answer: RaiseEvent

Note: This Question is unanswered, help us to find answer for this one

58.

Which of the following statements is incorrect regarding toolbars?

Answer

Correct Answer: Toolbars can be positioned anywhere on the form

Note: This Question is unanswered, help us to find answer for this one

59.

Which line of code listed here can be used to create a string of fixed length:

Answer

Correct Answer: strFirstName * 255

Note: This Question is unanswered, help us to find answer for this one

60.

What is the purpose of the Image List Control?

Answer

Correct Answer: To provide a repository for images used by other controls

Note: This Question is unanswered, help us to find answer for this one

61.

Which of the following is an event of the Shape control?

Answer

Correct Answer: A shape control does not have events

Note: This Question is unanswered, help us to find answer for this one

62.

Which event is triggered when the user moves to another open form?

Answer

Correct Answer: Deactivate

Note: This Question is unanswered, help us to find answer for this one

63.

Which of the following methods is used to inform an ActiveX control's container that one of its properties has been modified?

Answer

Correct Answer: PropertyChanged

Note: This Question is unanswered, help us to find answer for this one

64.

The method used to search for records from within a table type recordset object is:

Answer

Correct Answer: Seek

Note: This Question is unanswered, help us to find answer for this one

65.

Procedures declared in a _____ are local whereas procedures declared in a ______ are  available to the whole application.

Answer

Correct Answer: Class module, code module

Note: This Question is unanswered, help us to find answer for this one

66.

Which of the following statements is capable of abandoning a series of modifications made to a recordset locked with a BatchOptimistic lock?

Answer

Correct Answer: CancelBatch

Note: This Question is unanswered, help us to find answer for this one

67.

Visual Basic displays information depending upon the current value of two properties of the form, called:

Answer

Correct Answer: CurrentX and CurrentY

Note: This Question is unanswered, help us to find answer for this one

68.

What is the sequence in which the following events are triggered when a form is loaded?

Answer

Correct Answer: Initialize, Load, Resize and Paint

Note: This Question is unanswered, help us to find answer for this one

69.

You can create menus by the ________ and _________.

Answer

Correct Answer: Menu Editor, Win32 API

Note: This Question is unanswered, help us to find answer for this one

70.

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

Answer

Correct Answer: When a form designer containing a control is closed

Note: This Question is unanswered, help us to find answer for this one

71.

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

Answer

Correct Answer: DataMembers

Note: This Question is unanswered, help us to find answer for this one

72.

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?

Answer

Correct Answer: Cancel

Note: This Question is unanswered, help us to find answer for this one

73.

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

Answer

Correct Answer: Immediate window

Note: This Question is unanswered, help us to find answer for this one

74.

The _______ property changes the tab order at runtime:

Answer

Correct Answer: Tab index

Note: This Question is unanswered, help us to find answer for this one

75.

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:

Answer

Correct Answer: DataSource

Note: This Question is unanswered, help us to find answer for this one

76.

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

Answer

Correct Answer: Caption

Note: This Question is unanswered, help us to find answer for this one

77.

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

Answer

Correct Answer: Open dialog box

Note: This Question is unanswered, help us to find answer for this one

78.

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

Answer

Correct Answer: ToolTipText

Note: This Question is unanswered, help us to find answer for this one

79.

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

Answer

Correct Answer: Dynamic

Note: This Question is unanswered, help us to find answer for this one

80.

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

Answer

Correct Answer: Got_Focus

Note: This Question is unanswered, help us to find answer for this one

81.

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

Answer

Correct Answer: Number

Note: This Question is unanswered, help us to find answer for this one

82.

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

Answer

Correct Answer: Pixel

Note: This Question is unanswered, help us to find answer for this one

83.

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

Answer

Correct Answer: QueryUnload, Unload and Terminate

Note: This Question is unanswered, help us to find answer for this one

84.

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$)

Answer

Correct Answer: The Caption of Form1 will not change

Note: This Question is unanswered, help us to find answer for this one

85.

Which is the only event of the timer control?

Answer

Correct Answer: Timer

Note: This Question is unanswered, help us to find answer for this one

86.

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

Answer

Correct Answer: ImageList

Note: This Question is unanswered, help us to find answer for this one

87.

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

Answer

Correct Answer: Resume next

Note: This Question is unanswered, help us to find answer for this one

88.

Message Boxes can hold a maximum of _______ characters.

Answer

Correct Answer: 1024

Note: This Question is unanswered, help us to find answer for this one

89.

Which event is fired when a text box loses focus?

Answer

Correct Answer: LostFocus

Note: This Question is unanswered, help us to find answer for this one

90.

 What data type is the HelpContextID?

Answer

Correct Answer: Integer

Note: This Question is unanswered, help us to find answer for this one

91.

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

Answer

Correct Answer: FreeFile

Note: This Question is unanswered, help us to find answer for this one

92.

The Kill command in Visual Basic is used for:

Answer

Correct Answer: Stopping the current process

Note: This Question is unanswered, help us to find answer for this one

93.

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

Answer

Correct Answer: KeyPress, KeyUp and KeyDown

Note: This Question is unanswered, help us to find answer for this one

94.

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

Answer

Correct Answer: Form_GotFocus

Note: This Question is unanswered, help us to find answer for this one

95.

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

Answer

Correct Answer: BackColor, Transparent

Note: This Question is unanswered, help us to find answer for this one

96.

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

Answer

Correct Answer: NextRecordset

Note: This Question is unanswered, help us to find answer for this one

97.

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

Answer

Correct Answer: Seek method

Note: This Question is unanswered, help us to find answer for this one

98.

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

Answer

Correct Answer: .ocx

Note: This Question is unanswered, help us to find answer for this one

99.

The caption and the name properties of the command button:

Answer

Correct Answer: Can be different at times

Note: This Question is unanswered, help us to find answer for this one

100.

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

Answer

Correct Answer: Value

Note: This Question is unanswered, help us to find answer for this one

101.

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

Answer

Correct Answer: UBound function

Note: This Question is unanswered, help us to find answer for this one

102.

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

Answer

Correct Answer: Only (ii) is correct

Note: This Question is unanswered, help us to find answer for this one

103.

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

Answer

Correct Answer: Shell

Note: This Question is unanswered, help us to find answer for this one

104.

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

Answer

Correct Answer: Resize

Note: This Question is unanswered, help us to find answer for this one

105.

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

Answer

Correct Answer: WriteProperties

Note: This Question is unanswered, help us to find answer for this one

106.

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

Answer

Correct Answer: GetDataMember

Note: This Question is unanswered, help us to find answer for this one

107.

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

Answer

Correct Answer: AutoRedraw = True

Note: This Question is unanswered, help us to find answer for this one

108.

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

Answer

Correct Answer: Prepared statements

Note: This Question is unanswered, help us to find answer for this one

109.

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

Answer

Correct Answer: Validate

Note: This Question is unanswered, help us to find answer for this one

110.

Global Procedures and Global Variables are declared in:

Answer

Correct Answer: Standard (Code) Modules

Note: This Question is unanswered, help us to find answer for this one

111.

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?

Answer

Correct Answer: Number

Note: This Question is unanswered, help us to find answer for this one

112.

What does the controls collection contain?

Answer

Correct Answer: A list of all controls on a form

Note: This Question is unanswered, help us to find answer for this one

113.

An ADO dynamic property is:

Answer

Correct Answer: A property that dynamically resizes as needed to accommodate database parameters

Note: This Question is unanswered, help us to find answer for this one