VB.NET MCQs

VB.NET MCQs

These VB.NET multiple-choice questions and their answers will help you strengthen your grip on the subject of VB.NET. You can prepare for an upcoming exam or job interview with these 100+ VB.NET MCQs.
So scroll down and start answering.

1: What is a button's default event type?

A.   Click

B.   MultilineChanged

C.   Tick

D.   MouseMove

2: True or False? A class cannot implement an interface while also inheriting from a base class.

A.   True

B.   False

3: You are using the SQL Transaction class for a series of SQL statements. Where do you attach the SQL Transaction by using BeginTransaction?

A.   Attach to each SQLClient.SQLCommand

B.   Attach to the SQLClient.SQLConnection

4: Which of the method is used to display the form as modal?

A.   Activate( )

B.   Show( )

C.   ShowDialog( )

D.   ShowModal()

E.   LoadDialog()

5: When declaring two methods with the same names but different parameter types, you should use which keyword?

A.   Overrides

B.   Shadows

C.   Overloads

D.   Implements

6: In order to determine whether a dataset has pending modifications to it's data, you would call which method?

A.   Dataset.SyncRequired

B.   Dataset.IsDirty

C.   Dataset.SaveRequired

D.   Dataset.HasChanges

7: ____________ is when objects contain their respective data and code.

A.   Instantiation

B.   Assignment

C.   Modification

D.   Encapsulation

8: Can a Try-Catch-Finally block be nested inside of the Finally section of another Try-Catch-Finally block?

A.   No

B.   Yes

9: What technology allows you to issue SQL-like commands against a collection of objects in VB.Net?

A.   T-SQL

B.   LINQ

C.   WCF

D.   PLINK

10: True or False? The Finally portion of a Try-Catch-Finally block only executes when an error occurs.

A.   False

B.   True

11: When you open a loop with a For statement, you can close the loop with a ___________ statement.

A.   EndLoop

B.   Do

C.   End While

D.   Next

12: What is the base class of all other .Net classes?

A.   system.object

B.   system.base

C.   assembly.root

D.   net.base

13: What object would you use to manipulate a folder?

A.   CreateDirectory

B.   FileLen( )

C.   OpenFileDialog

D.   System.IO.Directory

14: A property of an object can be another object.

A.   False

B.   True

15: In system.streamwriter, what method is used to clear all buffers and causes any buffered data to be written to the underlying stream?

A.   Push

B.   Expel

C.   Flush

D.   Clear

16: To make a hidden form appear, you set what property?

A.   Visible property to False

B.   Visible property to True

C.   ControlBox to True

D.   ControlBox to False

17: Protected methods of a class are accessible from their own class and from:

A.   Abstract classes

B.   No other classes

C.   Derived classes

18: What design window allows you to add controls to a form?

A.   custom design window

B.   toolbox window

C.   solutions explorer window

D.   properties window

19: The serialization of an Object means that it is written out to a stream

A.   False

B.   True

20: The lowest bound value of arrays in VB.NET is ___ ?

A.   -1

B.   0

C.   1

D.   Infinite

21: Which method of the SQLCommand class would you use to call a stored procedure which does not return any data?

A.   EndExecuteReader

B.   ExecuteNonQuery

C.   ExecuteScalar

D.   ExecuteReader

22: A 'for' loop will run faster in VB.NET or C# ?

A.   C#

B.   None of these

C.   VB.NET

D.   Both of them will run equally fast.

23: True or False? A WPF control can be embedded inside of a Winforms application.

A.   True

B.   False

24: It is possible to define a string type as nullable?

A.   True

B.   False

25: You use _________ to declare a procedure that returns a value.

A.   Sub

B.   MyProcedure

C.   Function

D.   Call

26: True or False? An interface can inherit from another interface.

A.   False

B.   True

27: What character donates a section of commented code?

A.   ' apostrophe

B.   / forward slash

C.   { curly braces

D.   $ dollar sign

28: Which operation is performed first in the following example? y = 17 + 7 / 2

A.   the division operation of 7 / 2

B.   the addition operation of 17 + 7

29: A variable declared as: Dim Var as Integer = 5, after executing the next line of: Var -= 1, would have what value?

A.   4

B.   6

C.   1

D.   -5

30: Which class has a .Fill method which is used to add or refresh rows in a dataset?

A.   DataAdapter

B.   DataConnection

C.   SQLCommandBuilder

D.   SQLDependency

31: What toolbar allows you to control alignment and spacing?

A.   layout toolbar

B.   base toolbar

C.   normal toolbar

D.   project toolbar

32: A collection of DataRows is called a ________.

A.   DataGroup

B.   Data.Set

C.   System.Data

D.   DataSet

33: What specific time value is attributed to the Interval property in the TImer control?

A.   milliseconds

B.   seconds

C.   nanoseconds

D.   minutes

34: What type of Visual Basic project creates a standard Windows program?

A.   Windows Presentation Foundation

B.   the Windows Forms Application

C.   Console Application Template

D.   Class Library Template

35: What does LINQ stand for?

A.   Light Interface Number Query

B.   Linear Query

C.   Language-Integrated Query

D.   Lowest-Integrated Question

36: What is the correct way of ending a VB.NET Sub?

A.   Kill

B.   Exit Sub

C.   Close Sub

D.   End

E.   End Sub

37: What keyword should be used when declaring a variable inside a method, whose value should remain the same between calls?

A.   Static

B.   Fixed

C.   Private

D.   Immutable

38: A class declared as: Public Class Sample(of T), is an example of what type of class?

A.   Generic

B.   Fixed

C.   Anonymous

D.   Dynamic

39: To have your code executed when an if....then statement evaluates to False, you use a ____________ clause.

A.   If Not

B.   GoTo

C.   Else

D.   End If

40: How many elements are there in the following array? Dim X(3) as Integer

A.   4

B.   0

C.   3

41: Terminate a For/Next loop with the _______ statement.

A.   exit

B.   continue

C.   exit Loop

D.   exit For

42: True or False? A class have both a shared and non-shared constructor.

A.   False

B.   True

43: In order to draw to a surface, use the ______________.

A.   Graphics object

B.   Control Panel

C.   Paint event

D.   Pen Object

44: How do you limit implicit type conversion in VB.NET?

A.   Option Strict On

B.   Option Strict Off

C.   Option Strict = 1

D.   Options Strict True

45: How do you create a Read only Property in VB.NET

A.   Using both Get and Set

B.   Using Only Set..EndSet with in property definition

C.   Using Only Get..EndGet with in property definition

D.   None of the above

46: What character precedes a hotkey or accelerator that you are creating?

A.   - (hyphen)

B.   & (ampersand)

C.   $ (dollar sign)

D.   # (hash)

47: The import required for the registry editing is

A.   System.Security.Permissions

B.   Microsoft.Win32

C.   System.Security.AccessControl

D.   System.Security

48: In order to copy the schemas, relationships and constraints of a dataset but not any data you would utilize which method?

A.   Dataset.Copy

B.   Dataset.Duplicate

C.   Dataset.Clone

D.   Dataset.Replicate

49: In the declaration: Dim varA As Object, VarB, VarC As Integer, what type is VarB?

A.   Integer

B.   Object

C.   Generic

D.   String

50: A class declared as friend is accessible from:

A.   Only methods in the same class

B.   Anywhere in the same assembly

C.   Anywhere in another assembly

D.   Any derived class