Q. Which control statement allows you to execute different blocks of code based on the value of a variable?

A
for loop
B
if-else ladder
C
switch statement
D
while loop
Solution:

The switch statement evaluates an expression, matches the expression’s value to a case label, and executes the statements associated with that case.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!