C Programming - Control Instructions - Discussion
|
|
|
|
Read more:"Hold a true friend with both hands."
- (Proverb)
|
| 3. |
We want to test whether a value lies in the range 2 to 4 or 5 to 7. Can we do this using a switch? |
Answer: Option C
Explanation:
We can do this in following switch statement
switch(a)
{
case 2:
case 3:
case 4:
/* some statements */
break;
case 5:
case 6:
case 7:
/* some statements */
break;
}
|
|
Kamal said:
(Fri, Mar 18, 2011 12:09:49 PM)
|
|
| |
| It is only true when we are concerned with integer values. |
|
Leszek said:
(Sun, Jun 10, 2012 12:47:38 PM)
|
|
| |
| THis question is wrong. Correct answer is "Maybe we can, maybe we can't. Depends on the value we want to test". |
|
|