VB Basic Knowledge
1. What is the main advantage of adding a reference to an object library?
a) The ability to reference objects of the object library
b) The ability to user the set method.
c) The ability to use early binding.
d) The ability to use late binding.
2. Which advantage does early binding have over late binding?
a) Better execution speed
b) Early bound objects can be passed to other objects, late bound objects can not.
c) Early bound objects can have events, late bound objects can not.
d) Early binding provides syntax checking before encountering an error at runtime, and late binding does not.
3. Form 1 has variable declared as follows Public ICount as Integer. The application starts with the Sub Main procedure and the first line executed is Form1.iCount = 5
Which Form1 event or events will be triggered by this statement?
a) Initialize only
b) Load only
c) Initialize and load
d) Activate and load
4. You are creating an application that has a form with required data fields. You have placed an "Ok" button on the form for the user to click when they have finished entering data on the form. If the user has failed to enter data in a required field, which statement should you use to stop the form from unloading so that you can prompt the user to enter the missing data?
a) Cancel = True ‘In QueryUnload
b) Cancel = False ‘In QueryUnload
c) Cancel = True ‘In Unload
d) Cancel = False ‘In Unload
5. Which three steps are required in order to create a reference to an Excel Chart object that is defined in a object library?
a) Establish a reference to the type library using a DLL
b) Assign an object reference to the variable by using the Implements keyword
c) Declare a variable of the object’s class like:
Dim xlChart as createobject(Excel.Chart)
d) Declare a variable of the object's class like:
Dim xlChart as createobject("Excel.Chart")
6. What is the purpose of the Friend keyword?
a) to make a procedure in a class available only within the class which it is defined.
b) to make a procedure in a class available to modules outside that class, including modules in other applications.
c) to make a procedure in a class available to modules outside that class, but within the same application.
d) to make a procedure in a class available to in-process components.
7. You are monitoring a global variable and want to suspend program execution when its value changes. Which debugging tool should you use?
a) Watch window
b) Suspend window
c) Variables window
d) Locals window and e) Immediate window
8. Examine the following code:
If X > 3 then
Else X = X + 1
What happens when the Test procedure is called?
a) A stack overflow error occurs
b) It runs and completes execution without error
c) A General Protection fault occurs
d) It runs until you forcefully shutdown the application
9. You want to remember a form's state so that when it is opened again, it will appear the same. What function call would you use, and in which event procedure would you place it?
a) SaveRegSetting in the Form_Unload event
b) SaveRegSetting in the Form_Deactivate event
c) SaveSetting in the Form_QueryUnload even
d) SaveSetting in the Form_Unload event
10. How do you instantiate an instance of a VB class?
11. How would you run Excel from a VB app?
12. Briefly explain how you would go about error handling in a VB app.
13. For what purpose would you use a .RES file? What are the benefits?
14. Explain the use of the Let and Get keywords in a VB class?
15. What are 2 types of ActiveX servers? Explain.
16. What is the difference between a class and an object?
17. What are the main numeric types available in VB? What are the advantages and disadvantages of each?