wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Inscoe - CPI 5.01-5.04

Total questions: 36

Worksheet time: 18mins

Name
Class
Date
1.

In the code shown, determine the value of intJ displayed in the MessageBox .

a)

50

b)

10

c)

MessageBox will not display due to a runtime error.

d)

Program will not compile due to a syntax error.

2.

Jamie keyed “Interger” instead of “Integer”. What type of error resulted?

a)

Dynamic error

b)

Logic error

c)

Runtime error

d)

Syntax error

3.

Misspelling a keyword is an example of a:

a)

dynamic error.

b)

logic error.

c)

syntax error.

d)

run-time error.

4.

Programming errors are classified into one of three categories. Which one is not a standard category?

a)

Infinite

b)

Run-time

c)

Logic

d)

Syntax

5.

Which type of error produces undesired or unexpected results?

a)

Dynamic error

b)

Logic error

c)

Run-time error

d)

Syntax error

6.

Sara thought her program would calculate grade point averages, but the program listed the highest grade instead. What type of error is this?

a)

Dynamic error

b)

Logic error

c)

Runtime error

d)

Syntax error

7.

Using the code shown, determine the value of intJ displayed in the MessageBox.

a)

10

b)

50

c)

MessageBox will not display due to a runtime error.

d)

Program will not compile due to a syntax error.

8.

John’s computer program stopped executing and displayed an error message. What type of error is this?

a)

Dynamic error

b)

Logic error

c)

Run-time error

d)

Syntax error

9.

Which type of error halts the program when a statement cannot be executed?

a)

Dynamic error

b)

Logic error

c)

Runtime error

d)

Syntax error

10.

The reason to use a breakpoint is to:

a)

evaluate the user interface.

b)

examine variables and check logic.

c)

set the tab order for controls.

d)

verify code syntax.

11.

In the code shown, if the user enters 5 into the TextBox1 , the MessageBox will display:

a)

0.

b)

10.

c)

50.

d)

Sorry, not allowed!

12.

Evaluate the code shown. If intX is 1 and intY is 0, what is displayed in the MessageBox ?

a)

False

b)

True

c)

Unknown

d)

Both False and True

13.

In the code shown, if the user enters thirty-seven into the TextBox1, the MessageBox will display:

a)

No MessageBox will be displayed.

b)

Sorry, that is not a valid number, try again!

c)

37.

d)

38.

14.

In the code shown, if the user enters zero (0) into the TextBox1 , the MessageBox will display:

a)

0.

b)

10.

c)

50.

d)

Sorry, not allowed.

15.

Alice wrote a program that executed but did not produce the expected output. What is the best method for Alice to use to find the error?

a)

Add break-points and step through the code while watching the variable output

b)

Add try catch

c)

Debug the program

d)

Hover over the variables in the code to change the output

16.

If defaults are set to show the Watch window, which data would be shown in the Watch window?

a)

variable names only

b)

variable values only

c)

variable: code statements

d)

variable: values

17.

What is a purpose of the Watch window?

a)

To examine values during the execution of a program

b)

To display online help

c)

To display the application interface

d)

To switch to the Code window

18.

When the code is completely written but will not execute, what is the appropriate action?

a)

Code another program to correct the program just completed.

b)

Give the program to another programmer for review and correction.

c)

Perform programmer debugging and/or program debugging.

d)

Rewrite all the lines of code.

19.

Grades are based on the scale below. Using this scale, which condition(s) would be used to identify students who made an “A” or a “B”?


A 93–100

B 85–92

C 78–84

D 70–77

F 0–69

a)

dblScore < 85 And dblScore > = 93

b)

dblScore = 85 Or dblScore > 93

c)

dblScore > 85 And dblScore > = 90

d)

dblScore > = 85

20.

If 5 and 2 are entered in txtNumber1 and txtNumber2 , respectively, what will the following code display?


Dim intNumber1 As Integer = Convert.ToInt32(txtNumber1.Text)

Dim intNumber2 As Integer = Convert.ToIn32(txtNumber2.Text)

Dim intResult As Integer

