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.61Medium

Consider the code: int x = 5; if(x > 3) if(x > 10) printf("A"); else printf("B"); Which statement best describes the output?

Q.62Medium

What does the following code segment accomplish? int i = 0; while(i < 5) { if(i == 2) { i++; continue; } printf("%d ", i); i++; }

Q.63Easy

In the ternary operator expression (condition ? expr1 : expr2), if condition is true, which expression evaluates?

Q.64Medium

Which of the following is a valid use of the switch statement in C?

Q.65Medium

Analyze: What is printed by this code? for(int i = 1; i <= 3; i++) { for(int j = 1; j <= i; j++) { printf("%d", i); } printf(" "); }

Q.66Medium

What happens when you use break in a nested loop structure?

Q.67Easy

Which statement is true about the goto statement in modern C programming?

Q.68Medium

Consider the code: int x = 0; while(1) { if(++x > 3) break; printf("%d ", x); } What is the output?

Q.69Medium

What is the key distinction between if-else and switch statements in terms of evaluation?

Q.70Medium

What does the following code segment do? int i = 0; do { printf("%d ", i); } while(++i < 3);

Q.71Easy

In a for loop for(int i = 0; i < 5; i++), at what point does the increment happen?

Q.72Hard

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

Q.73Medium

Consider: switch(x) { case 1: case 2: case 3: printf("A"); break; default: printf("B"); } What advantage does stacking cases provide?

Q.74Hard

What will this code do? int i = 0; while(i < 5) { printf("%d ", i++); if(i == 3) break; }

Q.75Hard

Which statement best describes the 'dangling else' problem in C?

Q.76Medium

What does continue do in a for loop with multiple statements in body?

Q.77Easy

In a nested loop structure, which statement is used to skip the current iteration of the innermost loop only?

Q.78Medium

What is the output of the following code? int x = 5; if(x > 3) if(x < 10) printf("Pass"); else printf("Fail");

Q.79Easy

Which looping construct in C allows initialization, condition, and increment to be placed in a single line?

Q.80Easy

In which scenario would a do-while loop be preferred over a while loop?