Computer Science for IGCSE & O level - Programming (Section 16 - No. 13)

What would be the outcome if the `answer` variable is given the value "*" in a case statement where cases are defined for '+', '-', '*' and '/', but no default case is available?
The code block corresponding to the '*' case would be executed.
The code block for the '+' case would be executed.
No code block would be executed.
The program would exit with an error.

Explanation

The program will search for a match. Because the '*' is a value in the cases, the code block will execute.

Comments (0)

Advertisement