intResult = intNumber1 Mod intNumber2

lblAnswer.Text= intResult.ToString()

a)

1

b)

2

c)

3

d)

5

21.

Grades are based on the scale below. Using this scale, which condition(s) would be used to identify students who made a “B”?


A 93–100

B 85–92

C 78–84

D 70–77

F 0–69

a)

dblScore = 85 Or dblScore < 93

b)

dblScore > 85 And dblScore < = 93

c)

dblScore > = 85 And dblScore < 93

d)

dblScore < 85 And dblScore > = 93

22.

North Carolina allows a teenager to have a learner’s permit if he/she is 15 and has had driver’s education training. Consider the intAge and blnHasHadDrivEd variables. Which of the following If conditions would allow a learner’s permit?

a)

intAge = 15 And blnHasHadDrivEd = True

b)

intAge < 16 And blnHasHadDrivEd = True

c)

intAge > 14 Or blnHasHadDrivEd = True

d)

intAge = 15 Or blnHasHadDrivEd = True

23.

Which logical condition will determine if the AccountBalance is not less than CreditLimit ?

a)

AccountBalance <= CreditLimit

b)

AccountBalance <> CreditLimit

c)

AccountBalance = CreditLimit

d)

AccountBalance >= CreditLimit

24.

Which case condition is correct?

a)

Case To 10

b)

Case Is 10

c)

Case 10

d)

Case = 10

25.

In the code shown, if the Button1 is repeatedly clicked, how often will MessageBox.Show display the string Only 0 and 3 ?

a)

0% of the time

b)

25% of the time

c)

50% of the time

d)

75% of the time

26.

If the 7 weekdays are numbered 1 through 7, which statement generates a random whole number to represent one of the days, given the following code?


Dim gen As New System.Random()

a)

gen.Next(1, 6)

b)

gen.Next(7)

c)

gen.Next(1,7)

d)

gen.Next(1,8)

27.

Given the statements shown, what is displayed when the statements execute?

a)

Inexperienced

b)

Nothing would be displayed

c)

Sufficient experience

d)

Sufficient experience on one line and inexperience on the other

28.

Which condition is correct?

a)

Case 2 And 5

b)

Case 2, 5

c)

Case 2 - 5

d)

Case 2 Or 5

29.

Given the statements shown, What is displayed when intGuess is 11 and intSelected is 15?

a)

Correct

b)

Correct on one line and Incorrect on the next line

c)

Incorrect

d)

Nothing would be displayed

30.

A meat packer grades meat “P” for Prime, “C” for Choice, “S” for Standard, and “G” for Good. Which case expression will represent ChoiceMeat ?

a)

Case "CGSP"

b)

Case "P", "S"

c)

Case "C"

d)

Case Else

31.

If the user clicks on btn1 in the code shown:

a)

the button may become invisible.

b)

the MessageBox will display 0.

c)

the MessageBox will display 1.

d)

the program will terminate.

32.

In the code shown, which suit will never be selected?

a)

Clubs

b)

Hearts

c)

Spades

d)

Diamonds

33.

If there are 6 sides on a die, which statement generates a random whole number to represent one of the sides, given the following code?


Dim gen As New System.Random()

a)

gen.Next(1, 6)

b)

gen.Next(0,7)

c)

gen.Next(1, 7)

d)

gen.Next(6)

34.

If the 12 months are numbered 1 through 12, which statement generates a random whole number to represent one of the months, given the following code?


Dim gen As New System.Random()

a)

gen.Next(1, 13)

b)

gen.Next(1,12)

c)

gen.Next(1,11)

d)

. gen.Next(12)

35.

Which statement generates random whole numbers greater than or equal to 10 and less than 51, given the following code?


Dim gen As New System.Random()

a)

gen.Next(10, 50)

b)

gen.Next(10, 51)

c)

gen.Next(9, 50)

d)

gen.Next(9, 51)

36.

In the code shown, if the Button1 is repeatedly clicked, how often will MessageBox.Show display the string a 1 or 2 ?

a)

about half the time

b)

Never

c)

Impossible to predict

d)

About 1 time in 7