Visual Basic 6 Test Answers
·
1. An ADO dynamic property is:
Answers:
• A property that changes
value at runtime
• A value defined
by the user
• A value defined
by the operating system
• A property that
dynamically resizes as needed to accommodate database parameters
• A property
implemented by the OLE DB service provider
2. In order to provide a transparent
background to the Form, you must change the _________ property to _______.
Answers:
• BackStyle, Opaque
• BackColor,
White
• BackStyle,
Transparent
• BackColor,
Parent Window's Color
• ZOrder, 0
• BackColor,
Transparent
3. Which of the following cannot be included
in the Open method of the recordset?
Answers:
• Cursor Type
• User Name
• Active
Connection
• CursorLocation
• LockType
• Source
4. What does the controls collection contain?
Answers:
• A list of all controls on
a form
• A list of all
the controls used by your program
• A list of all
text boxes on a form
• A list of all
visible controls
• The names of
all control arrays on the form
5. 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?
Answers:
• Number
• Description
• CompName
• Component
• Source
• Text
• Desc
• None of the
above
6. Global Procedures and Global Variables are
declared in:
Answers:
• Form Modules
• Standard (Code)
Modules
• Class Modules
• Resource files
• ActiveX
Controls
• Data
Environment
7. Given the following code segment, how many
instances of the form are created and displayed ?
dim frmvar1 as
frmperson,frmvar2 as frmperson
set frmvar1 =
new frmperson
set frmvar2 =
frmvar1
load frmvar1
frmvar2.show
Answers:
• None
• 1
• 2
• 3
• 4
• 5
• 6
• 7
8. Only Controls with a ________ property such
as Picturebox, Toolbox, Statusbar etc. can be placed on an MDI form:
Answers:
• Showtips
• Negotiate
• Align
• BorderStyle = 0
• Visible
• Locked
• Enabled
• Tag
9. Whenever the current record is about to
change, Visual Basic generates the ______ event:
Answers:
• Validate
• UpdateRecords
• UpdateControls
• BeginTrans
• BeginMove
• Update
10. Which of the following will provide the
best aggregate performance for a query that is not executed repeatedly?
Answers:
• Direct execution
• Stored
procedures
• Prepared
statements
• Data
Environment
• ADO Data
Control
11. The _______ property enables Visual Basic
to draw complete images in memory before displaying them on the Screen.
Answers:
• AutoRedraw = True
• AutoRedraw =
False
• Refresh
• PaintPicture
12. Which event of an ActiveX control data
provider runs every time a bound control extracts data through the provider?
Answers:
• GetDataMember
• GetDataField
• GetDataProperty
• GetDataRow
• GetData
• GetFields
• GetRows
• RetrieveData
13. Which event should you use to store
property values into the PropertyBag?
Answers:
• Terminate
• ReadProperties
• StoreProperties
• WriteProperties
• SaveProperties
•
CommitProperties
14. One can convert a Visual Basic Application
into ActiveX Document using:
Answers:
• Visual Database Manager
• Application
Wizard
• ActiveX
Document Migration Wizard
• Package and
Deployment Wizard
15. Which event should be used to resize an
ActiveX control as the user modifies the size of the control implementation on
a form?
Answers:
• Resize
• Paint
• Repaint
• Initialize
• Change
• ReDimension
• Dimension
• Any of the
above
16. The ______ function can be used to run any
.com, .exe, .bat or .pif file from a Visual Basic program.
Answers:
• Shell
• Substr
• SetAttr
• CStr
• Exec
• Perform
• Do
• None of the
above
17. 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
Answers:
• Both (i) and (ii) are
correct
• Only (i) is
correct
• Only (ii) is
correct
• (i) contains a
logical error
• (ii) contains
an error
• Both (i) and
(ii) contain errors
18. Which function or method will you use to
get a count of the maximum index limit of an array?
Answers:
• UBound function
• LBound function
• Substr function
• Bound Control
method
• Limit method
• UpperLimit
method
• Upper method
• MaxArray
function
19. Which property of the ProgressBar
determines how much of the bar is filled?
Answers:
• Min
• Max
• Value
• CurrentVal
• FillValue
• Fill
• BarComplete
20. In order to change the mouse pointer shape
from glass to watch-glass, the property to be used is:
Answers:
• MousePointer
• Picture
• Menu
• PointerStyle
• Pointer
• Cursor
• CursorStyle
• CursorShape
21. The caption and the name properties of the
command button:
Answers:
• Are one and the same
• Can be
different at times
• Are actually
not properties
22. In order to access a file in Non-textual
format, you have to open file in:
Answers:
• Ascii Format
• Binary Format
• Input Mode
• Output mode
• Append mode
• Read Mode
23. What is the extension of the Visual Basic
project file that stores the design of a user control.
Answers:
• .ctx
• .ctl
• .ctr
• .ocx
• .vbp
• .dll
• .ucl
• .utl
24. After a Dynaset type recordset has been
created and opened, further searching is possible using the:
Answers:
• LookUp method
• Seek method
• Locate method
• FindNext method
• Search method
25. Which method of the Recordset object
should you use to navigate multiple recordsets returned by a stored procedure?
Answers:
• NewRecordset
•
NavigateRecordset
•
OpenNextRecordset
• NextRecordset
• SkipRecordset
•
PreviousRecordset
• JumpRecordset
• GoTORecordset
26. Which event procedure is called only if
AutoRedraw property is set to false:
Answers:
• Form_GotFocus
• Form_Paint
• Form_Activate
27. Which events enable you to determine which
key was pressed by the user?
Answers:
• Click and KeyPress
• Click, KeyUp
and KeyDown
• KeyUp and
KeyDown
• KeyPress, KeyUp
and KeyDown
• Click,
KeyPress, KeyUp and KeyDown
28. The Kill command in Visual Basic is used
for:
Answers:
• Stopping the current
process
• Deleting files
• Terminating the
application
• Stopping the
current thread
• Debugging the
application
• Error handling
• None of the
above
29. Which method would you use to get a free
or unused File identifier while opening any file:
Answers:
• FreeFile
• GetFileNum
• GetFile
• GetBytes
• NextFile
• File
• GetNextFile
• None of the
above
30. What data type is the HelpContextID?
Answers:
• String
• Integer
• Single
• Double
• Long
• Char
• Float
31. Which event is fired when a text box loses
focus?
Answers:
• LostFocus
• FocusLost
• RemoveFocus
• FocusAway
• NoFocus
• Leavefocus
32. Message Boxes can hold a maximum of
_______ characters.
Answers:
• 256
• 512
• 1024
• 2046
• 4092
• 5000
• 10000
• No limit
33. Which of the following is the only valid
Resume statement in an error handler?
Answers:
• Resume prior
• Resume previous
• Resume later
• Resume next
• Resume before
• Resume to
• Resume
statement
• Resume
application
34. To store pictures in an array, Visual
Basic provides the _____ control.
Answers:
• PictureClip
• ImageList
• PictureBox
• Image Box
• Timer Control
• ListView
• Common Dialog
• DataGrid
35. Which is the only event of the timer
control?
Answers:
• Timer
• TimeElapsed
• TimeOver
• Reset
• TimeOut
• Restart
• Freeze
• Stop
36. 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$)
Answers:
• The Caption of Form1 will
change to the value contained in Y$
• The Caption of
Form1 will not change
• The Caption
changes at random intervals after the function call
• The code is
incorrect
37. 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.
Answers:
• Caption
• ClipControls
• UseMnemonic
• LinkMode
• Locked
• Label
• ZOrder
• Visible
38. What is the sequence of events when a form
is unloaded?
Answers:
• QueryUnload, Unload and
Terminate
• QueryUnload,
Terminate and Unload
• QueryUnload and
Unload
• Unload only
• Terminate,
QueryUnload and Unload
• Terminate,
Unload and QueryUnload
• Unload,
QueryUnload and Terminate
• Unload,
Terminate and QueryUnload
39. What is the default value for the
scalemode property of the form?
Answers:
• Twip
• Point
• Pixel
• Character
• Centimeter
• Inches
• Millimeters
40. Which property of the Err object returns
the numeric value associated with the most recent runtime error?
Answers:
• Description
• No
• Number
• Source
• Errorcode
• Num
• Code
41. The event Lost_Focus of one object results
in _____ of the other object:
Answers:
• Got_Focus
• Lost_Focus
• Mouse_click
• Refresh
• Validate
• Load
• Activate
• Initialize
42. Which of the following ADO recordset types
provides the greatest degree of concurrency?
Answers:
• Static
• Forward-only
• Dynamic
• Keyset
• Read only
• Keyset and
Dynamic
43. The ______ property is used to show Tool
Tips or Help Balloons when the mouse rests on the object:
Answers:
• ToolTipText
• Tag
• Dragmode
• ShowTips
• Help
• Tip
• ShowHelp
• Tab
44. Which of the following can be shown to the
user using the Common Dialog control in VB?
Answers:
• Common messages passed to
Windows
• Open dialog box
• Windows
explorer
• Input box
• Message box
• Error messages
• Help
• None of the
above
45. Which property of the form changes the
form's title?
Answers:
• Name
• Heading
• Caption
• Text
• Title
46. 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:
Answers:
• DataSource
• Connection
• RecordSource
• TableType
• RecordType
• DataType
47. In Visual Basic, which method can you use
to send key strokes to other Window applications?
Answers:
• AppActivate
• SendKeys
• Copying the
contents from the ClipBoard & pasting
• Manually typing
in the other application's Window
48. The _______ property changes the tab order
at runtime:
Answers:
• Tab stop
• Tab key
• Tab order
• Tab index
49. 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?
Answers:
• Cancel
• Escape
• Exit
• Focus
• Default
• Losefocus
• ExecEvent
• FireEvent
50. Which collection of an ActiveX control
enumerates all of the properties that can be bound to a data source?
Answers:
• DataFields
• DataMembers
• DataBindings
• DataProperties
• DataBase
• DataColumns
51. You can create menus by the ________ and
_________.
Answers:
• Menu Editor, Application
Wizard
• Menu Editor,
Win32 API
• Win32 API,
Application Wizard
• Class Builder,
New Application Wizard
52. What is the sequence in which the
following events are triggered when a form is loaded?
Answers:
• Initialize, Load, Resize
and Paint
• Initialize,
Load, Paint and Resize
• Load,
Initialize, Resize and Paint
• Load,
Initialize, Paint and Resize
• Initialize,
Resize, Paint and Load
• Load,
Paint,Initialize and Resize
• Initialize,
Paint, Load and Resize
• Paint, Resize,
Initialize and Load
53. Visual Basic displays information
depending upon the current value of two properties of the form, called:
Answers:
• CurrentX and CurrentY
• ScaleLeft and
ScaleTop
• ScaleHeight and
ScaleTop
• x and y
• TopX and TopY
• LeftX and LeftY
54. Which of the following statements is
capable of abandoning a series of modifications made to a recordset locked with
a BatchOptimistic lock?
Answers:
• CancelUpdate
• CancelBatch
•
CancelBatchUpdate
• AbandonBatch
•
AbandonBatchUpdate
• Rollbackupdate
• Rollbackbatch
• None of the
above
55. Procedures declared in a _____ are local
whereas procedures declared in a ______ are available to the whole
application.
Answers:
• Form window, standard or
code module
• Project window,
view code window
• Class module,
code module
56. Which property of the ListView control
determines which field a sort is based on?
Answers:
• Sorted
• SortKey
• SortOrder
• SortField
• Sort
• Key
• ListKey
• None of the
above
57. The method used to search for records from
within a table type recordset object is:
Answers:
• LookUp
• Seek
• Locate
• FindNext
• Search
58. Which event is triggered when the user
moves to another open form?
Answers:
• Unload
• QueryUnload
• Deactivate
• Terminate
• Load
• Initialize
• Repaint
• Resize
59. Which of the following is an event of the
Shape control?
Answers:
• GotFocus
• LostFocus
• Validate
• KeyPress
• A shape control
does not have events
60. What is the purpose of the Image List
Control?
Answers:
• To display images to the
user
• To help in
creating a ToolBar
• To allow the
editing of icons
• To provide a
repository for images used by other controls
• To provide
images to the listbox control
• To provide
images for the splash screen
• To provide
icons for error messages
61. Which line of code listed here can be used
to create a string of fixed length:
Answers:
• Dim strFirstName as String
• strFirstName *
255
• strFirstName =
255
• Dim
strFirstName as String(255)
• None of the
above
62. Which of the following statements is
incorrect regarding toolbars?
Answers:
• There can be only one
toolbar on a form
• Toolbars can be
positioned anywhere on the form
• Toolbars can be
customized by the user
• Toolbar buttons
can display images
• Toolbar buttons
can display text
• Toolbars can
have both images and buttons
63. A __________ control defaults to
displaying the files in the current directory:
Answers:
• File List Box
• Dir List Box
• Drive List Box
• Combo Box
• Picture Box
• List Box
• Combo Box
• DataGrid
64. The settings for the Color properties in
Visual Basic are indicated by:
Answers:
• Decimal Coding
• Octal Coding
• Hexadecimal
Coding
• Binary Coding
65. What does the forms collection contain?
Answers:
• A list of all forms in a
project
• A list of all
hidden forms
• A list of all
currently loaded forms
• A list of all
visible forms
• All the child
forms of an MDI application.
66. Which of the following will perform a
direct execution of a Command object?
Answers:
• The Execute method
• The Prepare
method
• The ExecDirect
method
• The Open method
• The Exec method
• The
ExecProcedure method
• None of the
above
67. The _______ function enables a VB application
to make use of the idle time and to respond periodically to events.
Answers:
• GetTime()
• TrapEvents()
• GetDate()
• DoEvents
• Kill
• Idle
• Events
• Call
68. Which property procedure is used to
retrieve the value of a property?
Answers:
• Retrieve
• Get
• GetProperty
• Value
• RetrieveValue
69. Which method will you use to remove a form
from the Screen but retain it in memory?
Answers:
• Show method
• Unload method
• Hide method
• CLS method
• Deactivate
method
70. The Load & Activate events are
associated with:
Answers:
• All controls
• Form
• Command button
• Image box
• TreeView
control
• ListView
control
• DataGrid
• ComboBox
71. Which events allow you to determine if a
Control or Shift key was pressed by the user?
Answers:
• Click and KeyPress
• Click, KeyUp
and KeyDown
• KeyUp and
KeyDown
• KeyPress, KeyUp
and KeyDown
• Click,
KeyPress, KeyUp and KeyDown
• KeyPress and
KeyUp
72. What you must do before making calls to an
ActiveX DLL project in the same Project Group?
Answers:
• Compile the DLL
• Check the DLL
is off in your project's Reference List
• Make sure the
DLL is the Startup Project
• Ensure that a
Standard Exe form is included and is made the Startup Form.
73. 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:
Answers:
• Background color property
• Caption
property
• ZOrder property
• AutoRedraw
property
• SendtoBack
property
• BringtoFront
property
• Hide property
• Show property
74. The ____ function returns the numeric
value from a string expression:
Answers:
• Val
• CStr
• Round
• Int
• Num
75. Name the only property supported by a
collection?
Answers:
• Name
• Index
• Count
• Type
• Value
• None of the
above
76. What do CurrentX and CurrentY return?
Answers:
• Current X and Y
co-ordinates of mousepointer
• Current X and Y
co-ordinates of cursor
• A String of X
& Y
• Current x and y
co-ordinates of the control
77. Variables that allow sharing of values
across event procedures are called:
Answers:
• Form level variable
• Object variable
• Module level
variable
78. Which event of a text box would you use
for validating the data entered by the user?
Answers:
• Validate
• Validation
• Check
• Audit
• GotFocus
• Checkdata
• ValidateDate
79. Which of the following approaches to data
modifications is the least efficient?
Answers:
• Updating through a cursor
using a recordset
• A stored
procedure
• An update
statement prepared and executed
• An update
statement executed directly
• Updating
through a data control
80. The interval property of the Timer control
specifies the time in:
Answers:
• Milliseconds
• Seconds
• Minutes
• Hours
• Either
milliseconds or seconds
81. Which event occurs only once in the entire
life cycle of an ActiveX control?
Answers:
• Initialize
• Resize
• Terminate
• WriteProperties
• InitProperties
• Activate
• None of the
above
82. How can you keep the user from exiting a
form by clicking the Close button?
Answers:
• Place code in the
Terminate event
• Place code in
the Unload event
• Place code in
the QueryUnload event
• This can only
be done by using the Windows API
• Place code in
the Load event
• Place code in
the Deactivate event
• None of the above
83. Which of the following debug tools would
you use to locate your current position in a series of embedded procedure
calls?
Answers:
• Locals window
• Immediate
window
• Watch window
• Callstack
• Debug object
84. 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?
Answers:
• Err.Raise vbObjectError +
20000
• Err.Number =
20000
• Err.Raise 20000
• Err.Raise
vbObjectError,20000
• Err.Number
20000
• Error.Raise
vbObjectError + 20000
• Error.Number
20000
• Error.Raise
20000
85. A prepared statement is:
Answers:
• Query text
cached on the client
• Query text cached on the
server
• Compiled query
cached on the client
• Compiled query
cached on the server
• A stored
procedure
• None of the
above
86. Which parameter of the WriteProperty
method can be omitted but should be included to increase the efficiency of the
control?
Answers:
• Name
• Value
• Caption
• PropBag
• DefaultValue
• Title
• Tag
• None of the
above
87. A project group is a Project which:
Answers:
• Consists of
several Programs
• Consists of
several Applications
• Consists of
Various Forms And Code Modules
• Consists of several
Projects
88. The _______ method loads the form named 'Form1'
in to memory and also displays it.
Answers:
• Load Form1
• Form1.Show
• Form1.Visible =
True
• Unload Form1
• Form1.activate
89. You want to display the code and the
description of an error. What would be the correct syntax?
Answers:
• Msgbox err.no &
err.text
• Msgbox
err.number & err.text
• Msgbox
error.number & error.text
• Msgbox
error.number & error.description
• Msgbox
err.number & err.description
• Msgbox err.num
& err.description
• Msgbox err.num
& err.text
• None of the
above
90. If the CancelError Property of the
CommonDialog Box is set to true then which of the following statement is true:
Answers:
• A runtime error can result
if the user clicks the cancel button
• A compile time
error occurs
• The program
executes without any error
• You need to
carry out conditional compilation
• None of the
above
91. How do you create a read only property in
a form?
Answers:
• Create only a Property Set
procedure
• Create only a
Property Get procedure
• Create only a
Property Let procedure
• Create both a
Property Get and Property Let procedure
• Declare a
public variable in the Declarations section of the form
• Declare a
private variable in the Declarations section of the form
• Create both a
Property Get and Property Set procedure
92. What is the purpose of the Class Builder
add-in in Visual Basic:
Answers:
• To add classes to the
current project
• To change the
current project to a class based project
• To create new
classes and define their properties, methods & events
• To draw out how
the application model will look
93. Which three methods does the collection
object support?
Answers:
• Let, Get, Set
• Load, Unload,
Count
• Add, Remove,
Item
• Add, Delete,
Index
• Add, Remove,
Sort
• Add, Remove,
Count
• Add, Delete,
Count
• Add, Set, Count
94. Labels do not respond to _____ and ______
events.
Answers:
• Got_Focus , Lost_Focus
• Click ,
DblClick
• Dragdrop ,
OLECompleteDrag
• Change, Link
Error
95. The _______ method resets the contents of
bound controls to their original values when the user clicks on the cancel
button.
Answers:
• UpdateControls
• PaintPicture
• Refresh
• Resize
• Resync
• Restore
• Cancel
• Update
96. Which of the following is the only drag
related event?
Answers:
• DragEnter
• DragLeave
• DragStart
• DragStop
• DragDrop
• BeginDrag
• EndDrag
97. 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?
Answers:
• 1-1000
• 0-255
• 1-65535
• 0-1000
• 513-65535
• 1000-2000
• 10000-20000
• None of the
above
98. Which of the following procedure types
will execute when you assign a value to a property of an object?
Answers:
• Property Get
• Property Assign
• Property Let
• Property Set
• Public Sub
99. Which of the following tools can be used to change the value of a variable or property during break mode of an application?
Answers:
• Watch window
• Immediate
window
• Callstack
• Locals window
• Debug object
100. Which of the following situations would
not cause the Initialize event of an ActiveX control to occur?
Answers:
• When a control
is placed on a form at design time
• When a form
designer containing a control is closed
• When a form is
run
• When a compiled
application containing a control executes
• When an
application terminates and re-enters design-time for the host application
101. Which of the following is the valid
stepping option?
Answers:
• Step Around
• Step Beyond
• Step Over
• Step Behind
• Step forward
• Step Into
• Step Out
102. Which of the following methods is used to
inform an ActiveX control's container that one of its properties has been
modified?
Answers:
• PropertyChanged
•
CanPropertyChange
• ModifyProperty
• PropertyModify
• PropertyChange
•
PropertyModified
• ChangeProperty
103. Which of the following statements should
you write to cause the component to fire an event?
Answers:
• RaiseEvent
• DeclareEvent
• FireEvent
• DoEvents
• ExecuteEvents
• Execute
• TriggerEvent
104. Which of the following are not properties
of Command Button:
Answers:
• Caption
• Visible
• Multi-Line
• Font
• Tag
• Bold
• Enabled
105. Which parameter of the Execute method of
the Connection object returns the number of records that the operation
affected?
Answers:
• RecordsAffected
• RowsAffected
• RecordsUpdated
• RowsOperated
• RecordsOperated
106. Which of the following statements forces
inline error handling?
Answers:
• On Error GoTo
linelabel
• On Error GoTo
Inline
• On Error Stop
• On Error Resume
Next
• On Error GoTo 0
• On Error Resume
• None of the
above
107. Which of the following compiled elements
does not run in process?
Answers:
• ActiveX EXE
• ActiveX DLL
• ActiveX Control
• MTS Component
• Standard DLL
• Standard Exe
108. Which of the following locking types will
lock a recordset only during an Update process and not immediately when the
data modifications are requested?
Answers:
• Pessimistic
• Update
• Optimistic
• Batch
optimistic
• Read only
• Delayed locking
109. Which form event would you use to
activate a pop-up menu when the user clicks the right mouse button?
Answers:
• Click
• MouseMove
• DragOver
• DragDrop
• MouseUp
• Mouse-popup
• ShowMenu