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
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");
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");
}
What happens when continue is used in a for loop with a post-increment expression?
What is the effect of using multiple break statements in nested loops?
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);
}
}
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");
What will this code do?
int i = 0;
while(i < 5) {
printf("%d ", i++);
if(i == 3) break;
}
Which statement best describes the 'dangling else' problem in C?
What is the output?
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
if(i == j) continue;
printf("Done");
What will this code print?
int x = 0;
while(x < 3) {
printf("%d ", x++);
if(x == 2) continue;
printf("X ");
}
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);
}
}
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?