C - Control Flow Constructions Questions and Answers
Control Flow Constructions in C are fundamental to defining how a program executes statements based on conditions, loops, and decisions. This topic focuses on essential C programming questions and answers that help you master control statements like if-else, switch, for, while, and do-while loops. Whether you’re preparing for placement drives at TCS, Wipro, or Infosys, or aiming to crack technical rounds in coding interviews, these control flow MCQs will test your logical understanding and practical knowledge. Practice these C Control Flow Constructions questions with answers to improve your coding efficiency and logic-building skills.
C - Control Flow Constructions
Showing 10 of
62 questions
41. main ( ) { int i = 0; for ( ; ++ i ;) printf ( "%d", i ); } How many times the for loop will be executed ?
- 0
- infinite
- 32767
- The maximum integer value that can be represented in the machine.
42. main ( ) { unsigned int i =10 ; while ( i - - > = 0) ; } How many times the loop will be executed ?
- 10
- zero time
- one time
- none
43. 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 ?
- SCORE = 5
- SCORE = 4
- SCORE = 9
- SCORE = 10
44. 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 ?
- SCORE = 5
- SCORE = 4
- SCORE = 9
- SCORE = 10
45. 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 ?
- 2
- 1 or 3 or 4
- any int value other than 1, 2, 3 and 4
- 4
46. 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 ?
- 0
- 1
- -ve is not allowed in the mod operands.
- none
47. 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 ?
- 0
- 1
- -ve is not allowed in the mod operands.
- none
48. 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 ) ;
- 1
- 2
- 3
- 4
49. Omitting the break statement from a particular case
- leads to a syntax error
- causes execution to terminate after that case
- causes execution to continue all subsequent cases
- causes execution to branch to the statement after the switch statement
50. int i ; i=2; i++; if (i = 4) { printf "i=4"); } else { printf("i=3"); } what is the out of the program ?
- i = 4
- i = 3
- unpredictable
- none