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

What will be printed? int x = 0; if (x = 5) printf("True"); else printf("False");

Q.2Medium

What is the output? for (int i = 1; i <= 5; i++) { if (i == 3) break; printf("%d ", i); }

Q.3Medium

What does the following nested if-else produce? int a = 10, b = 20; if (a > b) if (b > 0) printf("X"); else printf("Y");

Q.4Medium

What is the output of this switch statement? int x = 2; switch(x) { case 1: printf("One"); break; case 2: printf("Two"); case 3: printf("Three"); break; default: printf("Other"); }

Q.5Medium

How many times will this loop execute? for (int i = 0; i < 5; ++i) { if (i == 2) continue; if (i == 4) break; }

Q.6Medium

What is printed by this code? int x = 5; while (x-- > 0) printf("%d ", x);

Q.7Medium

What is the output? int n = 1; do { printf("%d ", n); n++; } while (n > 5);

Q.8Medium

Determine the output: int i = 0; while (i < 3) { printf("%d ", i++); }

Q.9Medium

What does this code segment output? for (int i = 0; i < 5; i++) { if (i % 2 == 0) continue; printf("%d ", i); }

Q.10Medium

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

Q.11Medium

Consider a switch statement with multiple cases. If a case matches and break is omitted, what happens?

Q.12Medium

What will be the behavior of a for loop with an empty body and no statements inside braces?

Q.13Medium

What is the output of executing break in a nested loop context?

Q.14Medium

Which of the following correctly uses the conditional (ternary) operator?

Q.15Medium

How many times will a do-while loop execute if the condition is initially false?

Q.16Medium

In control flow, which statement is used to explicitly exit from a program?

Q.17Medium

In a switch statement, case values must be of which type?

Q.18Medium

What is the scope of a variable declared in the initialization section of a for loop?

Q.19Medium

Which statement is best suited for implementing a menu-driven program with exact matching?

Q.20Medium

What will be the output of the following code? int i = 0; while(i < 3) { printf("%d ", i++); if(i == 2) continue; }