VB Interview Questions

  1. How do you center a form?
  2. Can I send keystrokes to a DOS application?
  3. Convert an RGB value to a long, or a long to RGB.
  4. Implement smooth scrolling for either text, graphics or controls across a form.
  5. Implement some quick and easy encryption (can be something primitive).
  6. 4 different types of sorts: advantages and disadvantages.
  7. Compute CRC32 checksum, write a quick piece of code that accepts the packet of data and returns the CRC.
  8. How do you use the Mouse OFF event?
  9. How do I call Windows Help files from a VB program?
  10. How do I create a textbox that lets you insert tabs?
  11. How do I make text box that displays asterisks when the user types in data such as password?
  12. How do I create multi-column combo box?
  13. How do I make a menu popup from a CommandButton?
  14. How to create menus at run time in VB?
  15. Write a generic error handling routine.
  16. How to copy text to the Windows clipboard and from it.
  17. How can I call a Command button without clicking it?
  18. Write a simple app with Encrypt and Decrypt buttons and Textbox where the user can enter text for encryption and decryption.
  19. 3 main differences between flexgrid control and dbgrid control
  20. ActiveX and Types of ActiveX Components in VB
    Advantage of ActiveX Dll over ActiveX Exe .
  21. Advantages of disconnected recordsets . Benefit of wrapping database calls into MTS transactions 6. Benefits of using 23 MTS
  22. Can database schema be changed with DAO, RDO or ADO?
  23. Can you create a tabletype of recordset in Jet-connected ODBC database engine?
  24. Constructors and destructors
  25. Controls which do not have events
  26. Default property of datacontrol
  27. Define the scope of Public, Private, Friend procedures?
  28. Describe Database Connection pooling relative to MTS
  29. Describe: In of Process vs. Out of Process component. Which is faster?
  30. Difference between a function and a subroutine, Dynaset and Snapshot, early and late binding, image and picture controls, linked object and embedded Object,listbox and combo box,Listindex and Tab index,modal and moduless window, Object and Class, query unload and unload in form, declaration and instantiation of an object?
  31. Draw and explain Sequence Model of DAO
  32. How can objects on different threads communicate with one another?
  33. How can you force new objects to be created on new threads?
  34. How does a DCOM component know where to instantiate itself?
  35. How do I register a component?
  36. How do I set a shortcut key for label?
  37. What kind of components can be used as DCOM servers?
  38. Name of the control used to call a Windows application
  39. Name the four different cursor and locking types in ADO and describe them briefly
    Need of zorder method, no of controls in form, Property used to add a menus at runtime, Property used to count number of items in a combobox,resize a label control according to your caption.
  40. Return value of callback function, The need of tabindex property
  41. Thread pool and management of threads within a thread pool
  42. To set the command button for ESC, Which property needs to be changed?
  43. Type Library and what is it’s purpose?
  44. Types of system controls, container objects, combo box
  45. Under the ADO Command Object, what collection is responsible for input to stored procedures?
  46. What are the ADO objects? Explain them.
  47. What are the different compatibility types when we create a COM component?
  48. What do ByVal and ByRef mean and which is the default?
  49. What does Option Explicit refer to? 36. What does the Implements statement do?
  50. What is OLE and DDE? Explain.
  51. What is the difference between Msgbox Statement and MsgboxQ function?
  52. What keyword is associated with raising system level events in VB?
  53. What methods are called from the ObjectContext object to inform MTS that the transaction was successful or unsuccessful?
  54. What types of data access have you used.
  55. What was introduced to Visual Basic to allow the use of Callback Functions?
  56. Which controls can not be placed in MDI?
  57. Which controls have refresh method, clear method
  58. Which Property is used to compress a image in image control?
  59. Which property of menu cannot be set at run time?
  60. Which property of textbox cannot be changed at runtime?
  61. What is the maximum size of a textbox?
  62. Which tool is used to configure the port range and protocols for DCOM communications?



