In a simple ‘if’ statement with no ‘else’. What happens if the condition following the ‘if is false? A. the program searches for the last else in the program B. nothing C. control ‘falls through’ to the statement following ‘if D. the body of the statement is executed E. None of the above

the program searches for the last else in the program
nothing
control 'falls through' to the statement following 'if
the body of the statement is executed E. None of the above

The correct answer is: C. control ‘falls through’ to the statement following ‘if’.

If the condition following the ‘if’ is false, then the body of the statement is not executed. Instead, control ‘falls through’ to the statement following ‘if’. This means that the next statement in the program will be executed, as if the ‘if’ statement had never been there.

For example, consider the following code:

if (condition) {
statement1;
}
statement2;

If the condition is true, then statement1 will be executed. However, if the condition is false, then statement1 will not be executed and control will ‘fall through’ to statement2.

The other options are incorrect. Option A is incorrect because the program does not search for the last else in

the program. Option B is incorrect because something does happen if the condition following the ‘if’ is false. Option D is incorrect because the body of the statement is not executed if the condition following the ‘if’ is false. Option E is incorrect because the correct answer is C.