26. What will the following code display? int x = 0; for (int count = 0; count <
ID: 3540244 • Letter: 2
Question
26. What will the following code display?
int x = 0;
for (int count = 0; count < 3; count++)
x += count;
cout << x << endl;
a. 0
1
2
c. 6
b. 0 d. 3
27. How many times will the following loop display %u201CHello%u201D?for (int i = 0; i < 20; i++)
cout << "Hello!" << endl;
a. 20 c. 21
b. 19 d. An infinite number of times
28. How many times will the following loop display %u201CHello%u201D?
for (int i = 1; i < 20; i++)
cout << "Hello!" << endl;
a. 20 c. 21
b. 19 d. An infinite number of times
29. How many times will the following loop display %u201CHello%u201D?
for (int i = 0; i <= 20; i++)
cout << "Hello!" << endl;
a. 20 c. 21
b. 19 d. An infinite number of times
30. How many times will the following loop display %u201CHello%u201D?
for (int i = 20; i > 0; i--)
cout << "Hello!" << endl;
a. 20 c. 21
b. 19 d. An infinite number of times
44. Given the following function definition
void calc (int a, int& b)
{
int c;
c = a + 2;
a = a * 3;
b = c + a;
}
What is the output of the following code fragment that invokes calc?
(All variables are of type int)
x = 1;
y = 2;
z = 3;
calc(x, y);
cout << x << " " << y << " " << z << endl;
a. 1 2 3
b. 1 6 3
c. 3 6 3
d. 1 14 9
e. None of these
Explanation / Answer
26.d
27.a
28.b
29.c
30.a
44.b
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.