26. What will the following code display?
int x = 0;
for (int count = 0; count < 3;="">
x += count;
cout < x=""><>
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;="">
cout < "hello!"=""><>
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;="">
cout < "hello!"=""><>
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;="">=>
cout < "hello!"=""><>
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!"=""><>
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=""><>
a. 1 2 3
b. 1 6 3
c. 3 6 3
d. 1 14 9
e. None of these