×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

VB.NET MCQs (Multiple-Choice Questions)

Practice these VB.NET MCQs (Multiple-Choice Questions) with answers and explanations to test your knowledge of Visual Basic .NET programming, including variables, data types, operators, control statements, arrays, procedures, classes, inheritance, interfaces, exception handling, collections, delegates, events, LINQ, and .NET programming concepts.

VB.NET MCQs

These VB.NET multiple-choice questions cover fundamental and intermediate concepts of Visual Basic .NET programming. They are useful for students, developers, interview preparation, competitive examinations, and technical assessments.

List of VB.NET MCQs

The following VB.NET MCQs include both conceptual and code-based questions covering important language features and programming techniques.

1. What does VB.NET stand for?

  1. Visual Basic Network
  2. Visual Basic .NET
  3. Visual Binary .NET
  4. Virtual Basic Network Technology

Answer: B) Visual Basic .NET

Explanation:

VB.NET stands for Visual Basic .NET and is Microsoft's object-oriented programming language for the .NET platform.

2. Which company developed Visual Basic .NET?

  1. Oracle
  2. Microsoft
  3. IBM
  4. Sun Microsystems

Answer: B) Microsoft

Explanation:

Visual Basic is a Microsoft programming language designed for developing applications on the .NET platform.

3. Which keyword is used to declare a variable in VB.NET?

  1. Dim
  2. Var
  3. Declare
  4. Let

Answer: A) Dim

Explanation:

The Dim statement is commonly used to declare variables in VB.NET.

4. Which of the following correctly declares an Integer variable in VB.NET?

  1. Dim age As Integer
  2. Integer age
  3. var age As Integer
  4. Declare age Integer

Answer: A) Dim age As Integer

Explanation:

VB.NET uses the Dim statement followed by the variable name and As keyword to specify its type.

5. Which data type is used to store a Boolean value?

  1. Boolean
  2. Bit
  3. Logical
  4. Flag

Answer: A) Boolean

Explanation:

The Boolean data type represents logical values such as True and False.

6. Which VB.NET data type is commonly used to store a sequence of characters?

  1. String
  2. CharArray
  3. Text
  4. CharacterSet

Answer: A) String

Explanation:

The String type represents a sequence of Unicode characters.

7. Which data type represents a single Unicode character in VB.NET?

  1. Char
  2. Character
  3. SingleChar
  4. TextChar

Answer: A) Char

Explanation:

The Char data type represents a single Unicode character.

8. Which keyword is used to declare a constant in VB.NET?

  1. Const
  2. Constant
  3. Fixed
  4. StaticValue

Answer: A) Const

Explanation:

The Const statement declares a constant whose value cannot be changed after declaration.

9. Which keyword can be used to explicitly specify the type of an expression or variable?

  1. As
  2. Type
  3. With
  4. Define

Answer: A) As

Explanation:

The As keyword is used in declarations such as Dim count As Integer to specify the data type.

10. Which operator is used for assignment in VB.NET?

  1. =
  2. :=
  3. <-
  4. ==

Answer: A) =

Explanation:

VB.NET uses the single equals sign = for assignment and also for equality comparison depending on the context.

11. Which operator is used for integer division in VB.NET?

  1. \
  2. /
  3. DIV
  4. %

Answer: A) \

Explanation:

The backslash operator \ performs integer division in VB.NET.

12. Which operator returns the remainder of a division operation?

  1. Mod
  2. Rem
  3. %
  4. Remainder

Answer: A) Mod

Explanation:

The Mod operator returns the integer remainder after division.

13. Which operator is used for string concatenation in VB.NET?

  1. &
  2. +
  3. .
  4. ||

Answer: A) &

Explanation:

The & operator concatenates strings in VB.NET.

14. Which operator is used for exponentiation in VB.NET?

  1. ^
  2. **
  3. EXP
  4. ^^

Answer: A) ^

Explanation:

The caret operator ^ performs exponentiation in VB.NET.

15. Which keyword is used for a conditional statement in VB.NET?

  1. If
  2. When
  3. Check
  4. Condition

Answer: A) If

Explanation:

The If statement executes code based on whether a Boolean condition evaluates to true.

16. Which statement is used for selecting among multiple values of an expression?

  1. Select Case
  2. Choose Case
  3. Switch Value
  4. Case Select

Answer: A) Select Case

Explanation:

Select Case evaluates an expression and executes the matching Case block.

17. Which loop executes a block of code while a condition is true?

  1. While
  2. Repeat
  3. LoopWhileOnly
  4. During

Answer: A) While

Explanation:

A While loop repeats its statements as long as its condition evaluates to true.

