C - Control Flow Constructions Questions and Answers

Practice Mode
Showing 10 of 62 questions
Q41
 main ( )          {           int i = 0;          for ( ; ++ i ;)          printf ( "%d", i );          }  How many times the for loop will be executed ?
  • A 0
  • B infinite
  • C 32767
  • D The maximum integer value that can be represented in the machine.
Answer: Option D
Q42
 main ( )        {         unsigned int i =10 ;        while ( i - - > = 0) ;       } How many times the loop will be executed ?
  • A 10
  • B zero time
  • C one time
  • D none
Answer: Option D
Q43
 main ( )            {              int score = 4 ;              switch (score)                  {                    default :                                  ;                    case 3 :                        score +=5;                       if ( score == 8)                    {                      score ++;                      if (score == 9) break ;                       score *= 2;                   }                  score -=4;                   break;              case 8:                      score +=5;                       break ;                  }             printf ("score = %d\n", score);            } What will be the output of the above code ?     
  • A SCORE = 5
  • B SCORE = 4
  • C SCORE = 9
  • D SCORE = 10
Answer: Option A
Q44
 main ( )             {             int score = 4;             switch (score)                 {                  default:                              ;                    case 3 :                              score += 5;                     if ( score = = 8)                      {                   score++;                   if ( score = = 9) break ;                    score *= 2;                      }                    score -=4;                     break;                  case 8:                        score +=5;                        break;                      } printf ( "SCORE = %d\n", score);                     } What will be the output of the above code ?  
  • A SCORE = 5
  • B SCORE = 4
  • C SCORE = 9
  • D SCORE = 10
Answer: Option A
Q45
switch (s)    {     case 1 : printf ("Balan")     case 2 :      case 3 : printf ("Elango")     case 4 : printf ("Thiruvalluvan")    default : printf ("Kamban")   } To print only Kamban, what will be the value of s ?
  • A 2
  • B 1 or 3 or 4
  • C any int value other than 1, 2, 3 and 4
  • D 4
Answer: Option C
Q46
 main ( )           {             int a =-4, r, num = 1;             r = a% -3;             r = ( r ? 0 : num * num) ;            printf ("%d". r);           }  What will be the output of the program ?
  • A 0
  • B 1
  • C -ve is not allowed in the mod operands.
  • D none
Answer: Option A
Q47
 main ( )           {             int a =-4, r, num = 1;             r = a% -3;             r = ( r ? 0 : num * num) ;            printf ("%d". r);           }  What will be the output of the program ?
  • A 0
  • B 1
  • C -ve is not allowed in the mod operands.
  • D none
Answer: Option A
Q48
 What is the value of int variable result if x = 50, y = 75 and z = 100? result = ( x + 50 ? y >= 75 ? z > 100 ? 1 : 2 : 3 : 4 ) ;
  • A 1
  • B 2
  • C 3
  • D 4
Answer: Option B
Q49
 Omitting the break statement from a particular case
  • A leads to a syntax error
  • B causes execution to terminate after that case
  • C causes execution to continue all subsequent cases
  • D causes execution to branch to the statement after the switch statement
Answer: Option C
Q50
 int i ; i=2; i++; if (i = 4)     {       printf "i=4");      } else    {     printf("i=3");   } what is the out of the program ?
  • A i = 4
  • B i = 3
  • C unpredictable
  • D none
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test