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
Which of the following is the correct syntax to declare a variable in C?
What does the following code snippet output?
#include <stdio.h>
int main() {
int x = 5;
printf("%d", x++);
return 0;
}
Which of the following is NOT a valid C keyword?
What is the output of: printf("%d", 5 + 3 * 2)?
Which of the following is the correct way to define a constant in C?
What is the purpose of the main() function in C?
What will be the output of: int x = 10; printf("%d %d", x, x++);
Which escape sequence represents a tab character in C?
What is the return type of strlen() function?
Consider: void func(int *p); Which statement is correct about this function declaration?
What will happen if we try to modify a const variable in C?
Which of the following correctly represents a character constant in C?
Consider the expression: int arr[5]; What does arr represent without the index?
What is the output of: printf("%f", );
Which storage class has a default value of 0 if not explicitly initialized?
What will be the output of the following code?
#include <stdio.h>
int main() {
int x = 5;
printf("%d", ++x + x++);
return 0;
}
What is the size of the following structure in bytes (assuming 32-bit system)?
struct Point {
char c;
int x;
double d;
}
What will be printed by the following code?
#include <stdio.h>
int main() {
float f = 0.1 + 0.2;
if(f == 0.3)
printf("Equal");
else
printf("Not Equal");
return 0;
}
Which keyword is used to create a variable that cannot be modified after initialization?
What is the output of the following code?
#include <stdio.h>
int main() {
int arr[] = {10, 20, 30};
printf("%d", *(arr + 1));
return 0;
}