17 questions
What are the values of var1 and var2 when the code finishes executing?
var1 = 1, var2 = 1
var1 = 2 , var2 = 0
var1 = 3, var2 = -1
var1 = 0, var2 = 2
The loop will cause a run-time error for division by zero
What are the values of x and y when the code finishes executing?
x = 5, y = 2
x = 2, y = 5
x = 3, y = 4
x = 4, y = 3
Infinite Loop
How many stars are printed?
7
3
4
5
Infinite Loop
In total, how many times is the inner loop executed?
5
10
15
50
Infinite Loop
How many times does the loop print a *
40
20
24
30
Infinite Loop
What does the following code print?
A rectangle of 8 rows with 5 stars per row
A rectangle of 8 rows with 4 stars per row
A rectangle of 6 rows with 5 stars per row
A rectangle of 6 rows with 4 stars per row
Infinite Looo
What does the following code print?
A rectangle of 9 rows with 5 stars per row
A rectangle of 6 rows with 6 stars per row
A rectangle of 7 rows with 5 stars per row
A rectangle of 7 rows with 6 stars per row
Infinite Loop
How many times is "HI!" printed?
15
12
10
8
Infinite Loop
What does the following code print?
5 6 7 8 9
4 5 6 7 8 9 10 11 12
3 5 7 9 11
3 4 5 6 7 8 9 10 11 12
How many times does the following method print a *?
9
6
7
10
What does the following code segment print?
5 4 3 2 1
-5 -4 -3 -2 -1
-4 -3 -2 -1 0
How many times does the code print a * ?
7
8
12
13
How many times does this print a * ?
4
5
6
7
How many times does this code print at * ?
5
6
7
8
What does the code print?
1 2 3 4
1 2 3 4 5
0 1 2 3 4
0 1 2 3 4 5
How many stars are printed?
10
5
25
50
What is printed when the code segment is executed?
0 2 4 6 8 10 12 14 16 18
0 6 12 18
1 4 7 10 13 16 19
4 10 16