Single Choice Not Set

QWhich of the following cannot be checked in a switch-case statement?

ID: #1373 Decision Making of C Language 49,529 views
Question Info
#1373Q ID
Not SetDifficulty
Decision Making of C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Character ✔ ✖
  • B Integer ✔ ✖
  • C Float ✔ ✖
  • D enum ✔ ✖
Correct Answer

Explanation

Answer: Option C

The switch/case statement in the c language is defined by the language specification to use an int value, so you can not use a float value.

switch( expression )
{
    case constant-expression1:    statements 1;
    case constant-expression2:    statements 2;    
    case constant-expression3:    statements3 ;
    ...
    ...
    default : statements 4;
}

The value of the 'expression' in a switch-case statement must be an integer, char, short, long. Float and double are not allowed.

Today: 0 answered · 0 correct
Save progress
Free account

Want to remember what you got wrong?

Create a free account in seconds to track your score, revisit mistakes and continue Programming Language where you left off.

  • Save your progress & streak
  • Topic-wise quizzes & scores
  • Bookmark tricky questions
  • Printable MCQ sets
Practice smarterFree account · save progress
Sign up free
No Previous Next Question

Share This Question

Challenge a friend or share with your study group.