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

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.2Hard

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.3Hard

What happens when continue is used in a for loop with a post-increment expression?

Q.4Hard

What is the effect of using multiple break statements in nested loops?

Q.5Hard

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.6Hard

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.7Hard

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

Q.8Hard

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

Q.9Hard

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

Q.10Hard

What will this code print?
int x = 0;
while(x < 3) {
printf("%d ", x++);
if(x == 2) continue;
printf("X ");
}

Q.11Hard

What will be printed?
int i = 0, j = 0;
for(i = 0; i < 3; i++) {
for(j = 0; j < 3; j++) {
if(i + j == 2) break;
printf("%d%d ", i, j);
}
}

Q.12Hard

Consider the code:
int sum = 0;
for(int i = 1; i <= 10; i++) {
if(i % 2 == 0) continue;
sum += i;
}
printf("%d", sum);
What will be printed?