18. Which loop is commonly used to iterate through a numeric range in VB.NET?

  1. For...Next
  2. Loop...Range
  3. Repeat...Next
  4. Range...End

Answer: A) For...Next

Explanation:

The For...Next loop is commonly used when a loop variable progresses through a specified numeric range.

19. Which loop is used to iterate over the elements of a collection or array?

  1. For Each...Next
  2. For Collection
  3. Each Loop
  4. Iterate...End

Answer: A) For Each...Next

Explanation:

For Each...Next iterates through the elements of a collection or array.

20. Which statement immediately exits the current loop in VB.NET?

  1. Exit
  2. Break
  3. StopLoop
  4. EndLoop

Answer: A) Exit

Explanation:

VB.NET uses statements such as Exit For, Exit While, and Exit Do to leave loops.

21. Which keyword skips the remaining statements in the current loop iteration and continues with the next iteration?

  1. Continue
  2. Skip
  3. NextOnly
  4. Resume

Answer: A) Continue

Explanation:

Statements such as Continue For, Continue While, and Continue Do move execution to the next loop iteration.

22. Which keyword is used to declare a procedure that does not return a value?

  1. Sub
  2. Procedure
  3. Void
  4. Method

Answer: A) Sub

Explanation:

A Sub procedure performs an operation but does not return a value as a function does.

23. Which keyword is used to declare a procedure that returns a value?

  1. Function
  2. ReturnMethod
  3. ValueSub
  4. Result

Answer: A) Function

Explanation:

A Function procedure returns a value to the calling code.

24. Which keyword specifies that an argument is passed by reference?

  1. ByRef
  2. Ref
  3. Reference
  4. ByReference

Answer: A) ByRef

Explanation:

The ByRef modifier allows a procedure to access and potentially modify the caller's variable rather than working only with a copy of its value.

25. Which keyword specifies that an argument is passed by value?

  1. ByVal
  2. ByValue
  3. Value
  4. Copy

Answer: A) ByVal

Explanation:

The ByVal modifier passes the argument by value, so assignment to the parameter does not directly replace the caller's variable.

26. Which keyword is used to define a class in VB.NET?

  1. Class
  2. Object
  3. TypeClass
  4. DefineClass

Answer: A) Class

Explanation:

The Class statement defines a reference type that can contain fields, properties, methods, events, and other members.

27. Which keyword is used to create an object instance in VB.NET?

  1. New
  2. Create
  3. Instance
  4. Object

Answer: A) New

Explanation:

The New keyword is used to create an instance of a class or another type that supports construction.

28. Which procedure is used as a constructor in a VB.NET class?

  1. Sub New
  2. Constructor
  3. Init
  4. Create New

Answer: A) Sub New

Explanation:

Sub New defines a constructor that runs when an instance of the class is created.

29. Which keyword is used to inherit from a base class in VB.NET?

  1. Inherits
  2. Extends
  3. Derives
  4. Base

Answer: A) Inherits

Explanation:

The Inherits statement specifies the base class from which a class derives.

30. Which keyword is used to implement an interface in VB.NET?

  1. Implements
  2. Interface
  3. ImplementsFrom
  4. Uses

Answer: A) Implements

Explanation:

The Implements statement identifies the interface or interfaces whose members the class or structure implements.

31. Which keyword prevents a class from being inherited?

  1. NotInheritable
  2. Sealed
  3. FinalClass
  4. NoInherit

Answer: A) NotInheritable

Explanation:

The NotInheritable modifier prevents other classes from inheriting from the class.

32. Which modifier allows a derived class to replace a base class member's implementation?

  1. Overrides
  2. Replace
  3. Overload
  4. Rewrite

Answer: A) Overrides

Explanation:

The Overrides modifier provides a new implementation of an overridable base-class member.

33. Which modifier indicates that a class member can be overridden by a derived class?

  1. Overridable
  2. Virtual
  3. Overrideable
  4. Replaceable

Answer: A) Overridable

Explanation:

The Overridable modifier allows a derived class to override a base class member.

34. Which modifier creates a shared member that belongs to the type rather than a particular object instance?

  1. Shared
  2. Static
  3. Global
  4. Common

Answer: A) Shared

Explanation:

The Shared modifier declares a member that is associated with the type itself rather than a particular instance.

35. Which VB.NET construct is similar to a class but cannot be instantiated as an object?

  1. Module
  2. Namespace
  3. Interface
  4. Enum

Answer: A) Module

Explanation:

A VB.NET module is similar to a class in some ways, but it has exactly one implicit instance and its members are implicitly Shared. A module cannot be instantiated with New.

