Visual Basic

  1. Which of the following is the correct file extension for a VB.NET source file?
    A) .vb
    B) .vbn
    C) .bas
    D) .net
    Answer: A
  2. Which keyword is used to declare a variable in VB.NET?
    A) Var
    B) Dim
    C) Let
    D) Declare
    Answer: B
  3. Which data type is used to store decimal values with high precision?
    A) Double
    B) Float
    C) Decimal
    D) Single
    Answer: C
  4. What is the default value of a Boolean variable?
    A) True
    B) False
    C) Null
    D) 0
    Answer: B
  5. Which operator is used for string concatenation?
    A) +
    B) &
    C) *
    D) ||
    Answer: B
  6. Which keyword is used to define a method?
    A) Method
    B) Function
    C) Sub
    D) Define
    Answer: C
  7. Which keyword returns a value from a function?
    A) Return
    B) Exit
    C) End
    D) Stop
    Answer: A
  8. Which loop executes a block of code a fixed number of times?
    A) While
    B) Do While
    C) For
    D) Do Until
    Answer: C
  9. Which statement is used for decision making?
    A) If…Then
    B) For
    C) Loop
    D) While
    Answer: A
  10. Which control is used to accept user input?
    A) Label
    B) Button
    C) TextBox
    D) Panel
    Answer: C
  11. Which event is triggered when a form loads?
    A) Click
    B) Load
    C) Start
    D) Initialize
    Answer: B
  12. Which keyword is used to declare a constant?
    A) Dim
    B) Static
    C) Const
    D) Fixed
    Answer: C
  13. What is the purpose of Option Explicit?
    A) Disable variables
    B) Force variable declaration
    C) Enable loops
    D) Optimize code
    Answer: B
  14. Which keyword is used for inheritance?
    A) Implements
    B) Inherits
    C) Extends
    D) Uses
    Answer: B
  15. Which type is used for storing text?
    A) Char
    B) String
    C) Text
    D) Varchar
    Answer: B
  16. Which keyword is used to create an object?
    A) New
    B) Create
    C) Instance
    D) Object
    Answer: A
  17. Which control displays static text?
    A) TextBox
    B) Label
    C) Button
    D) ListBox
    Answer: B
  18. Which property is used to change text of a control?
    A) Value
    B) Text
    C) Caption
    D) Content
    Answer: B
  19. Which method displays a message box?
    A) Show()
    B) MessageBox()
    C) MsgBox()
    D) Alert()
    Answer: C
  20. Which data type is used for whole numbers?
    A) Integer
    B) Float
    C) Double
    D) Decimal
    Answer: A
  21. Which keyword is used for looping until condition is false?
    A) Do While
    B) Do Until
    C) While
    D) Loop Until
    Answer: B
  22. Which keyword is used to terminate a program?
    A) End
    B) Stop
    C) Exit
    D) Close
    Answer: A
  23. Which structure handles multiple conditions?
    A) If
    B) Switch
    C) Select Case
    D) Loop
    Answer: C
  24. Which keyword is used to define class?
    A) Class
    B) Object
    C) Struct
    D) Module
    Answer: A
  25. Which keyword is used to declare array?
    A) Array
    B) Dim
    C) List
    D) Var
    Answer: B
  26. Which function returns length of string?
    A) Size()
    B) Len()
    C) Count()
    D) Length()
    Answer: B
  27. Which symbol denotes comments in VB.NET?
    A) //
    B) #
    C) ‘
    D) /* */
    Answer: C
  28. Which keyword exits a procedure?
    A) End
    B) Exit
    C) Stop
    D) Return
    Answer: B
  29. Which property sets background color?
    A) Color
    B) BackColor
    C) BgColor
    D) FillColor
    Answer: B
  30. Which property defines control size?
    A) Size
    B) Width
    C) Height
    D) Bounds
    Answer: A
  31. Which event occurs on button click?
    A) Press
    B) Click
    C) Select
    D) Enter
    Answer: B
  32. Which keyword defines module?
    A) Class
    B) Module
    C) Structure
    D) Package
    Answer: B
  33. Which type stores single character?
    A) Char
    B) String
    C) Byte
    D) Text
    Answer: A
  34. Which operator is used for comparison?
    A) =
    B) ==
    C) Equals
    D) Compare
    Answer: A
  35. Which property sets control visibility?
    A) Show
    B) Visible
    C) Display
    D) Enable
    Answer: B
  36. Which method clears TextBox?
    A) Clear()
    B) Reset()
    C) Empty()
    D) Remove()
    Answer: A
  37. Which keyword defines structure?
    A) Struct
    B) Structure
    C) Record
    D) Type
    Answer: B
  38. Which loop checks condition first?
    A) Do While
    B) Do Until
    C) For
    D) Loop
    Answer: A
  39. Which keyword is used for logical AND?
    A) &&
    B) And
    C) &
    D) &&&
    Answer: B
  40. Which control shows dropdown list?
    A) ListBox
    B) ComboBox
    C) TextBox
    D) Panel
    Answer: B
  41. Which method adds item to ComboBox?
    A) Add()
    B) Insert()
    C) Append()
    D) Include()
    Answer: A
  42. Which namespace is used for console operations?
    A) System.Console
    B) Console.IO
    C) System.IO
    D) System.Text
    Answer: A
  43. Which method outputs text to console?
    A) Print()
    B) Write()
    C) Show()
    D) Output()
    Answer: B
  44. Which keyword is used for exception handling?
    A) Try
    B) Catch
    C) Finally
    D) All of these
    Answer: D
  45. Which keyword handles exception?
    A) Try
    B) Catch
    C) Finally
    D) Throw
    Answer: B
  46. Which keyword throws exception?
    A) Throw
    B) Catch
    C) Try
    D) Raise
    Answer: A
  47. Which operator is used for NOT?
    A) !
    B) Not
    C) ~
    D) Neg
    Answer: B
  48. Which property sets control font?
    A) Font
    B) Style
    C) TextFont
    D) Format
    Answer: A
  49. Which keyword defines interface implementation?
    A) Interface
    B) Implements
    C) Inherits
    D) Extend
    Answer: B
  50. Which keyword ends a block?
    A) End
    B) Close
    C) Stop
    D) Finish
    Answer: A

Leave a Comment