3. What is the output of the following code? int count; int num = 2; for (count
ID: 3762081 • Letter: 3
Question
3.
What is the output of the following code?
int count;
int num = 2;
for (count = 1; count < 2; count++)
{
num = num + 3;
System.out.print(num + " ");
}
System.out.println();
a.
c.
b.
d.
4.
What is value of x after the following code executes?
int x = 0;
int i;
for (i = 0; i < 5; i++)
x = 3 * x + i;
a.
c.
b.
d.
int x = 27;
int y = 10;
do
x = x / 3;
while (x >= y);
5.
How many times does the statement above execute?
a.
c.
b.
d.
6.
What is the final value of x in the code above?
a.
c.
b.
d.
3.
What is the output of the following code?
int count;
int num = 2;
for (count = 1; count < 2; count++)
{
num = num + 3;
System.out.print(num + " ");
}
System.out.println();
a.
5c.
2 5 8b.
5 8d.
5 8 11 ABCD4.
What is value of x after the following code executes?
int x = 0;
int i;
for (i = 0; i < 5; i++)
x = 3 * x + i;
a.
18c.
179b.
58d.
226int x = 27;
int y = 10;
do
x = x / 3;
while (x >= y);
5.
How many times does the statement above execute?
a.
nonec.
twiceb.
onced.
three times ABCD6.
What is the final value of x in the code above?
a.
0c.
9b.
3d.
27Explanation / Answer
3. a 5 (loop executes only once)
4. b. 58
5. once
6. It executes only once, so 27/3 = 9
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.