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

What is the output of the following code?
int x = 5;
if(x > 3)
if(x < 10)
printf("Pass");
else
printf("Fail");

Q.262Easy

Which looping construct in C allows initialization, condition, and increment to be placed in a single line?

Q.263Easy

In which scenario would a do-while loop be preferred over a while loop?

Q.264Medium

What is the output?
int x = 10;
while(x-- > 5) {
printf("%d ", x);
}

Q.265Medium

Which of the following statements about switch case is TRUE?

Q.266Medium

What will this code output?
for(int i = 1; i <= 3; i++) {
for(int j = 1; j <= i; j++) {
printf("%d", j);
}
printf("\n");
}

Q.267Easy

What is the purpose of the ternary operator (? :) in C?

Q.268Medium

How many times will the loop execute?
int i = 0;
while(i++ < 5) {
printf("%d ", i);
}

Q.269Medium

What will be the output of this code?
int n = 5;
switch(n) {
case 4: printf("Four");
case 5: printf("Five");
case 6: printf("Six");
break;
default: printf("Other");
}

Q.270Medium

Which control structure would be most efficient to validate if a number is within one of several specific values?

Q.271Hard

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

In C programming, what is the difference between break in a loop and break in a switch statement?

Q.273Hard

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

Q.274Easy

Which statement is true about the goto statement in modern C programming practices?

Q.275Hard

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

What is the output of this code?
char ch = 'B';
switch(ch) {
case 'A':
case 'B':
case 'C': printf("Vowel");
break;
default: printf("Consonant");
}

Q.277Medium

In a for loop with multiple break statements in different conditions, which break will be executed?

Q.278Easy

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

Q.279Easy

Consider the following code snippet:
int x = 5;
do {
printf("%d ", x);
x--;
} while(x > 0);
What will be the output?

Q.280Medium

In nested loops, if an inner loop contains a break statement, what happens?