wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

VB.NET

Total questions: 32

Worksheet time: 17mins

Name
Class
Date
1.

Which would be the best way to create a variable to store a real number

a)

Dim r as real

b)

Dim r as decimal

c)

dim number as real

d)

dim number as decimal

2.

which of the following is correct to find if a number n is between 1 and 5 inclusive

a)

IF n <=1 and >=5

b)

IF n > 1 or n < 5

c)

IF n >=1 or n <= 5

d)

IF n >=1 and n <=5

3.

An algorithm is...

a)

A sequence of step by step instructions to complete a task

b)

Breaking a problem down into smaller problems

c)

Removing the unnecessary detail from a problem

d)

A program written to solve a problem

4.

Decomposition is ...

a)

A sequence of step by step instructions to complete a task

b)

Breaking a problem down into smaller problems

c)

Removing the unnecessary detail from a problem

d)

A program written to solve a problem

5.

Abstraction is...

a)

A sequence of step by step instructions to complete a task

b)

Breaking a problem down into smaller problems

c)

Removing the unnecessary detail from a problem

d)

A program written to solve a problem

6.

Which algorithm would be best to search for a value in a list of 1,000,000 ordered numbers

a)

Bubble search

b)

Binary sort

c)

Binary search

d)

Linear search

7.

Which algorithm would be best to search for a number in a list of 1,000,000 random numbers

a)

Linear sort

b)

Linear search

c)

Merge search

d)

Binary search

8.

Which algorithm would sort 1,000,000 random numbers in the least time

a)

Merge search

b)

Bubble sort

c)

Merge sort

d)

Bogosort

9.

Why would a programmer use bubble sort instead of merge sort

a)

It takes less time to sort numbers

b)

It is easier to program

c)

The efficiency gains from merge sort are negligible for small sets of values

d)

it is a good way to show off their programming skills

10.

Which is not a valid VB data type

a)

Integer

b)

Bool

c)

Char

d)

String

11.

What is the correct ending of a FOR loop in VB

a)

}

b)

ENDFOR

c)

NEXT

d)

)

12.

Which is the correct way to start a for loop to loop 10 times in VB

a)

FOR (i=1;i<=10;i++)

b)

FOR i = 0 to 10

c)

FOR i = 1 to 10 step 2

d)

For i = 1 to 10

13.

How do you declare a constant in VB

a)

Const pi As Integer = 3.14

b)

Constant pi as Integer = 3.14

c)

Dim pi as constant = 3.14

d)

Dim pi as Constant Integer = 3.14

14.

What is used in VB to find the remainder of dividing a by b

a)

a \ b

b)

a % b

c)

a div b

d)

a mod b

15.

How would you integer divide a by b

a)

a \ b

b)

a / b

c)

a div b

d)

a mod b

16.

Which one of the following is a 2D array in VB

a)

Dim a(1,2) as string

b)

dim a[1,2] as string

c)

dim a(2) as string

d)

dim a[2] as string

17.

Which is the correct way in VB to create a record called Town

a)

Record Town

b)

Structure Town

c)

Record Structure Town

d)

Town Structure

18.

in VB how would you take a user input and store it in a variable userInput

a)

userInput = Console.Readline()

b)

userInput = Console.ReadKey()

c)

userInput = Console.Read()

d)

userInput = Input

19.

In VB how would you find the length of a string with the identifier myString

a)

myString(length)

b)

myString.Len

c)

Length.myString

d)

myString.Length

20.

in VB how would you join together an integer with the identifier n and a string with the identifier myString

a)

n + myString

b)

n & myString

c)

n AND myString

d)

n.MyString

21.

in VB how would you convert myString to lower case

a)

Lower(myString)

b)

myString.Lower()

c)

myString.ToLower()

d)

Convert.ToLower(myString)

22.

What is not needed in a Function in VB

a)

Function

b)

End Function

c)

Sub

d)

Return

23.

How many parameters are there

Function getMyResult(input, n, score)

a)

1

b)

2

c)

3

d)

4

24.

What type of test data would test a value that should be allowed as an input into a program

a)

Correct

b)

Right

c)

Valid

d)

normal

25.

What type of test data would test a value that should be rejected as an input into a program

a)

Wrong

b)

Erroneous

c)

invalid

d)

incorrect

26.

What type of test data would the edges of valid data

a)

Edge

b)

Boundary

c)

Extreme

d)

outside

27.

Which type of error would stop the program from running?

a)

syntax error

b)

logic error

28.

If a < 1 AND a > 10 Then

this code is not correct, what type of error is it

a)

Syntax error

b)

Logic error

29.

Which error is harder to find

a)

Syntax error

b)

Logic error

30.

A function must ...

a)

contain parameters

b)

return a value

c)

declare its own variables

d)

have an output

31.

A subroutine that does not have to return a value is ....

a)

a procedure

b)

a function

32.

In VB a procedure is written as ...

a)

procedure myProcedure()

b)

subroutine myProcedure()

c)

sub myProcedure()

d)

function myProcedure()