PAGETURNER
CLEAN
BOX
REVIEW
GO
The code for reading characters until the
END OF FILE or the END OF LINE or a TAB is:
a for (; (c = getchar()) && c != '\n' && c!= EOF &&
c != '\t'))
b while ((c = getchar() != EOF || c != '\n' ||
c != '\t'))
c do { c = getchar() } while (c != EOF || c != '\t'
&& c != '\n')
Select one:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Sorry, try again.
No, try one more time.
FORGET1
The correct choice is a , in b and c the logic
is wrong (OR (||) should not be there).
Which of the following statements is/are true?
a The expression validity at the bottom of the loop
is best tested with the do-while loop.
b The most effective construct for iteration between
explicit upper and lower limits is the while loop.
c The most common method for exiting (infinite) loops with
no boundary conditions is the continue statement.
d The for construct can be used for checking the
expression validity at the top of the loop.
e a and c g a and d
f a c and d h all of the above
Select one:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Sorry, try again.
No, try one more time.
Please Review C Loop Control Constructs!
FORGET2
The correct choice is g , the answer for b is the for
loop. The continue statement will transfer the program control
to the top of the loop, and not out of it!
Consider the construction:
while ( x > y ) {
if ( y > 17) { y++; continue; }
else
for (;;) { if ( ++y > 17) break; }
}
----------------------------------------------------------
After executing either the continue or the break
statement, the program control will transfer:
a to the top of for after the break is executed
b outside of the while after the break is executed
c to the same place, where either the continue
or the break will be executed again
Select one:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Sorry, try again.
No, try one more time.
Please review the while and for control constructs!
FORGET3
The correct choice is c , break will take program
control outside the for loop, but not outside the while loop.