Quiz 5: switch case


If you haven't already done so, be sure to read through Cprogramming.com's tutorial on Switch..Case. Otherwise, best of luck with the quiz! 

1. Which follows the case statement?
A. :
B. ;
C. -
D. A newline

Answer=A.

2. What is required to avoid falling through from one case to the next?
A. end;
B. break;
C. Stop;
D. A semicolon.

Answer=B.

3. What keyword covers unhandled possibilities?
A. all
B. contingency
C. default
D. other

Answer=C.

4. What is the result of the following code?
int x=0;

switch(x)

{

  case 1: printf( "One" );

  case 0: printf( "Zero" );

  case 2: printf( "Hello World" );

}
A. One
B. Zero
C. Hello World
D. ZeroHello World

Answer=D.

Next lesson: Lesson 6, pointers

1 comment:

  1. The article was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating,looking forward for more contents.

    by cognex AWS Training in chennai

    ReplyDelete