QUESTION 13 Using the declaration shown below, _____________ is printed on each
ID: 3708453 • Letter: Q
Question
QUESTION 13
Using the declaration shown below, _____________ is printed on each line
for (int i = 0; i < 2; i++)
{
for(int k = 0; k < 3; k++)
{
Write(k);
}
WriteLine( );
}
QUESTION 14
Using the declaration shown below, _____________ lines are printed.
for (int i = 0; i < 2; i++)
{
for(int k = 0; k < 3; k++)
{
Write(k);
}
WriteLine( );
}
QUESTION 15
An advantage of sentinel-controlled loops is you do not need to know how many times the loop will be performed.
True
False
Explanation / Answer
a) 012 is printed on each line
Inner loop is printing the number and outer loop is changing the line.
b) Outer loop is changing the line, hence 2 lines will be printed. i from 0 to less than 2.
Then it will be 2 loops and hence 2 lines.
c) True, because you dont know how many times data needs to be processed, but when data is entirely processed you can set the value of senital such that the loop terminates.