Next: Review Questions Up: The if-else Statement Previous: Summary

Multiple Choice Questions

if-else 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.

If y has the value 5 what will be the value of the variable y after the following piece of C++ is executed?

if (y > 0)
    y += 2;
else
    y = 3;
 
5
7
3
2

Q2.

Consider the following section of code:

if ( base < height )
    cout << "Top heavy structure" << endl;
else
    cout << "Stable structure" << endl;
 
Which of the following possible values for base and height cause the message Stable structure to be printed? base = 5, height = 3
base = 8, height = 8
base = 2, height = 7


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 if-else Statement Previous: Summary