🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.An int variable
  2. B.A char variable
  3. C.A string such as "add"
  4. 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 →