Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.A boolean expression is used to determine if a loop will continue or not. a)Ye

ID: 3890586 • Letter: 1

Question

1.A boolean expression is used to determine if a loop will continue or not. a)Yes b)No

2.

How many times will this loop execute?

for (int i = 0; i < 7; i++)

{

...

}

a 0

b 5

c 6

d 7

3.

How many times will this loop execute?

for (int i = 5; i > 0; i--)

{

...

}

4.

What is the output of this loop?

int i = 3;

while (i > 0)

{

cout << i << " ";

}

cout << endl;

a)3 2 1

b)3 2 1 0

c)3 3 3 3 3 3 3....

5.

What is the output of this loop?

int i = 3;

while (i > 0)

{

cout << i-- << " ";

}

cout << endl;

a)3 2 1

b)3 2 1 0

c)3 3 3 3 3 3 3....

6.An infinite loop is one that never stops - it will continue to repeat and execute the loop statements.

True False

7.

These loops will produce the same results.

for (int i = 0; i <= 10; i++)

{

cout << i;

}

int i = 0;

while (i <= 10)

{

cout << i;

i++;

}

True False

8.

What statement most accurately describes the output of this loop?

for (int i = 0; i < 100; i++)

{

if (i % 2 == 1)

cout << i << " ";

}

a)all of the numbers between 0 and 100

b)all of the even numbers between 0 and 100

c)all of the odd numbers between 0 and 100

d)all of the even numbers between 0 and 99

e)all of the odd numbers between 0 and 99

Explanation / Answer

1.A boolean expression is used to determine if a loop will continue or not.

Answer: Yes

2.

How many times will this loop execute?

Answer: d) 7

3.

How many times will this loop execute?

Answer: 5

4.

What is the output of this loop?

Answer: c) 3 3 3 3 3 3 3

5.

What is the output of this loop?

Answer: 3 2 1

6.An infinite loop is one that never stops - it will continue to repeat and execute the loop statements.

Answer: True

7.

These loops will produce the same results.

Answer: True

8.

What statement most accurately describes the output of this loop?

Answer:b)all of the even numbers between 0 and 100