IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C++ Programming C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Civil Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C Programming - Control Instructions - Discussion

@ : Home > C Programming > Control Instructions > General Questions - Discussion

Read more:

"Everything should be made as simple as possible, but not simpler."
- Albert Einstein
5. 

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

[A]. Character[B]. Integer
[C]. Float[D]. enum

Answer: Option E

Explanation:

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.


K.Suriya said: (Sat, May 14, 2011 12:59:56 PM)    
 
Case value must be an int, char, enum but not double and float float is the answer for this question.

Hemanth said: (Sat, Jul 23, 2011 05:38:44 PM)    
 
Why enum cannot be the answer? Any reason plzzzzz.

Tarun Singh Kiit said: (Sat, Jul 30, 2011 03:32:59 PM)    
 
Switch case does not accept the float value.

Praveen said: (Tue, Aug 2, 2011 08:56:12 PM)    
 
Why enum cannot be the answer? Any reason......

Diya said: (Tue, Aug 2, 2011 09:55:42 PM)    
 
Can enum be checked in a switch-case statement?

Pruthvi said: (Sun, Sep 4, 2011 02:27:27 AM)    
 
Yes. Enum can be checked. As an integer value is used in enum.

Vinita said: (Wed, Oct 12, 2011 09:42:29 PM)    
 
Thanks Pruthvi.

Manojit said: (Sat, Feb 11, 2012 07:41:08 PM)    
 
The switch/case statement convert the float into an int and use it, so long as the resulting values and functionality meet your functional requirements.

Rangasamy said: (Sun, Jul 1, 2012 11:43:27 PM)    
 
Can you explain the use of enum in switch statement with a program ?

Write your comments here:
Name *:     Email:


© 2008-2013 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Contact us: info@indiabix.com     Follow us on twitter!