C - Control Flow Constructions Questions and Answers

Practice Mode
Showing 10 of 62 questions
Q31
 When is default statement executed in swich-case construct ?
  • A Whenever there is exactly one match
  • B whenever break statement is omitted in all case statements.
  • C Whenever there is no match with case labels.
  • D options b and c.
Answer: Option D
Q32
 C is an example of 
  • A object oriented language
  • B structured programming language
  • C object based language
  • D component based language
Answer: Option B
Q33
 The syntax of if statement is 
  • A If expression then program -statement
  • B if (expression) program - statement
  • C if (expression) then program-statement
  • D if expression { program- satement}
Answer: Option B
Q34
 main ( )          {            int a = 2, b = 4, c =8, x =4;            if ( x == b ) x = a; else x = b;            if ( x ! = b ) c = c + b ; else c = c +a ;            printf ( "c = %d\n", c );           } What will be printed when the above code is executed ?
  • A c = 4
  • B c = 8
  • C c = 10
  • D c = 12
Answer: Option D
Q35
 main ( )             {                unsigned int x = -10; int y =  10 ;              if ( y <= x ) printf ("He is good \n");              if ( y = = ( x = -10) ) printf (" She is better/n"); if ( ( int ) x = = y) printf ("It is the best\n");          } What will be the output of above sample code ?
  • A She is better
  • B He is good It is the best
  • C It is the best
  • D He is good
Answer: Option D
Q36
 If (  3.14) printf (" The vaLue of exponent\"); else printf ("The value of PIE is used in conditional part\n"); What might bethe result ?
  • A Float value can't be given in conditional part.
  • B The value of PIE is used in conditional part.
  • C The value of exponent.
  • D None of the above.
Answer: Option B
Q37
 main ( )       {       int x ;     If ( x > 4 ) printf ( "Brindha");    else if ( x > 10 ) printf ( " Karthik");      else if ( x > 21) printf ( " Pradeep");             else printf (" Sandeep");       } What will be the value of x so that "Karthik" willbe printed?
  • A from 10 ti 21
  • B from 11 to 21
  • C greater than 10
  • D none.
Answer: Option D
Q38
 main ( )            {             i = 0; j = 0;            for ( j = 1; j <10; j++)          {i = i+1; }            } In the (generic) segment above, what will be the value of the variable i on completion ?
  • A 1
  • B 3
  • C 9
  • D 10
Answer: Option C
Q39
 main ( )          {          int x = 0;         for ( (x = 1; x < 4;  x++);         printf (" x =%d\n", x);         } What will be printed when the above sample is executed ?
  • A x = 0
  • B x = 1
  • C x = 3
  • D x = 4
Answer: Option D
Q40
 main ( )            {             int x = 0;             for (; ; )             {               if (x++ = 4) break ;              continue;              printf ("x=%d\n",x);         what will be printed when the above code is executed ?
  • A x = 0
  • B x = 1
  • C x = 4
  • D x = 5
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test