Skills Test Answers - Visual Basic

If, Then, Else are examples of:

operators
conditionals
variables
events



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

Yes
No
You can read but cannot write



What type of executable can VB6 not produce?

ActiveX EXE
Native DLL
Standard EXE
ActiveX DLL
ActiveX Control



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

Application.DisplayAlerts = False
Application.ScreenUpdating = True
Application.ScreenUpdating = False
Application.Visible = True
Application.Visible = False



What is MAPI ?

Messaging Application Programming Interface
Messaging Application Programming Interchange
Messaging Administration Programming Interface
None of the Above
Messaging Application Programming Interfere



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

Pressing enter after you write: file_name.vbs
cscript file_name.vbs
wscript file_name.vbs
All of these are correct



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

Zoom = 80
ActiveWindow.Zoom.Adjust = 80
Application.Zoom = 80
ActiveWindow.Zoom = -20
ActiveWindow.Zoom = 80



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

Arithmetic
Concatenation
Boolean
Relational



Integer is an example of a:

data type
variable
procedure
number



Visual Basic is considered a ___________ programming language.

mid-level
low level
high level
assembly level



The Enterprise Edition of Visual Basic is aimed at:

file sharing
network oriented clients
decompiling
C++



To show a form, use the ____________ command.

show
appear
visible
display



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

code window
document
project explorer
form explorer



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

function
none of these
procedure
sub



What keyword starts every procedure?

Start
For
Begin
Sub
With



How do you enter in comments without having an output?

'
@
%
%%
*/



Visual Basic 6.0 has been replaced by:

VB.NET
Visual C++
Visual Studio
C++



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

.html
.exe
.vbp
.vb



Visual Basic is an ____________ driven language.

event
assembly
adjective
asp



Visual Basic is derived from:

Assembly
C++
Qbasic
BASIC



Which control can be data bound?

All of these
Label
Textbox
Checkbox



Press _________ to run a program.

F5
F7
F4
F6



What keyword(s) end every procedure

Stop
End
Ending
End Sub
Stop Procedure



How to declare a variable in VB?

All of these
Declare @(Variable) (Datatype)
Dim (Variable) AS (Datatype)
(Datatype) (Variable);



The code to cancel out of a Loop event is:

Exit Do
Cancel
Delete Loop
Clear



The three types of Visual Basic operators are:

add, divide, multiply
arithmetic, relational, and logical
plus, minus, multiply
divide, multiply, plus



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

Private Sub
Dim
Loop
Declare



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

listbox.itemmenu.add(item)
listbox.newitem.add(item)
listbox.setnewitem = item
listbox.items.item(item).register
listbox.items.add(item)



The default file type for a Visual Basic project is:

.frm
.vbo
.vbp
.mvb



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

-
"
+
#
'



Visual Basic can do which of the following?

Develop Windows applications
Create DLL files
Create ActiveX controls
All are correct
Create executable files (EXE files)



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

deleting
decompiling
compiling
coding



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

False
True



LoadPicture is a function of an Image control that can:

format the border of the image
change the color of the image
delete an existing picture
populate the picture with an image from a specified directory



A variable can be assigned a value.

True
False



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

False
True
6
3
2



MDI is an IDE developed by Microsoft and stands for:

Multiple Document Interface
Microsoft Document Interface
Multiple Data Interface
Microsoft Data Interface



What keyword ends a For loop?

End
Done
Next
End Loop
End For



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

DllImport Sub CopyMemory From "Kernel32" Original "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Import Function "RtlModelMemory" As "CopyMemory" From "Kernel32" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Import Function "RtlModelMemory" Alias "CopyMemory" From "Kernel32" ([Pointer] lpvDest As Any, [Pointer] lpvSource As Any, ByVal cbCopy As Long)
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Public External Sub RtlMoveMemory Lib "Kernel32" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)



Lower bound of arrays in VB 6 is

0
1
Determined by a compiler switch
Default is 1. Can be set to 0 by "Option Base 0"
Default is 0. Can be set to 1 by "Option Base 1"



What does Option Explicit refer to?

All variables must be declared before use. Their type is not required.
All variables with their types must be declared before use.
variables are defined automatically
Options for all built in controls is restricted.



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