36. Which statement correctly declares an array containing three Integer values?

  1. Dim numbers() As Integer = {10, 20, 30}
  2. Dim numbers As Integer = {10, 20, 30}
  3. Array numbers Integer = 10,20,30
  4. Dim numbers<Integer> = 10,20,30

Answer: A) Dim numbers() As Integer = {10, 20, 30}

Explanation:

The syntax declares an Integer array and initializes it with three elements.

37. Which property returns the number of elements in a VB.NET array?

  1. Length
  2. Count
  3. Size
  4. Elements

Answer: A) Length

Explanation:

The Length property returns the total number of elements in an array.

38. Which statement is used to resize an array while preserving its existing elements?

  1. ReDim Preserve
  2. Resize Preserve
  3. Array.ResizePreserve
  4. ChangeDim Keep

Answer: A) ReDim Preserve

Explanation:

ReDim Preserve changes the size of an array while preserving its existing elements.

39. Which keyword is used to declare an enumeration in VB.NET?

  1. Enum
  2. Enumeration
  3. Enumerate
  4. Values

Answer: A) Enum

Explanation:

The Enum statement defines a set of named constants.

40. Which structure is a value type in VB.NET?

  1. Structure
  2. Class
  3. Module
  4. Delegate

Answer: A) Structure

Explanation:

A Structure is a value type, whereas a class is a reference type.

41. Which block is used for structured exception handling in VB.NET?

  1. Try...Catch...Finally
  2. Attempt...Handle...End
  3. Error...Catch...Stop
  4. Exception...Handle...End

Answer: A) Try...Catch...Finally

Explanation:

VB.NET supports structured exception handling through Try, Catch, and Finally blocks. .NET exceptions derive from System.Exception.

42. Which keyword is used to explicitly throw an exception in VB.NET?

  1. Throw
  2. Raise
  3. Error
  4. Exception

Answer: A) Throw

Explanation:

The Throw statement is used to explicitly raise an exception object in VB.NET.

43. Which block is executed whether or not an exception occurs?

  1. Finally
  2. Always
  3. Cleanup
  4. End

Answer: A) Finally

Explanation:

The Finally block is used for cleanup code that should run when control leaves the Try statement, including when an exception occurs.

44. Which collection stores key-value pairs in .NET?

  1. Dictionary(Of TKey, TValue)
  2. List(Of T)
  3. Stack(Of T)
  4. Queue(Of T)

Answer: A) Dictionary(Of TKey, TValue)

Explanation:

Dictionary(Of TKey, TValue) stores values indexed by unique keys.

45. Which keyword is used to declare a delegate in VB.NET?

  1. Delegate
  2. FunctionPointer
  3. Callback
  4. MethodReference

Answer: A) Delegate

Explanation:

The Delegate statement defines a reference type that can represent a method with a particular signature.

46. Which keyword is used to declare an event in VB.NET?

  1. Event
  2. Raise
  3. Notify
  4. Signal

Answer: A) Event

Explanation:

The Event statement declares an event that can be raised by a class or other type and handled by subscribers.

47. Which keyword is used to subscribe a procedure to an event in a VB.NET declaration?

  1. Handles
  2. Subscribe
  3. Listen
  4. WithEvent

Answer: A) Handles

Explanation:

The Handles clause associates a procedure with one or more events declared by the specified object or class.

48. Which technology allows VB.NET developers to query collections and data sources using query expressions?

  1. LINQ
  2. ADO Classic
  3. COM Query Language
  4. VB Query Engine

Answer: A) LINQ

Explanation:

LINQ, or Language Integrated Query, provides query capabilities directly within .NET programming languages, including Visual Basic.

49. What is the output of the following VB.NET code?

Dim numbers() As Integer = {10, 20, 30, 40}
Dim total As Integer = 0

For Each n As Integer In numbers
If n > 20 Then
total += n
End If
Next

Console.WriteLine(total)
  1. 30
  2. 50
  3. 70
  4. 100

Answer: C) 70

Explanation:

The condition keeps values greater than 20, which are 30 and 40. Their sum is 70, so the program prints 70.

50. What does the following VB.NET LINQ query return?

Dim numbers() As Integer = {5, 10, 15, 20, 25}

Dim result = From n In numbers
Where n > 10
Select n
  1. 5, 10
  2. 10, 15, 20
  3. 15, 20, 25
  4. 5, 15, 25

Answer: C) 15, 20, 25

Explanation:

The LINQ query filters the array with Where n > 10. Therefore, 15, 20, and 25 satisfy the condition and are returned by the Select clause.

Advertisement
Advertisement

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2026 www.includehelp.com. All rights reserved.