Java Programming

CONDITIONAL STATEMENTS MULTIPLE CHOICE QUESTIONS

1

If a conditional structure has 5 condition options, how many else if clauses are required?

A.

5

B.

7

C.

3

D.

2

2

What happens in a switch statement if the break statement is omitted after a case block matches and executes?

A.

The program immediately crashes with a compilation error.

B.

The switch statement loops back to check the condition again.

C.

The execution falls through to subsequent cases until a break is found or the block ends.

D.

The default case is automatically triggered.

3

How does a Java program check if an integer (num) is even using conditional statements?

A.

if (num / 2 == 0)

B.

if (num % 2 == 0)

C.

if (num * 2 == 0)

D.

if (num - 2 == 0)

4

What is the main purpose of using nested if-else statements?

A.

To make the program run twice as fast

B.

To replace all switch statements in the entire program

C.

To automatically handle input mismatch exceptions without a Scanner

D.

To allow checking multiple conditions in a hierarchical manner (such as verifying a valid score range first)

5

Which keyword is used in Java to define a switch case when none of the specified case labels match the variable expression?

A.

default

B.

else

C.

catch

D.

other