Next: Review Questions Up: Nested if and if-else Previous: Summary

Multiple Choice Questions

Nested if 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 final value of x if initially x has the value 1?

 
if (x >= 0)
   x += 5;
else if (x >=5)
        x += 2;
 
8
6
1

Q2.

What is the final value of x if initially x has the value 0?

 
if (x >= 0)
  x += 5;
if (x >= 5)
  x += 2;
 
7
5
0


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