Computer Science: Looping Quiz Subsection Question 1 int x = 0; while (x < 10) {
ID: 3558918 • Letter: C
Question
Computer Science: Looping
Quiz
Subsection
Question 1
int x = 0;
while (x < 10) {
cout << x;
x++;
}
What is the first thing printed by the above code?
Question 1 options:
-1
0
1
2
Nothing is printed
Save
Question 2
int x = 0;
while (x < 10) {
cout << x;
++x;
}
What is the first thing printed by the above code?
Question 2 options:
-1
0
1
2
Nothing is printed
Save
Question 3
int x = 0;
while (x > 10) {
cout << x;
x++;
}
What is the first thing printed by the above code?
Question 3 options:
-1
0
1
2
Nothing is printed
Save
Question 4
int x = 0;
while (x < 10) {
x++;
cout << x;
}
What is the first thing printed by the above code?
Question 4 options:
-1
0
1
2
Nothing is printed
Save
Question 5
int x = 0;
while (x < 10) {
++x;
cout << x;
}
What is the first thing printed by the above code?
Question 5 options:
-1
0
1
2
Nothing is printed
Save
Question 6
int x = 0;
while (x > 10) {
x++;
cout << x;
}
What is the first thing printed by the above code?
Question 6 options:
-1
0
1
2
Nothing is printed
Save
Question 7
int x = 0;
while (x < 10) {
x++;
cout << x;
}
What is the last thing printed by the above code?
Question 7 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 8
int x = 0;
while (x < 10) {
++x;
cout << x;
}
What is the last thing printed by the above code?
Question 8 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 9
int x = 0;
while (x > 10) {
x++;
cout << x;
}
What is the last thing printed by the above code?
Question 9 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 10
int x = 0;
while (x < 10) {
cout << x;
x++;
}
What is the last thing printed by the above code?
Question 10 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 11
int x = 0;
while (x < 10) {
cout << x;
++x;
}
What is the last thing printed by the above code?
Question 11 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 12
int x = 0;
while (x > 10) {
cout << x;
x++;
}
What is the last thing printed by the above code?
Question 12 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 13
int x = 0;
while (x > 0) {
cout << x;
x++;
}
What is the last thing printed by the above code?
Question 13 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 14
int x = 0;
while (x >= 0) {
cout << x;
x++;
}
What is the last thing printed by the above code?
Question 14 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 15
int x;
for (x = 0;x < 10; ++x) {
cout << x;
}
What is the first thing printed by the above code?
Question 15 options:
-1
0
1
2
Nothing is printed
Save
Question 16
int x;
for (x = 0;x > 10; x++) {
cout << x;
}
What is the first thing printed by the above code?
Question 16 options:
-1
0
1
2
Nothing is printed
Save
Question 17
int x;
for (x = 0; x < 10; x++) {
x++;
cout << x;
}
What is the first thing printed by the above code?
Question 17 options:
-1
0
1
2
Nothing is printed
Save
Question 18
int x;
for (x = 0; x < 10; ++x) {
++x;
cout << x;
}
What is the first thing printed by the above code?
Question 18 options:
-1
0
1
2
Nothing is printed
Save
Question 19
int x;
for (x = 0; x > 10; x++) {
x++;
cout << x;
}
What is the first thing printed by the above code?
Question 19 options:
-1
0
1
2
Nothing is printed
Save
Question 20
int x = 0;
while (x < 10) {
x++;
}
cout << x;
What is the last thing printed by the above code?
Question 20 options:
0
1
2
8
9
10
11
Nothing is printed
The code never ends
Save
Question 21
int x = 0;
while (x < 10) {
++x;
}
cout << x;
What is the last thing printed by the above code?
Question 21 options:
0
1
2
8
9
10
11
Nothing is printed
The code never ends
Save
Question 22
A _________ loop always executes the loop body at least once, irregardless of the loop condition.
Save
Question 23
Given the following code, what is the final value of i?
int i,j;
for(i=0;i<4;i++) {
for(j=0;j<3;j++) {
if(i==2)
break;
}
}
Question 23 options:
3
4
5
0
Save
Question 24
int x;
for (x = 0; x > 10; x++) {
x++;
cout << x;
}
What is the first thing printed by the above code?
Question 24 options:
-1
0
1
2
Nothing is printed
Save
Question 25
Which of the following is not a good reason for choosing a certain loop control?
Question 25 options:
What the loop does
The minimum number of iterations of the loop
The condition for ending the loop
If the loop is in a function
Note: It is recommended that you save your response as you complete each question.Explanation / Answer
1) 0
2) 0
3) Nothing is printed
4) 1
5) 1
6) Nothing is printed
7) 10
8) 10
9) Nothing is printed
10) 9
11) 9
12) Nothing is printed
13) Nothing is printed
14) Never ends
15) 1
16) 0
17) 1
18) 2
19) 1
20) 10
21) 10
22) do-while
23) 4
24) Nothing is printed
25) If loop is in a function
--
Best,
- MD :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.