Next: Review Questions Up: The for statement Previous: Summary
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.
Please enter your full name :
What is the value of i after the for statement below?
i
for
n = 100; for ( i = 0; i < n; i++ ) { ... }
99
100
101
What are the first and last values of i output by this loop?
n = 20; for ( i = 0; i < n; i++ ) { cout << i << endl; }
n = 15; i = 0; for( i = 0; i <= n; i++ ) { cout << i << endl; }
What is the last value of i output by this loop?
n = 27; i = 0; for( i = 0; i <= n; i+= 2 ) { cout << i << endl; }
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.