LockPessimistic Locks the row only when Update is called. LockOptimistic Locks the row once after any edits occur.
LockPessimistic Locks the row once after any edits occur. LockOptimistic Locks the row only when Update is called.
LockPessimistic Locks the row automatically. LockOptimistic Locks the only when initiated by code.
There is no difference



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

2048
512
256
1024
780



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

0 - Manual
4 - Automatic
1 - CenterOwner
3 - Windows Default
2 - CenterScreen



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

x as variant and y as integer
Both are integers
Wrong declaration



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

select "Start with Full Compile" from "Run" menu
Attach to VB6.exe from Visual Studio
"Compile to Native Code" and enable "Create Symbolic Debug Info"
"Compile to P-Code" and enable "Create Symbolic Debug Info"
add "NATIVE=1:DEBUG=1" to "Conditional Compilation Arguments"



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

StandardPicture
StandardLayout
StandardDataFormat
StandardFont
StandardColor



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

True
False



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

By Setting ControlBox Property to False
By Passing parameter FALSE to Forms SHOW Method
Using Windows API
By Setting ControlBox Property to False or by using Windows API
By Setting ControlBox Property to True



What two methods are called from the ObjectContext object to inform MTS that the transaction was successful or unsuccessful?

SetComplete and SetAbort.
TransactionSucess and TransactionFail
ObjTransOk and ObjTransFail
ObjectComplete and SetObject



How do you make a property default in VB 6?

Rename your property to "Default"
Decorate it with "<Default>" attribute
Using "Option Default Property 'propertyname'" in "General Declarations" section
You can not
Set "Procedure ID" property of property to "(Default)" in "Procedure Attributes" dialog



For Excel, what is the shortest code that would change the column width of columns L & X to 30?

Columns("L:L,X:X").Width= 30
Range("L:L,X:X").ColumnWidth= 30
Columns("L:X").Width= 30
Select("L:L,X:X").ColumnWidth= 30
Range("L:X").ColumnWidth= 30



What is the correct entry:

Dim s:2
Dim s : s=2
Dim s:=2
Dim s=2



For Excel... What is the shortest code that would AutoFit all rows in the active worksheet?

Cells.EntireRow.AutoFit
ActiveWorkbook.EntireRow.AutoFit
ActiveWorkbook.Rows.AutoFit
ActiveWindow.Cells.Rows.AutoFit
Rows.AutoFit



Which one of the following cannot be added to a UserControl in VB6

Timer Control
Another UserControl
An OCX Control
OLE Control



In Visual Basic 6, which one is NOT a parameter of connection objects open method?

Connection String
Source
Options
Password
UserID



When an ActiveX project is compiled, its COM interface can be preserved by using Binary Compatibility. Between compilations VB creates different interfaces for modified parts of classes. This is called:

Retained in Memory
Assume No Aliasing
Out of Process Library
COM Compatibility
Interface Forwarding



To make a UserControl transparent

Set BackStyle to Transparent
Add WindowStyle VB_TRANSPARENT
Set Opacity to 0
Set BackColor to Transparent
Set Transparent to True



Which property is required to place a control on Visual Basic 6 MDI Form?

Align Property
IsParent Property
IsChild Property
DrawMode Property
AutoRedraw Property



KeyDown is an example of a:

function
procedure
executable
command



What is the numeric value for the boolean "True"?

1
0
-1
1 byte



What is the window class of a debugged MDI application in VB6

ThunderMDIForm
VBFormMDI6
VB6MDIForm
ThunderMDI6Form
VBFormMDI



What command line argument is passed to an out of process COM server to register it

regsvr64
DllSelfRegister
regsvr32
register
regserver



For Excel, what will the following code do? Range("A2").Select: ActiveWindow.FreezePanes = True

Freeze Panes will not work with that range selected
Freeze Row 1
Remove current Freeze Panes settings
Freeze Column A
Freeze Column A & Row 2



How do you bold an output text?

text.selbold=true
select.bold=true
text.bold=true
.SelBold=true
.bold=true



What is the maximum value of the Interval Property for a timer?

60 seconds
1.4 seconds
65.5 seconds
128 seconds
10 seconds