MCQ Single Best Answer Not Set

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

ID: #1373 Decision Making of C Language 49,487 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: Option C

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.

No Previous Next Question

Share This Question

Challenge a friend or share with your study group.