Thursday, July 17, 2008
Visual Basic Questions
1) What is the sequence
Initialise, Load, Resize, Paint
2) You want to represent hierarchically an organisation's structure in a WWW
site along with Icons. Which control will you make use of ?
3) You have created an application. In the Help menu, you have an option to
navigate to a WWW site. What you should make use of ?
4) dim a as class1
dim b as new class1
b.prop = true
set a = new class1
How many instances of class1 is created ?
5) Which of the following is required for early binding ?
6) Which property of Err object gives you an idea of where the error has
7) How do you test an in-process ActiveX DLL ?
8) How do you test an out-of-process ActiveX EXE ?
9) Private sub mysub() as integer
static count as integer
if count >= 4 then
What will be the output ?
Out of stack error
10) You have debug statement in your project. You don't want them to be
compiled. What can you do Conditional compilation
Use Edit and Replace
11) You are making use of pass by reference. How will you optimize numeric
Assume no aliasing
Remove FDIV checks
Remove floating point error checks
12) You are making use of Pentium Pro computer. How can you optimize ?
13) You have created a class. You want other members of your project to
access it. You want them to access it like an app object. How do you set the
14) What are the valid properties of control collection ?
15) What should you do if you want to uninstall your software (when you are
using setup wizard ) ?
1.How do you create an instance of the form
2.What are the uses of the forms collection
3.What is the sequence in which the events in the form will trigger
4.What can you do with your Popup menus
•Dynamically create the menus •Deleting the menus created if not needed
5. What property cannot be send for the menus in the run time shortcut keys cannot be set in run time
6 .How do you dynamically create a menu
7. Drophighlight property of the treeview when it is used
It is used along with the hittest property to highlight the control when ole
controls are dropped on it
8. If you want to create a hierarchical view for the world wide web what
control will you use
9. What property will you use in the toolbar control to code for the events
10. What property should you use for showing text in the status bar
11.what are the disadvantages of using the implements keyword
12. If you want to merge the menu option of the object along with the menu
option of the form in which the object is placed what property should you use
13.When can you add watch expressions in the watch planes(very confusing
question) some of the options where any time any time when you do not have
a modal window only during design mode
14.What are the advantages of using the watch window(Check box)
15.What will be there in the local window
•all the variables in the application •all the variables in the modules
•all the variables in the procedure •all the variables in the procedure scope
1. What is the DBGrids default RecordSoruce type
2. I have set one option buttons HelpcontextID to 0, and the user press F1
what will happen?
If HelpContextID is set to 0, then Visual Basic looks in the HelpContextID
of the object's container, and then that object's container, and so on.
If a nonzero current context number can't be found, the F1 key is ignored.
3. What object do i use for the ShowHelp metod
Before you use the ShowHelp method, you must set the HelpFile and HelpCommand
properties of the CommonDialog control to one of their appropriate constants
or values. Otherwise, Winhlp32.exe doesn't display the Help file.
4. What object is used if i want to change label1 on usercontrol1background
5. What limitations has Implenents keyword (Choose 2)?
The Implements statement can't appear in a standard module. A type library
containing abstract interfaces provides a reference point for both implementing
and using interfaces. In order to implement an interface, you must use the
References dialog box to set a reference to the type library. This is because
the type library contains the information required to specify the arguments
and return types of the interface's members.
In similar fashion, any application that uses objects which have implemented
an abstract interface must also have a reference to the type library that
describes the interface. Information about implemented interfaces cannot be
included in the type libraries of components, because there is no way to
resolve naming conflicts.
6. ActiveX and errors. How to use Err.Rasierror
a)Raise method of the Err object to raise errors in a client application that
calls methods provided by your component.
7. ActiveX component distrubution. How to this the fastes way?
a)The Setup Wizard will create a .cab file, known as the primary .cab file,
which contains the following:
The project components, such as the ActiveX control, ActiveX DLL, or
The .inf file, which contains links to other .cab files that contain Visual
Basic support files and controls, as well as other information, such as
whether the control is safe for scripting and safe for initialization and
registry information as defined by the user. This file replaces the Setup.lst
file that the Setup Wizard creates in the standard setup. Reserved space for
All files that are not in other (secondary) .cab files.
Secondary .Cab Files
For ActiveX control projects, ActiveX EXEs, and ActiveX DLLs, all run-time
components such as Msvbvm50.dll, individual controls, Data Access Objects
(DAO), and Remote Data Objects (RDO) are packaged into separate .cab files,
digitally signed by Microsoft, and placed on the Microsoft Website. You can
choose to link your files to the .cab files on the Microsoft Web site, or you
can download local copies of them.
The benefit of using secondary .cab files from an Web site are:
You do not need to distribute all of the .cab files required by your
application. The only file you need to distribute is the primary .cab file.
The .inf file within the primary .cab file points to the Microsoft Web site
and downloads the necessary .cab files based on the needs of the end user.
They provide an efficient means of delivering updates to your product.
If you cannot or do not want your application setup to require a connection
to the Internet, you may place the secondary .cab files on a server within
your intranet. An intranet allows for faster downloading while allowing users
to remain on secured network.
8. Add watch. What is the meaning of the Context group?
a)Sets the scope of variables watched in the expression. Use if you have
variables of the same name with different scope. You can also restrict the
scope of variables in watch expressions to a specific procedure or to a
specific form or module, or you can have it apply to the entire application
by selecting All Procedures and All Modules. Visual Basic can evaluate a
variable in a narrow context more quickly.
9. What does locales show in different contexts?
10. What will be shown when this code is executed?
Private Sub Command1_Click()
Command2.Value = True
Private Sub Command2_Click()
Command1.Value = True
Out of Stack Space
11. In what order does a form go trough and in what order?
Initilize, Load, Rezise, Paint?
12. Load controls with Load Statement and index
13. What will happen if user presses command2?
Static intNum As Integer
If intNum <= 4 Then
intNum = intNum + 1
Private Sub Command2_Click()
The code will run OK
14. How to declare av DLL with a C Char datatype?
a)ByVal variable As Byte
15. How to use the Form collection?
a)Dim a As Form
For Each a In Forms
16. Learn TreeView and Drag and drop, OLE dragover event
1)What code will have the most to gain on to be compiled to Native Code?
•Code that uses windows API •Codet that has much String functions
•Code that manipulates objects •Code that have complex Finincal calculations
2)What elements exists in Conditional Compiling
3)What event can handle when a user presess F2
a)Key Down and Key Up
4.How to debugg an .OCX (Its an in-process DLL) with an project group (3 Q)
Why are an user control dimmed on the toolbar?
a)The user control designer has to be closed
5)When can you add watch variables?
a)In Break and design mode
6)Where do you define conditional compiling variables?
a)Project options and VB.EXE
Registry Settings i saved in HKEY_USERS
7)What project types can have ActiveX documents?
All that can be an container
8)When to use GetObject and Create Objects?
9)Where and why to use Friend metods and properties
My set of exam questions
1. which property sets the value to indicate the display of a lengthy
2)Dragover event of form1 to change bg color of label 1 to red/source.color
3)Trap a function key
4)To allow numeric digit only ina txt box which is unbound?
5)Prpperty to access buttons of toolbar?
a)Key and Index
6) Inserting text to statusbar SBI second panel ?
sb1.panels(2).text = "....printing"
dynaset type recordset
8)lokedits = false
9)pass an empty valu
a)byval 0& byref vbnullstring
10)which 2 projects contain ActiveX documents
a)Active X.exe and activex.dll
11)activex.dll to multithread
12)when helpcontextid =0 for an object conatined in a frame where does visual basic look for help?
In the controls container
13)what code will gain from being compiled as native code?
14)what cannot be done when an internet control is packaged?
a)write from registry,reading from registry.
15)benefits of form collection
a)Standardised mechanism for for tracking multiple instances of a form
unloading all forms is faster.
1.If you want to install your Visual Basic application in other computer,how
do you find out about the components that are registered in that computer?
2.How can you build ActiveX components for Internet distribution?
a)Use the Application Setup Wizard and pick the appropriate options.
3.What type of files does the Setup Wizard generates for Internet
4.Know all elements shown in the Add Watch Window (Debugging)
5.Know all elements shown in the Locals Window (Debugging)
6.Know allpossible type of files that can you register by using REGSRV32.EXE.
(i.e.: .DLL, .OCX, etc.)
7.How can you test the unload behavior of an in-process (ActiveX) DLL
a)You can add a standard EXE project to the ActiveX DLL¦s project group, and
test the in-process component within a single instance of Visual Basic.
8.How can you debug an (ActiveX) out-of-process component?
a)To test an ActiveX EXE, you must run the component within one instance of
Visual Basic,and run the test application in a second instance of VisualBasic.
9.Know all the options available within the "Compile" tab in the Project Properties
when making a new project. (i.e.: Compile to Native Code -> Favor Pentium Pro
(tm), Advanced Optimizations -> Remove Integer Overflow Checks, etc.)
10.Variable a is in Procedure A. In the Locals Window we observe its current
value. Then you step into to Procedure B and variable a shows a message "out
of context". What does it mean? Variable a was local to Procedure A (neither
public nor static).
11.One question on conditional compilation to choose the right construct
(learn the syntax for #ifdef #elseif #endif)
12.There is a www server application that uses ActiveX controls you developed
.When the application page is browsed with IE it does not show the ActiveX
control. What may be happening?
a)Options in the Application Setup Wizard were not used correctly.
13.Which (2) of the following make a safe ActiveX scripting control for
[ ] Prompt for a password
[ ] Save to a File
[X] Get information from registry
[X] Save information to registry.
14.What options (switches) should you select in order to optimize performance
for numeric processing while the compiler relies on arguments passed by
[ ] Assume No Aliasing
[ ] Optimizing for Small Code
[X] Disable Visual Basic Floating Point Error Checking
[X] Remove Safe Pentium FDIV Checks
15.You have Form1 where you drag and place a label named Label1. Pick the
correct line of code that changes the background color of Label1.
16.There is Form1 that has Object1. How can you combine the menu controls of
Object1 in Form1? Using a pop-up menu at run-time. Another option could be to
set the NegociateMenu property of Form1 to true.
17.You set a form with AutoRedraw = False. You have a command button, an
image control, a draw made by the PSET instruction, and a text that uses
the PRINT method. If the form is minimized and then restored, there are two
elements that are going to be di
The Command Button and the Image Control 18.If you want to display a
hierarchical structure of a Web Site, which of the following controls you
[ ] outline
[ ] listbox
[ ] listview
19.What can you do with a dynamic menu?:
[ ] You can add function keys to it
[X] You can add pop-up menus to it
[X] You can deleted it after creating it
[ ] You can create it from the MenuEditor
20.Know the DropHighLight property of TreeView.
The DropHighLight property is used to do drag and drop operations in a
21.Characteristics of the DragOver Event.
Used for drag and drop operations with forms, and other objects as pictures.
22.If you want to offer an option in a help menu for users to access your
Web Site, what ActiveX Document should you use?:
[ ] Automation
[ ] WinSock
[ ] ActiveX component
23.Know the function and syntax of Param Array
24.Know all about how to implement HelpFiles in an application
25.If we have an ActiveX Component that connects to a database, how can it
be notified if the component connection
26.Know all about using class modules
27.Know how to declare DLL functions.
28.You have an ActiveX document that uses the AsyncRead method to obtain data
from an intranet location. What type of data does it cannot return directly?
[ ] Files
[ ] Byte arrays
[ ] Pictures
29.What is the purpose of the Implements keyword?
a)The Implements keyword is used to create a secondary interface.
For instance, if your application has a reference to a type library that
describes the IGrowth interface, you could create a secondary interface in
a class module using "Implements IGrowth".
30.Why would you want to set theLockEdits property to False?
If LockEdits is set to False (for optimistic locking), then the 2K page
containing the record will remain locked, and then updated upon executing the
Update method only.
31.We obtained many DLL functions from different vendors. Two functions happen
to have the same name but different purposes. What can we do?
[X] Using an alias
[X] Declaring each Private in separate modules
[ ] Registering one with another name
[ ] Modifying the DLL function.
32.Know the differences between early binding vs late binding
Late binding occurs when the compiler does not know about an object until run
a)Early binding occurs when Visual Basic knows at compile time exactly which
interface will be used with an object variable.
33.One question related to sink events for a class named CLASS1 and some
possible answers like:
( ) Dim MyVar AS OBJECT
( ) Dim MyVar AS Variant
( ) Dim MyVar AS New Class1
( ) Dim WithEvents MyVar as Class1
34.Know all about Forms Collection 35.Which line of code will create a new
instance of an object new Form1 in Project1.
[ ] Dim Frmx as Form1
[ ] Dim Frmx as New Form1
[ ] Set Frmx = Form1
[X] Set Frmx = GetObject("Project1.Form1")
36.How can you create a read-only property for a class?
[ ] Define a Property Get procedure and define a Property Let procedure with
[ ] Define a Property Get procedure and a Property Let procedure.
[X] Define a Property Get procedure without a Property Set or Property Let
[ ] Define a Property Set or Property Let procedure without a Property Get
37.Advantages of Using ActiveX Documents (Choose 2).
The ActiveX Documents offer many advantages and increased functionality to
both the user and the application developer. The most important advantage
for developers in using ActiveX documents is the ability to apply existing
programming skills. Developers
38.What is the purpose of the ID parametr in an HTML
Labels: Visual Basic