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

What will be the output of the following C code?
int x = 5;
if (x > 3)
printf("A");
else
printf("B");

Q.2Easy

Which of the following is NOT a valid control flow statement in C?

Q.3Easy

What is the output of this code?
for (int i = 0; i < 3; i++)
printf("%d ", i);

Q.4Easy

What is the difference between 'break' and 'continue' in loops?

Q.5Medium

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

Q.6Medium

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

Q.7Medium

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

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

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

Q.10Medium

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

Q.11Medium

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

Q.12Easy

Analyze the ternary operator: int x = (5 > 3) ? 10 : 20; What is the value of x?

Q.13Hard

What is the output of this program?
for (int i = 1; i <= 3; i++)
for (int j = 1; j <= 2; j++)
printf("%d", i*j);
printf("\n");

Q.14Easy

What is the behavior of goto in C?

Q.15Medium

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

Q.16Medium

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

Q.17Easy

Which statement is used to skip remaining iterations and move to next iteration?

Q.18Hard

What is the output of this complex nested control flow?
int x = 1, y = 2;
if (x < y) {
x++; y--;
if (x == y)
printf("Equal");
else
printf("NotEqual");
}

Q.19Easy

In C, which control flow statement is used to terminate a loop prematurely?

Q.20Medium

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