Question 5 (1 point) Given the following code, what is the final value of i? int
ID: 3909535 • Letter: Q
Question
Question 5 (1 point)
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 5 options:
3
4
5
0
Save
Question 6 (1 point)
int x;
for (x = 0;x > 10;x++) {
cout << x;
}
What is the last thing printed by the above code?
Question 6 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 7 (1 point)
Which of the following code segments will count from 1 to 99 (including 1 and 99)?
Question 7 options:
for (int i=1; i<=100; ++i) {}
for (int i=1; i<=100; ++i) {}
for (int i=0; i<=100; i++) {}
for (int i=0; i<=100; ++i) {}
for (int i=1; i<100; i++) {}
Save
Question 8 (1 point)
int x = 0;
while (x < 10) {
x+=2;
cout << x;
}
What is the output of the above code?
Question 8 options:
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
0 2 4 6 8
0 2 4 6 8 10
0 2 4 6 8 10 12
2 4 6 8
2 4 6 8 10
2 4 6 8 10 12
1 3 5 7 9
1 3 5 7 9 11
Nothing is printed
The code never ends
Save
Question 9 (1 point)
int x;
for (x = 0; x < 10; x++) {
}
cout << x;
What is the last thing printed by the above code?
Question 9 options:
0
1
2
8
9
10
11
Nothing is printed
The code never ends
Save
Question 10 (1 point)
int x;
for (x = 0; x < 10; x++) {
cout << 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 (1 point)
int x;
for(x = 0;x >= 0; x++) {
cout << 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 (1 point)
int x;
for (x = 0; x != 10; x+=2) {
cout << x;
}
What is the output of the above code?
Question 12 options:
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
0 2 4 6 8
0 2 4 6 8 10
0 2 4 6 8 10 12
2 4 6 8
2 4 6 8 10
2 4 6 8 10 12
1 3 5 7 9
1 3 5 7 9 11
Nothing is printed
The code never ends
Save
Question 13 (1 point)
int x;
for (x = 0;x < 10; ++x) {
cout << x;
}
What is the first thing printed by the above code?
Question 13 options:
-1
0
1
2
Nothing is printed
Save
Question 14 (1 point)
int x = 0;
while (x > 10) {
x++;
}
cout << x;
What is the last thing printed by the above code?
Question 14 options:
0
1
2
8
9
10
11
Nothing is printed
The code never ends
Save
Question 15 (1 point)
int x;
for(x = 0;x > 10;x++) {
x++;
cout << x;
}
What is the last thing printed by the above code?
Question 15 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 16 (1 point)
int x = 0;
while (x < 10) {
cout << x;
++x;
}
What is the last thing printed by the above code?
Question 16 options:
8
9
10
11
Nothing is printed
The code never ends
Save
Question 17 (1 point)
Question 17 options:
A compound statement that contains variable declarations is called a __________.
Save
Question 18 (1 point)
int x;
for (x = 0;x > 10; 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 (1 point)
int x = 0;
while (x <= 10) {
x+=2;
cout << x;
}
What is the output of the above code?
Question 19 options:
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
0 2 4 6 8
0 2 4 6 8 10
0 2 4 6 8 10 12
2 4 6 8
2 4 6 8 10
2 4 6 8 10 12
1 3 5 7 9
1 3 5 7 9 11
Nothing is printed
The code never ends
Save
Question 20 (1 point)
Question 20 options:
Complete the following code segment// count from 1 to 99// 1 is the first number printed// 99 is the last number printedint i=1;while (i<100) { cout << ____;}
3
4
5
0
Explanation / Answer
Hi,
The following are the answers for the given questions.
Q5: 4
Q6: Nothing is printed
Q7: for (int i=1; i<100; i++) {}
Q8: 2 4 6 8
Q9: 9
Q10: 9
Q11: The code never ends
Q12: 0 2 4 6 8
Q13: 0
Q14: 0
Q15: Nothing is printed
Q16: 9
Q17: block
Q18: Nothing is printed
Q19: 2 4 6 8 10 12
Q20:
int i=1;
while (i<100)
{
cout << i;
i++;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.