iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

978 questions | 100% Free

Q.41Medium

What is the output of the following code? for(int i = 1; i <= 3; i++) { for(int j = 1; j <= 2; j++) { if(i == 2 && j == 1) break; printf("%d%d ", i, j); } }

Q.42Medium

In a nested loop, if we use 'goto' statement, where does the control transfer?

Q.43Medium

What is the output? int x = 5; switch(x) { case 5: printf("Five"); case 6: printf("Six"); default: printf("Default"); }

Q.44Medium

What will be printed? for(int i = 0; i < 3; i++) { if(i == 1) goto skip; printf("%d ", i); } skip: printf("End");

Q.45Easy

Analyze the code: What happens when condition in if statement is false? if(0) { statements; } else { statements; }

Q.46Medium

What is the final value of x? int x = 0; for(int i = 1; i <= 5; i++) { if(i % 2 == 0) continue; x += i; }

Q.47Easy

In the ternary operator (? :), what happens if the condition is false?

Q.48Easy

What will be the result? for(int i = 1; i <= 4; i++) { if(i == 3) break; printf("%d ", i); }

Q.49Medium

In a switch statement with integer cases, can a case have a floating-point constant?

Q.50Easy

What is printed by this code? int x = 1, y = 2; if(x > y) printf("A"); else if(x < y) printf("B"); else printf("C");

Q.51Medium

What happens with this nested if? if(1) if(0) printf("A"); else printf("B");

Q.52Medium

Predict the output: for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) if(i + j == 1) continue; printf("Done");

Q.53Medium

What is the behavior of this code? int i = 0; while(1) { i++; if(i > 5) break; }

Q.54Easy

Which statement best describes the difference between break and continue?

Q.55Easy

What value does the ternary operator return? int result = (5 > 3) ? 10 : 20;

Q.56Hard

What is the output of this complex nested loop? for(int i = 1; i <= 2; i++) { for(int j = 1; j <= 2; j++) { if(i == j) continue; printf("%d%d ", i, j); } }

Q.57Easy

Which of the following control flow statements will cause a compilation error in C?

Q.58Easy

What is the primary difference between while and do-while loops?

Q.59Easy

In a switch statement, if a case label is missing the break statement, what occurs?

Q.60Easy

Which control flow statement allows jumping to a labeled location in C?