iGET

C Programming - MCQ Practice Questions

C questions in placement tests and university exams are rarely about syntax alone. Most of what you will find here is output prediction, pointer arithmetic, arrays and strings, structures and unions, storage classes, recursion, and file handling. The explanations walk through memory behaviour step by step, which is usually where the confusion sits rather than in the code itself.

972 questions | 100% Free

Q.221Medium

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

Q.222Medium

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

Q.223Easy

Which keyword is used to exit a loop prematurely in C?

Q.224Medium

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

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

Q.226Medium

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

Q.227Medium

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

Q.228Easy

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

Q.229Medium

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.230Easy

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

Q.231Easy

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

Q.232Medium

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

Q.233Easy

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

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

Q.235Medium

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

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

Q.237Easy

Which statement best describes the difference between break and continue?

Q.238Easy

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

Q.239Hard

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.240Easy

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