Friday, August 5, 2016

Visual Basic Test Answers



Ques : Which of the following is the valid stepping option?
Ans  :  Step Behind
            Step forward
            Step Into

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

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

Ques : Procedures declared in a _____ are local whereas procedures declared in a ______ are  available to the whole application.
Ans  : Form window, standard or code module

Ques : The settings for the Color properties in Visual Basic are indicated by:
Ans  : Hexadecimal Coding

Ques : The Load & Activate events are associated with:
Ans  : Form

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

Ques : Which of the following will provide the best aggregate performance for a query that is not executed repeatedly?
Ans  : Direct execution

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

Ques : 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?
Ans  : Source

Ques : Which property of the form changes the form's title?
Ans  : Caption

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

Ques : Which event occurs only once in the entire life cycle of an ActiveX control?
Ans  : Initialize

Ques : The _______ function enables a VB application to make use of the idle time and to respond periodically to events.
Ans  : DoEvents

Ques : Which object is used for error handling?
Ans  : Err

Ques :Which of the following approaches to data modifications is the least efficient?
Ans  : An update statement executed directly

Ques :  How can you keep the user from exiting a form by clicking the Close button?
Ans  : Place code in the Unload eventIn order to provide a transparent background to the Form, you must change the _________  property to _______.

Ques : In order to provide a transparent background to the Form, you must change the _________  property to _______.
Ans  : BackStyle, Transparent

Ques : What does the controls collection contain?
Ans  : A list of all controls on a form

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

Ques : Which three methods does the collection object support?
Ans  : Add, Remove, Item

Ques : 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:
Ans  : Cancel parameter to a non-zero value

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

Ques : Which of the following procedure types will execute when you assign a value to a property of an object?
Ans  : Property Assign

Ques : Which line of code listed here can be used to create a string of fixed length:
Ans  : None of the above

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

Ques : Which is the only event of the timer control?
Ans  : Timer

Ques : What you must do before you make calls to an ActiveX DLL project in the same Project Group?
Ans  :  Check the DLL off in your project's Reference List

Ques : The _______ property changes the tab order at runtime:
Ans  : Tab index

Ques : Message Boxes can hold a maximum of _______ characters.
Ans  : 1024

Ques : To store pictures in an array, Visual Basic provides the _____ control.
Ans  : ImageList

Ques : Which of the following situations would not cause the Initialize event of an ActiveX control to occur?
Ans  : When a control is placed on a form at design time

Ques :  You want to display the code and the description of an error. What would be the correct syntax?
Ans  : Msgbox err.number & err.description

Ques : How do you create a read only property in a form?
Ans  : Create only a Property Get procedure

Ques : Which of the following is an event of the Shape control?
Ans  : A shape control does not have events

Ques : Labels do not respond to _____ and ______ events.
Ans  : Got_Focus , Lost_Focus

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

Ques : What data type is the HelpContextID?
Ans  : Integer

Ques : The Kill command in Visual Basic is used for:
Ans  :  Deleting files

Ques : A prepared statement is:
Ans  : Query text cached on the client

Ques : Which of the following statements should you write to cause the component to fire an event?
Ans  : RaiseEvent

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

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

Ques : 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
Ans  : Only (i) is correct

Ques : Variables that allow sharing of values across event procedures are called:
Ans  : Module level variable

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

Ques : How do you make a control gray and inaccessible in VB?
Ans  : Set enabled to false

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

Ques : Which of the following is the only valid Resume statement in an error handler?
Ans  : Resume next

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

Ques : 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:
Ans  : DataSource

Ques : One can convert a Visual Basic Application into ActiveX Document using:
Ans  : ActiveX Document Migration Wizard

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

Ques : Which events enable you to determine which key was pressed by the user?
Ans  : KeyPress, KeyUp and KeyDown

Ques : Only Controls with a ________ property such as Picturebox, Toolbox, Statusbar etc. can be placed on an MDI form:
Ans  :  BorderStyle = 0

Ques : How many root nodes can a TreeView control have?
Ans  : No limit

Ques : 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:
Ans  : ZOrder property

Ques : What is the default value for the scalemode property of the form?
Ans  : Twip

Ques : Which of the following ADO recordset types provides the greatest degree of concurrency?
Ans  : Dynamic

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

Ques : The _______ property enables Visual Basic to draw complete images in memory before displaying them on the Screen.
Ans  : AutoRedraw = True

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

Ques : Which event is fired when a text box loses focus?
Ans  : LostFocus

Ques : What do CurrentX and CurrentY return?
Ans  : Current X and Y co-ordinates of mousepointer

Ques : Which property of the ProgressBar determines how much of the bar is filled?
Ans  : CurrentVal

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

Ques : Which of the following cannot be included in the Open method of the recordset?
Ans  : User Name

Ques : The caption and the name properties of the command button:
Ans  : Can be different at times

Ques : Which of the following statements forces inline error handling?
Ans  :  None of the above

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

Ques : Which of the following can be shown to the user using the Common Dialog control in VB?
Ans  :  Open dialog box

Ques : 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$)
Ans  : The Caption of Form1 will not change

Ques : Visual Basic fires the _______ event everytime a part of the form         is newly exposed.
Ans  : Paint

Ques : What does the forms collection contain?
Ans  : A list of all forms in a project

Ques : 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
Ans  : You do not have the permission to access the class

Ques : What is the sequence of events when a form is unloaded?
Ans  : Unload only

Ques :  In order to change the mouse pointer shape from glass to watch-glass, the property to be used is:
Ans  :  MousePointer

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

Ques : Which of the following are not properties of Command Button:
Ans  : Multi-Line

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

Ques : The interval property of the Timer control specifies the time in:
Ans  : Milliseconds

Ques : Which of the following compiled elements does not run in process?
Ans  : Standard DLL

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

Ques :  Global Procedures and Global Variables are declared in:
Ans  : Standard (Code) Modules

Ques : What is the sequence in which the following events are triggered when a form is loaded?
Ans  : Initialize, Load, Resize and Paint

Ques :  An ADO dynamic property is:
Ans  : A property that changes value at runtime

Ques : Which event is triggered when the user moves to another open form?
Ans  : Deactivate

Ques : 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.
Ans  : Locked

Ques : In order to access a file in Non-textual format, you have to open file in:
Ans  : Binary Format

Ques : The vbCritical symbol displays:
Ans  :  A critical message icon

Ques : To save a file in a RichTextBox Control and a picture in a Picture Box Control, you will use the _________ and __________ statements, respectively:
Ans  : RichText1.SaveFile, Picture1.SavePicture

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

Ques : Which line of the following code contains an error?

1      public Sub Command1_Click()
2        Dim str As String
2        str = "Hello World"
3        i = val (str)
4        length = strlen(str)
5        Msgbox "No Of Characters in " & str & " = " & CSstr(length)
6      End Sub
Ans  : Error on line 3

Ques : Visual Basic displays information depending upon the current value of two properties of the form, called as:
Ans  : LeftX and LeftY

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

Ques : What is the purpose of the Class Builder add-in in Visual Basic:
Ans  : To create new classes and define their properties, methods & events

Ques : Which events allow you to determine if a Control or Shift key was pressed by the user?
Ans  : KeyPress, KeyUp and KeyDown

Ques : You can create menus by the ________ and _________.
Ans  : Menu Editor, Application Wizard