QUESTION 1 A _______- controlled loop is also called a flag-controlled loop. QUE
ID: 3708447 • Letter: Q
Question
QUESTION 1
A _______- controlled loop is also called a flag-controlled loop.
QUESTION 2
How many lines of output will be printed by the following program fragment?
for (i = 0; i < 5; i++)
for (j = 0; j < 4; j++)
WriteLine("{0} {1}", i, j);
20
6
9
12
none of the above
QUESTION 3
How many lines of output will be printed by the following program fragment?
for (i = 0; i < 5; i += 2)
for (j = 0; j < 4; j = j + 2)
WriteLine("{0} {1}", i, j);
20
6
9
12
none of the above
QUESTION 4
The sentinel value is used as the operand in the conditional expression for an indefinite loop.
True
False
20
6
9
12
none of the above
Explanation / Answer
QUESTION 1
A _______- controlled loop is also called a flag-controlled loop.
Ans: Sentinel-controlled
Sentinel-controlled is called Sentinel-controlled because it doesn't know how many time the loop will execute.
QUESTION 2
How many lines of output will be printed by the following program fragment?
for (i = 0; i < 5; i++)
for (j = 0; j < 4; j++)
WriteLine("{0} {1}", i, j);
20
6
9
12
ANS: 20
Output:
(
0 0
0 1
0 2
0 3
1 0
1 1
1 2
1 3
2 0
2 1
2 2
2 3
3 0
3 1
3 2
3 3
4 0
4 1
4 2
4 3
)
none of the above
QUESTION 3
How many lines of output will be printed by the following program fragment?
for (i = 0; i < 5; i += 2)
for (j = 0; j < 4; j = j + 2)
WriteLine("{0} {1}", i, j);
20
6
9
12
none of the above
Ans:12
Output:
(0
0
0
2
2
0
2
2
4
0
4
2
)
QUESTION 4
The sentinel value is used as the operand in the conditional expression for an indefinite loop.
True
False
Ans: TRUE
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.