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

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

Q.102Medium

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

Q.103Medium

Consider a switch statement with multiple cases. If a case matches and break is omitted, what happens?

Q.104Medium

What will be the behavior of a for loop with an empty body and no statements inside braces?

Q.105Medium

What is the output of executing break in a nested loop context?

Q.106Medium

Which of the following correctly uses the conditional (ternary) operator?

Q.107Medium

How many times will a do-while loop execute if the condition is initially false?

Q.108Medium

In control flow, which statement is used to explicitly exit from a program?

Q.109Medium

In a switch statement, case values must be of which type?

Q.110Medium

What is the scope of a variable declared in the initialization section of a for loop?

Q.111Medium

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

Q.112Medium

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

Q.113Medium

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

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

Q.115Medium

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

Q.116Medium

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

Q.117Medium

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

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

Q.119Medium

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

Q.120Medium

Predict the output:
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
if(i + j == 1) continue;
printf("Done");