VB interview questions and answers

  1. What is the method for returning more than one values from a function in VB?
  2. What is early-binding and late-binding? Does ASP support early-binding?
  3. Difference between T-SQL and PL/SQL?
  4. How can a COM object be modified in VB?
  5. What is Byval and ByRef in VB? And how does it work?
  6. Have you used inner join? How does it work? What is in the resultset? Rows from 1st table or 2nd table?
  7. What is disconnected mode?
  8. How is the error handling in stored proc of T-SQL?
  9. What is Transcaction?
  10. What is clustered index and non-clustered index? How many clustered indexes and non-clustered indexes can be created in one table?
This entry was posted in VB, Web dev, Windows. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

5 Comments on VB interview questions and answers

  1. Posted 4/9/2006 at 2:56 pm | Permalink

    1) 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?

    a. Number
    b. Description
    c. CompName
    d. Component
    e. Source
    f. Text
    g. Desc
    h. None of the above

    2) If the Cancel Error Property of the CommonDialog Box is set to true then which of the following statement is true:

    a. A runtime error can result if the user clicks the cancel button
    b. A compile time error occurs
    c. The program executes without any error
    d. You need to carry out conditional compilation
    e. None of the above
    3) What is the extension of the Visual Basic project file that stores the design of a user control.

    a. .ctx
    b. .ctl
    c. .ctr
    d. .ocx
    e. .vbp
    f. .dll
    g. .ucl
    h. .utl

    4) A __________ control defaults to displaying the files in the current directory:

    a. File List Box
    b. Dir List Box
    c. Drive List Box
    d. Combo Box
    e. Picture Box
    f. List Box
    g. Combo Box
    h. DataGrid

    5) To destroy an object and free the memory space occupied by it, the keyword used is:

    a. Delete
    b. Kill
    c. Nothing
    d. New
    e. Calloc
    f. New
    g. Conserve
    h. Free

    6) Which event of a text box would you use for validating the data entered by the user?

    a. Validate
    b. Validation
    c. Check
    d. Audit
    e. GotFocus
    f. Checkdata
    g. ValidateDate

    7) Which of the following statements forces inline error handling?

    a. On Error GoTo linelabel
    b. On Error GoTo Inline
    c. On Error Stop
    d. On Error Resume Next
    e. On Error GoTo 0
    f. On Error Resume
    g. None of the above

    8) The _______ method resets the contents of bound controls to their original values when the user clicks on the cancel button.

    a. UpdateControls
    b. PaintPicture
    c. Refresh
    d. Resize
    e. Resync
    f. Restore
    g. Cancel
    h. Update
    9) 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:

    a. Cancel parameter to a non-zero value
    b. Cancel parameter to 0
    c. UnloadMode parameter to a non-zero value
    d. UnloadMode parameter to a zero value
    e. UnloadMode parameter to 1
    f. Cancel parameter to 1

    10) How many root nodes can a TreeView control have?

    a. 1
    b. 2
    c. 3
    d. 4
    e. 5
    f. 10
    g. Upto 50
    h. No limit

    11) A project group is a Project which:

    a. Consists of several Programs
    b. Consists of several Applications
    c. Consists of Various Forms And Code Modules
    d. Consists of several Projects

    12) Procedures declared in a _____ are local whereas procedures declared in a ______ are available to the whole application.

    a. Form window, standard or code module
    b. Project window, view code window
    c. Class module, code module

    13) How can you keep the user from exiting a form by clicking the Close button?

    a. Place code in the Terminate event
    b. Place code in the Unload event
    c. Place code in the QueryUnload event
    d. This can only be done by using the Windows API
    e. Place code in the Load event
    f. Place code in the Terminate event
    g. Place code in the Deactivate event
    h. None of the above
    14) In order to provide a transparent background to the Form, you must change the _________ property to _______.

    a. BackStyle, Opaque
    b. BackColor, White
    c. BackStyle, Transparent
    d. BackColor, Parent Window’s Color
    e. ZOrder, 0
    f. BackColor, Transparent

    15) The _______ property enables Visual Basic to draw complete images in memory before displaying them on the Screen.

    a. AutoRedraw = True
    b. AutoRedraw = False
    c. Refresh
    d. PaintPicture

    16) You want to display the code and the description of an error. What would be the correct syntax?

    a. Msgbox err.no & err.text
    b. Msgbox err.number & err.text
    c. Msgbox error.number & error.text
    d. Msgbox error.number & error.description
    e. Msgbox err.number & err.description
    f. Msgbox err.num & err.description
    g. Msgbox err.num & err.text
    h. None of the above

    17) What is the purpose of the Image List Control?

    a. To display images to the user
    b. To help in creating a ToolBar
    c. To allow the editing of icons
    d. To provide a repository for images used by other controls
    e. To provide images to the listbox control
    f. To provide images for the splash screen
    g. To provide icons for error messages

    18) Which method would you use to get a free or unused File identifier while opening any file:

    a. FreeFile
    b. GetFileNum
    c. GetFile
    d. GetBytes
    e. NextFile
    f. File
    g. GetNextFile
    h. None of the above

    19) Which property procedure is used to retrieve the value of a property?

    a. Retrieve
    b. Get
    c. GetProperty
    d. Value
    e. RetrieveValue

    20) Which of the following can be shown to the user using the Common Dialog control in VB?

    a. Common messages passed to Windows
    b. Open dialog box
    c. Windows explorer
    d. Input box
    e. Message box
    f. Error messages
    g. Help
    h. None of the above

    21) Which event is triggered when the user moves to another open form?

    a. Unload
    b. QueryUnload
    c. Deactivate
    d. Terminate
    e. Load
    f. Initialize
    g. Repaint
    h. Resize

    22) Which event of an ActiveX control data provider runs every time a bound control extracts data through the provider?

    a. GetDataMember
    b. GetDataField
    c. GetDataProperty
    d. GetDataRow
    e. GetData
    f. GetFields
    g. GetRows
    h. RetrieveData

    23) Which of the following are not properties of Command Button:

    a. Caption
    b. Visible
    c. Multi-Line
    d. Font
    e. Name
    f. Bold
    g. Tag
    h. Enabled

    24) 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?

    a. Err.Raise vbObjectError + 20000
    b. Err.Number = 20000
    c. Err.Raise 20000
    d. Err.Raise vbObjectError,20000
    e. Err.Number 20000
    f. Error.Raise vbObjectError + 20000
    g. Error.Number 20000
    h. Error.Raise 20000

    25) Which events enable you to determine which key was pressed by the user?

    a. Click and KeyPress
    b. Click, KeyUp and KeyDown
    c. KeyUp and KeyDown
    d. KeyPress, KeyUp and KeyDown
    e. Click, KeyPress, KeyUp and KeyDown

    26) In order to access a file in Non-textual format, you have to open file in:

    a. Ascii Format
    b. Binary Format
    c. Input Mode
    d. Output mode
    e. Append mode
    f. Read Mode

    27) Visual Basic displays information depending upon the current value of two properties of the form, called:

    a. CurrentX and CurrentY
    b. ScaleLeft and ScaleTop
    c. ScaleHeight and ScaleTop
    d. x and y
    e. TopX and TopY
    f. LeftX and LeftY

    28) Which of the following procedure types will execute when you assign a value to a property of an object?

    a. Property Get
    b. Property Assign
    c. Property Let
    d. Property Set
    e. Public Sub

    29) 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:

    a. Background color property
    b. Caption property
    c. ZOrder property
    d. AutoRedraw property
    e. SendtoBack property
    f. BringtoFront property
    g. Hide property
    h. Show property

    30) Name the only property supported by a collection?

    a. Name
    b. Index
    c. Count
    d. Type
    e. Value
    f. Add
    g. Remove
    h. None of the above

    31) Which of the following situations would not cause the Initialize event of an ActiveX control to occur?

    a. When a control is placed on a form at design time
    b. When a form designer containing a control is closed
    c. When a form is run
    d. When a compiled application containing a control executes
    e. When an application terminates and re-enters design-time for the host application

    32) Which event occurs only once in the entire life cycle of an ActiveX control?

    a. Initialize
    b. Resize
    c. Terminate
    d. WriteProperties
    e. InitProperties
    f. Activate
    g. None of the above

    34) 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?

    a. 1-1000
    b. 0-255
    c. 1-65535
    d. 0-1000
    e. 513-65535
    f. 1000-2000
    g. 10000-20000
    h. None of the above

    35) Which property of the ProgressBar determines how much of the bar is filled?

    a. Min
    b. Max
    c. Value
    d. CurrentVal
    e. FillValue
    f. Fill
    g. BarComplete

    36) The ______ function can be used to run any .com, .exe, .bat or .pif file from a Visual Basic program.

    a. Shell
    b. Substr
    c. SetAttr
    d. CStr
    e. Exec
    f. Perform
    g. Do
    h. None of the above

    37) One can convert a Visual Basic Application into ActiveX Document using:

    a. Visual Database Manager
    b. Application Wizard
    c. ActiveX Document Migration Wizard
    d. Package and Deployment Wizard

    38) The caption and the name properties of the command button:
    a. Are one and the same
    b. Can be different at times
    c. Are actually not properties

    39) 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
    a. You do not need to use the Set command here
    b. You do not have the permission to access the class
    c. MyVar has not been declared
    d. You do not need to use the New keyword here
    e. None of the above

    40) Which of the following will perform a direct execution of a Command object?

    a. The Execute method
    b. The Prepare method
    c. The ExecDirect method
    d. The Open method
    e. The Exec method
    f. The ExecProcedure method
    g. None of the above

    41) The vbCritical symbol displays:

    a. A warning query icon
    b. A critical message icon
    c. A warning message icon
    d. An exclamation icon
    e. None of the above

    42) What does the forms collection contain?
    a. A list of all forms in a project
    b. A list of all hidden forms
    c. A list of all currently loaded forms
    d. A list of all visible forms
    e. All the child forms of an MDI application

    43) Which method of the Recordset object should you use to navigate multiple recordsets returned by a stored procedure?
    a. NewRecordset
    b. NavigateRecordset
    c. OpenNextRecordset
    d. NextRecordset
    e. SkipRecordset
    f. PreviousRecordset
    g. JumpRecordset
    h. GoTORecordset
    44) Which of the following cannot be included in the Open method of the recordset?
    a. Cursor Type
    b. User Name
    c. Active Connection
    d. CursorLocation
    e. LockType
    f. Source
    45) The settings for the Color properties in Visual Basic are indicated by:
    a. Decimal Coding
    b. Octal Coding
    c. Hexadecimal Coding
    d. Binary Coding

    46) What you must do before you make calls to an ActiveX DLL project in the same Project Group?
    a. Compile the DLL
    b. Check the DLL off in your project’s Reference List
    c. Make sure the DLL is the Startup Project
    d. Ensure that a Standard Exe form is included and is made the Startup Form.

    47) The _______ property changes the tab order at runtime:

    a. Tab stop
    b. Tab key
    c. Tab order
    d. Tab index

    48) What do CurrentX and CurrentY return?

    a. Current X and Y co-ordinates of mousepointer
    b. Current X and Y co-ordinates of cursor
    c. A String of X & Y
    d. Current x and y co-ordinates of the control

    49) The Kill command in Visual Basic is used for:

    a. Stopping the current process
    b. Deleting files
    c. Terminating the application
    d. Stopping the current thread
    e. Debugging the application
    f. Error handling
    g. None of the above

    50) 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.

    a. Caption
    b. ClipControls
    c. UseMnemonic
    d. LinkMode
    e. Locked
    f. Label
    g. ZOrder
    h. Visible

    51) Which of the following is the only drag related event?

    a. DragEnter
    b. DragLeave
    c. DragStart
    d. DragStop
    e. DragDrop
    f. BeginDrag
    g. EndDrag
    52) Which property of the form changes the form’s title?

    a. Name
    b. Heading
    c. Title
    d. Caption
    e. Logo

    53) Labels do not respond to _____ and ______ events.

    a. Got_Focus , Lost_Focus
    b. Click , DblClick
    c. Dragdrop , OLECompleteDrag
    d. Change, Link Error

    54) Which of the following statements is capable of abandoning a series of modifications made to a recordset locked with a BatchOptimistic lock?

    a. CancelUpdate
    b. CancelBatch
    c. CancelBatchUpdate
    d. AbandonBatch
    e. AbandonBatchUpdate
    f. Rollbackupdate
    g. Rollbackbatch
    h. None of the above

    55) Which three methods does the collection object support?
    a. Let, Get, Set
    b. Load, Unload, Count
    c. Add, Remove, Item
    d. Add, Delete, Index
    e. Add, Remove, Sort
    f. Add, Remove, Count
    g. Add, Delete, Count
    h. Add, Set, Count

    56) Which line of code listed here can be used to create a string of fixed length:

    a. Dim strFirstName as String
    b. strFirstName * 255
    c. strFirstName = 255
    d. Dim strFirstName as String(255)
    e. None of the above

    57) 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

    a. Both (i) and (ii) are correct
    b. Only (i) is correct
    c. Only (ii) is correct
    d. (i) contains a logical error
    e. (ii) contains an error
    f. Both (i) and (ii) contain errors

    58) Which property of the Err object returns the numeric value associated with the most recent runtime error?

    a. Description
    b. No
    c. Number
    d. Source
    e. Errorcode
    f. Num
    g. Code

    59 ) In Visual Basic, which method can you use to send key strokes to other Window applications?
    a. AppActivate
    b. SendKeys
    c. Copying the contents from the ClipBoard & pasting
    d. Manually typing in the other application’s Window

    60) The ______ property is used to show Tool Tips or Help Balloons when the mouse rests on the object:

    a. ToolTipText
    b. Tag
    c. Dragmode
    d. ShowTips
    e. Help
    f. Tip
    g. ShowHelp
    h. Tab

    61) What is the sequence in which the following events are triggered when a form is loaded?

    a. Initialize, Load, Resize and Paint
    b. Initialize, Load, Paint and Resize
    c. Load, Initialize, Resize and Paint
    d. Load, Initialize, Paint and Resize
    e. Initialize, Resize, Paint and Load
    f. Load, Paint,Initialize and Resize
    g. Initialize, Paint, Load and Resize
    h. Paint, Resize, Initialize and Load

    62) Which parameter of the WriteProperty method can be omitted but should be included to increase the efficiency of the control?

    a. Name
    b. Value
    c. Caption
    d. PropBag
    e. DefaultValue
    f. Title
    g. Tag
    h. None of the above

    63) Message Boxes can hold a maximum of _______ characters.

    a. 256
    b. 512
    c. 1024
    d. 2046
    e. 4092
    f. 5000
    g. 10000
    h. No limit

    64) Which parameter of the Execute method of the Connection object returns the number of records that the operation affected?

    a. RecordsAffected
    b. RowsAffected
    c. RecordsUpdated
    d. RowsOperated
    e. RecordsOperated

    65) Which of the following is not an element of the ADO model?
    a. Database
    b. Error
    c. Connection
    d. Parameter
    e. Recordset
    f. Field
    g. Driver

    66) What data type is the HelpContextID?

    a. String
    b. Integer
    c. Single
    d. Double
    e. Long
    f. Char
    g. Float

    67) Variables that allow sharing of values across event procedures are called:

    a. Form level variable
    b. Object variable
    c. Module level variable

    68) Which property of the ListView control determines which field a sort is based on?

    a. Sorted
    b. SortKey
    c. SortOrder
    d. SortField
    e. Sort
    f. Key
    g. ListKey
    h. None of the above

    69) 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$)

    a. The Caption of Form1 will change to the value contained in Y$
    b. The Caption of Form1 will not change
    c. The Caption changes at random intervals after the function call
    d. The code is incorrect

    70) Visual Basic fires the _______ event everytime a part of the form is newly exposed.

    a. Load
    b. Activate
    c. Paint
    d. Show
    e. Initialize

    71) Which of the following ADO recordset types provides the greatest degree of concurrency?

    a. Static
    b. Forward-only
    c. Dynamic
    d. Keyset
    e. Read only
    f. Keyset and Dynamic

    72) Which of the following is the only valid Resume statement in an error handler?

    a. Resume prior
    b. Resume previous
    c. Resume later
    d. Resume next
    e. Resume before
    f. Resume to
    g. Resume statement
    h. Resume application

  2. Posted 4/30/2006 at 6:17 am | Permalink

    Q. How to use Shell function??

  3. Mamatha
    Posted 8/10/2006 at 12:35 am | Permalink

    Answer:
    1. More than one value can be returned from a function using the output parameters

  4. Mamatha
    Posted 8/10/2006 at 12:54 am | Permalink

    Answer:
    2. An object is early bound when it is assingned to a variable declared as a specific object type.Compiler allocates memory and performs other optimizations befor an app executes in early binding.

    An object is late bound when it is assigned to a variable declared to be of type Object.

    **** If anyone knows if asp supports early binding. please let me know!!!

  5. sauce
    Posted 10/28/2006 at 4:17 pm | Permalink

    ASP does not support early binding but ASP.net does.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*