Next: Review Questions Up: The while statement Previous: Summary

Multiple Choice Questions

while statements


Try to answer as many of the following Multi-choice questions as you can.

Do not panic if you make any errors. You can always start again by clicking on the "Restart" button, located at the bottom.


Your Details


Please enter your full name  :


The Questions


Q1.

What is the value of i after the while statement below?

n = 10;
i = 0;
while ( i < n ) {
 ...
 i++;
}
 
9
10
11

Q2.

What are the first and last values of i output by this loop?

n = 10;
i = 0;
while ( ++i < n ) {
  cout << i << endl;
}
 
1 and 9
0 and 9
0 and 10
1 and 10

Q3.

What are the first and last values of i output by this loop?

n = 10;
i = 0;
while ( i++ < n ) {
  cout << i << endl;
}
 
1 and 10
0 and 10
1 and 9
0 and 9


Once you have completed all the questions, and are quite happy with your answers. Then click on the "Submit Answers" button.

Clicking the "Restart" button will clear all your answers, ready to re-enter them.


Please send any comments about this page 



Next: Review Questions Up: The while statement Previous: Summary