VB.Net Test (Answer Sheet)
Practice tests to further your career.
Intro
These questions were prepared by Mike Prestwood and are intended to stress an important aspect. All our practice questions are intended to prepare you
specifically to earn your Prestwood certification and generally for passing any certification test as well as prepare you for
professional work.
29 Questions
Beginner
16 Beginner Level Questions
Question #5: True or False?
In VB.Net, you can combine multiple statements on one line as in the following:
s =
"Mike" MessageBox.Show(s)
Answer:
True False
Question #16: Multiple Choice
Which statement best describes VB.Net constants?
Answer:
1. In VB.Net, you define constants with the Constant keyword. All constants are part of a class but you can have special global constants by making use of the special _Global class.
2. In VB.Net, you define constants with the Literal keyword. All constants are part of a class (no global constants) and you must create a class prior to accessing the constant using ClassName.ConstantName .
3. In VB.Net, you define constants with the Const keyword. You can declare constants witin a class or globally outside a class. For class constants, you can have access to it using ClassName.ConstantName so long as you have added the class to the project.
4. In VB.Net, you define constants with the Const keyword. All constants are part of a class (no global constants) but you can make a constant public and have access to it using ClassName.ConstantName so long as you have added the class to the project. This works even without creating the class as if the public constants were static, but you cannot use the Shared keyword.
Intermediate
8 Intermediate Level Questions
Question #17: Multiple Choice
Given these 3 lines of code:
'1. Public Class Cyborg Inherits System.Object End Class '2. Public Class Cyborg Inherits Object End Class '3. Public Class Cyborg End Class
Which of the following statements is most accurate?
Answer:
4. All of the above. All three are equivalent.
5. None of the above. All three are not equivalent.
Question #19: Multiple Choice
The method name of a constructor is?
Answer:
1. New
3. ~ + class name, i.e. ~Person
Question #22: Multiple Choice
Which of the following statements best describes by value and by reference parameters?
Answer:
1. For parameters, you can optionally specify ByVal or ByRef . ByRef is the default if you don't specify.
2. For parameters, you must specify either Val or Ref . There is no default.
3. For parameters, you can optionally specify ByVal or ByRef . ByVal is the default if you don't specify.
4. For parameters, you can optionally specify Val or Ref . Ref is the default if you don't specify.
5. For parameters, you can optionally specify Val or Ref . Val is the default if you don't specify.
Question #23: Multiple Choice
Which of the following statements is true?
Answer:
1. To refer to the current instance of a class or structure, use the Me keyword.
2. To refer to the current instance of a class or structure, use the Self keyword.
3. To refer to the current instance of a class or structure, use the This keyword.
Question #24: Multiple Choice
Which code snippet is the correct syntax for declaring and using an associative array?
Answer:
1. //Imports System.Collections.Generic Dim States As New Collection States.Add("CA", "California") States.Add("NV", "Nevada") MsgBox(States("NV"))
2. //Imports System.Collections.Generic Dim States As New _ Collection(Of String, String) States("CA") = "California" States("NV") = "Nevada" MsgBox(States.Item("NV"))
3. //Imports System.Collections.Generic Dim States As New _ Dictionary(Of String, String) States.Add("CA", "California") States.Add("NV", "Nevada") MsgBox(States("NV"))
4. //Imports System.Collections.Generic Dim States As New Collection(Of String) States.Add("CA", "California") States.Add("NV", "Nevada") MsgBox(States.Item("NV"))
5. //Imports System.Collections.Generic Dim States As New Array(String, String) States.Add("California", "CA") States.Add("Nevada", "NV") MsgBox(States.ListItem("NV"))
Advanced
5 Advanced Level Questions
Question #25: Multiple Choice
Which statement best describes pointer support in VB.Net?
Answer:
1. VB.Net doesn't support pointers. The closest it comes is IntPtr which you use to get pointer handles on windows, files, etc.
2. VB.Net supports developer defined pointers. Use the * operator to declare a pointer data type. Use the & operator to return the current address of a variable.
3. VB.Net supports developer defined pointers. Use a carrot (^ ) to declare a pointer data type. Use the @ operator or Addr function to return the current address of a variable.
Question #26: Multiple Choice
Which answer best describes VB.Net's support for static members and clsasses?
Answer:
1. VB.Net supports both static members and static classes (use the keyword Static ). You can add a static method, field, property, or event to an existing class.
2. VB.Net supports both static members and static classes (use the keyword Shared ). You can add a static method, field, property, or event to an existing class.
3. VB.Net supports static members only (use the keyword Shared ).
4. VB.Net supports static classes only (use the keyword Static ).
5. None of the above. VB.Net does not support static classes nor members.
Question #28: Multiple Choice
Which of the following statements best describes method overloading?
Answer:
1. For method overloading, you use implicit overloading (no special syntax) .
2. For method overloading, you use the Overloads keyword. If you use the Overloads keyword, all overloaded methods with the same name in the same class must include the Overloads keyword.
3. For method overloading, you either use implicit overloading (no special syntax) or use the Override keyword. If you use the Override keyword, all overloaded methods with the same name in the same class must include the Override keyword.
4. For method overloading, you use the Implicit keyword. If you use the Implicit keyword, all overloaded methods with the same name in the same class must include the Implicit keyword.
5. For method overloading, you either use implicit overloading (no special syntax) or use the Overloads keyword. If you use the Overloads keyword, all overloaded methods with the same name in the same class must include the Overloads keyword.
Question #29: Multiple Choice
Given the following code snippet:
Public Class Cyborg End Class
Answer:
1. The finalizer method name must be ~Cyborg .
2. The finalizer method name must be Finalize .
3. The finalizer method name can be any method name of your choosing so long as you use the finalizer keyword to indicate this is the finalizer method.
4. The finalizer method name must be Destroy .
5. The finalizer method name must be Class_Terminate.