VB.NET Procedures and Variables Fundamentals

Test your knowledge of VB.NET programming fundamentals including sub procedures, function procedures, variable scope, naming conventions, and arrays.

10 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which is not an optional element of a sub procedure declaration?

  1. Parameters
  2. Public
  3. Private
  4. Statements
  5. Sub
Question 2 Multiple Choice (Single Answer)

Which is a valid way to write a sub procedure declaration?

  1. Use the Class and Method combo boxes in the Code Editor window.
  2. Double click on the object in the Form Designer window.
  3. Type the procedure declaration in the Code Editor window.
  4. Both a and b.
  5. All of the above.
Question 3 Multiple Choice (Single Answer)

Which statement will send the value generated by a function procedure, called CalculateTax, back to the calling code?

  1. Return Sales*0.08
  2. CalculateTax = Sales*0.08
  3. Return CalculateTax (Sales*0.08)
  4. Both a and b.
  5. All of the above.
Question 4 Multiple Choice (Single Answer)

Which part of a function procedure declaration statement is optional?

  1. Datatype
  2. Function
  3. Parameters
  4. Private
  5. ProcedureName
Question 5 Multiple Choice (Single Answer)

How many return statements are allowed in a Function Procedure?

  1. 1
  2. 2
  3. 3
  4. There is no limit.
Question 6 Multiple Choice (Single Answer)

Why should a variable not be declared as a module variable?

  1. It prevents a procedure from being self contained.
  2. It makes it easier to document the code.
  3. Local variable names can be reused in other procedures.
  4. Both a and b.
  5. All of the above.
Question 7 Multiple Choice (Single Answer)

Which variable name uses a standard naming convention for module variables?

  1. mWeight
  2. mdWeight
  3. moduleWeight
  4. module_Weight
Question 8 Multiple Choice (Single Answer)

The scope of a variable refers to:

  1. the length of the variable.
  2. the name of the variable.
  3. the accessibility of the variable.
  4. the datatype of the variable.
  5. the lifetime of the variable.
Question 9 Multiple Choice (Single Answer)

What is the value of the index for the first element in a VB.NET array?

  1. 1
  2. 2
  3. 3
  4. Depends on what the assigned value is.
Question 10 Multiple Choice (Single Answer)

Which method will return the number of elements in an array?

  1. Dimension
  2. Length
  3. Number
  4. Size
  5. UpperBound