4 comments:

  1. first 20 answers:

    1. Center a form:

    Private Sub Form_Load()
    Me.Move (Screen.Width - Me.Width) \ 2, _
    (Screen.Height - Me.Height) \ 2
    End Sub

    2. Keystrokes to DOS?

    Yes, SendKeys sends keystrokes to the currently active window.

    3. RGB to Long? Long to RGB?

    Value = RGB(Red, Green, Blue)

    Red = Value And &HFF
    Green = (Value And &HFF00&) \ &H100&
    Blue = (Value And &HFF0000) \ &H10000

    4. Implement smooth scrolling?

    Scrolling is simply movement in very small increments applied
    fairly rapidly. The smallest noticeable increment value is
    movement by one pixel. Text, graphics, or controls rapidly and
    repeatedly moved in a single direction by one pixel each move
    will appear to be moving smoothly.

    5. Encrypt text.

    Function Encrypt(Text As String, Password As String)
    Dim idx As Long, key As Long
    key = (Int(Sqr(Len(Password) * 95)) + 21)
    Encrypt = Space$(Len(Text))
    For idx = 1 To Len(Text)
    Mid(Encrypt, idx, 1) = Chr$(Asc(Mid(Text, idx, 1)) Xor key)
    Next
    End Function

    6. Sort comparisons

    NAME: Advantage (Disadvantage) - SL = Small Lists, LL = Large Lists

    INSERTION: Simple, fast for SL (Slow for LL)
    BUBBLE: Fast for lists almost sorted (Slow for all other lists)
    QUICK: Fast for LL (Trouble with duplicates)
    MERGE: Fast for LL, paging friendly (Requires scratch memory)

    7. CRC32

    See: http://www.freevbcode.com/ShowCode.Asp?ID=655

    8. Mouse OFF?

    There is no MouseOff event.

    9. Call Help?

    The Common Dialog control’s ShowHelp method is the
    Microsoft recommended way of calling Help topics.

    10. Allow tabs?

    Set the textbox’s MultiLine property to True.

    11. Display * ?

    Set the textbox’s PasswardChar property to “*”.

    12. Multi-column Combobox?

    Creating your own control allows for many properties
    and methods not found on the standard VB controls. One
    method might include using the ListView as the drop down
    list of a custom combobox.

    13. Popup Menu?

    Use the PopupMenu statement from the command button’s
    MouseDown event.

    14. Create runtime menus?

    Design your menus as control arrays and use the Load
    statement to add more menus.

    15. Generic error handler?

    Public Sub SomeRoutine()
    On Error GoTo Handler
    ‘ trapped code added here
    SubExit:
    Exit Sub
    Handler:
    MsgBox Err.Description, , “Error in processing”
    Resume SubExit
    End Sub

    16. Clipboard text?

    ‘ To
    Clipboard.SetText Text, vbCFText
    ‘ From
    If Clipboard.GetFormat(vbCFText) Then
    Text = Clipboard.GetText
    End If

    17. Call a command button click event?

    Command1.Value = True

    18. Write an app to Encrypt & Decrypt

    One such application would be to include asyncronous
    encryption which provides one routine for both
    encryption and decryption. An example of asyncronous
    encryption follows:

    Public Function Crypt(Text As String) As String
    Dim idx As Long, vlu As Long

    Crypt = Text
    For idx = 1 To Len(Text)
    vlu = Asc(Mid$(Text, idx, 1))
    Select Case vlu
    Case 32 To 127
    Mid(Crypt, idx, 1) = Chr$(128 - vlu)
    Case Else
    End Select
    Next

    End Function

    19. Flexgrid vs DBGrid?

    1. User interface
    2. Data source
    3. Formatting methods

    20. ActiveX ?

    ActiveX is the technology used by Microsoft to
    identify programmable components of an application.
    The three main types of ActiveX components include
    ActiveX EXE (Stand-alone, out-of-process), ActiveX
    DLL (in-process), and the ActiveX Control (.ocx).

    ReplyDelete
  2. The maximum length of text box is 65535. This is abosultly correct.

    ReplyDelete
  3. –>What is the difference between Msgbox Statement and MsgboxQ function?
    ans : Msgbox is the inbuild function in vb and MsgboxQ is the function developed by the programmer to complete his task.

    –>Which controls have refresh method, clear method ?
    ans: list box, combo box
    –>Which property of menu cannot be set at run time?
    ans : name
    –> Which property of textbox cannot be changed at runtime?
    ans : name
    –> difference in query unload and unload in form
    ans : in query unload event we can find how the user is closing the form eg via cross(x)button in right top corner or thr’ control menu etc which is the one step before unload of form

    ReplyDelete
  4. Answer for Q48.
    ADO Objects
    Mian Three Objects are
    1)Connection Object:Resposible for establishing the connection with database.
    2)Command Object:Responsible for executing the quries against the database.
    3)Recordset Object :Used to store the result which we get from executing the quries.

    ReplyDelete