wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Inscoe - CPI 5.05

Total questions: 26

Worksheet time: 13mins

Name
Class
Date
1.

In the code shown, how many iterations will this loop execute?

a)

4

b)

5

c)

6

d)

10

2.

When the MessageBox is displayed in the code shown, the variable intJ will be:

a)

8.

b)

10.

c)

12.

d)

unknown.

3.

In the code shown, the For loop has how many iterations?

a)

0

b)

5

c)

6

d)

7

4.

In the code shown, what is the value stored in intX when the loop terminates?

a)

0

b)

5

c)

6

d)

8

5.

In the code shown, how many times does the program count through the loop structure?

a)

0

b)

1

c)

5

d)

The loop will not start.

6.

In the code shown, when the MessageBox is displayed, the variable intJ will be:

a)

8.

b)

10.

c)

12.

d)

unknown.

7.

Examine the code shown. What value is stored in intResult after the loop executes?

a)

6

b)

10

c)

11

d)

12

8.

In the following code, how many times does the program count through the loop structure?


For intCounter as integer = 1 To 9 Step 3

a)

0

b)

1

c)

3

d)

9

9.

What type of Do Loop is executed by the code shown?

a)

Random Do Loop

b)

Fixed Do Loop

c)

Pre Test Do Loop

d)

Post Test Do Loop

10.

The Loop structure is also referred to as a:

a)

decision.

b)

block.

c)

repetition.

d)

case.

11.

Typically, accumulators and counters are initialized to which value?

a)

1

b)

0

c)

2

d)

Nothing

12.

In the code shown, how many iterations will this loop execute?

a)

4

b)

5

c)

6

d)

10

13.

In the code shown, if the line of code intJ += 2 were changed to intJ -= 2 , what would be the result?

a)

Everything would work the same, except intJ would be negative.

b)

No significant change would be seen.

c)

The program would lock up in an infinite loop.

d)

The program would stop when intJ reaches 0.

14.

In the following code, how many times does the program count through the loop structure?


For intCounter as integer = 1 To 9 Step -3

a)

Infinite

b)

1

c)

9

d)

3

15.

In the code shown, the for loop has how many iterations?

a)

4

b)

5

c)

6

d)

7

16.

Given the following statements:

Dim intNum As Integer = 0

Do

IntNum = intNum + 1

Loop While intNum < 5


How many times will the body of the Do ... Loop execute?

a)

0

b)

2

c)

5

d)

10

17.

In the code shown, what is the value stored in intCount when the MessageBox is displayed?

a)

0

b)

5

c)

6

d)

7

18.

Which is the correct syntax for a pretest Do Loop?

a)

Do While condition

statements

End Do

b)

Do While condition

statements

End While

c)

Do While condition

statements

Loop

d)

Do While condition

statements

Next

19.

In the code shown, which variable is the accumulator?

a)

intCount

b)

intGrade

c)

intSum

d)

dblAvg

20.

Given the following code segment, what is the value of intNumber that displays in the Label?

a)

2

b)

4

c)

6

d)

8

21.

In the code below, this Do Loop is a:

a)

Random Do Loop.

b)

Fixed Do Loop.

c)

Pre Test Do Loop.

d)

Post Test Do Loop.

22.

In what type of loop are the conditions evaluated before the instructions are processed?

a)

Pretest

b)

Finite

c)

Infinite

d)

Posttest

23.

Given the following statements:

Dim intNum As Integer

For intNum = 1 to 5

MessageBox.Show(intNum)

Next intNum


What is the value of intNum after the last loop iteration?

a)

1

b)

5

c)

6

d)

8

24.

In the code shown, which variable is the counter?

a)

intCount

b)

intGrade

c)

intSum

d)

dblAvg

25.

In the code below, if the Random Number generator is fair, the value in intTot after the loop completes, on average, will tend to be close to:

a)

200.

b)

250.

c)

300.

d)

350.

26.

Given the following statements:

Dim intNum As Integer

For intNum = 1 To 11

MessageBox.Show(intNum)

Next intNum


What is the value of intNum after the last loop iteration?

a)

1

b)

10

c)

11

d)

12