← Quiz: C Control Flow: all 10 questions
Quiz: C Control Flow · Question 8 of 10
Which of these cannot be used as the expression in a switch?
Which of these cannot be used as the expression in a switch?
- A.An int variable
- B.A char variable
- C.A string such as "add"
- D.An expression like n % 3
Answer & explanation
Correct answer: A string such as "add"
switch works only with integer types and characters, not strings or floating-point values.
Can you get the rest right without peeking?
Take the timed Quiz: C Control Flow quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →