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

In the expression: int arr[5]; int *p = arr; What does p + 2 represent?

Q.282Medium

What is the purpose of the const keyword in: int * const p;?

Q.283Medium

Which scenario demonstrates a dangling pointer?

Q.284Medium

For function: void modify(int *x) { *x = 20; } If called as modify(&a), what changes?

Q.285Medium

Which of the following is valid pointer comparison?

Q.286Medium

In: int *p; *p = 10; What is the issue?

Q.287Medium

For dynamic 2D array allocation using int arr = (int)malloc(n*sizeof(int*)); what must be done next?

Q.288Medium

Which of the following is a valid pointer comparison in C?

Q.289Medium

What will be the output?
int arr[5] = {1,2,3,4,5};
int *p = arr;
p += 2;
printf("%d", *p);

Q.290Medium

In pointer to function declaration: int (*ptr)(int, int); which statement is correct?

Q.291Medium

Consider a function void modify(int *x) { *x = 20; } called as modify(&y). What happens?

Q.292Medium

What happens when you initialize a structure variable without assigning values?

Q.293Medium

Which of the following correctly declares a pointer to a structure?

Q.294Medium

What is the difference between struct and typedef struct?

Q.295Medium

What will be printed?
struct s { int a; char b; int c; }; printf("%lu", sizeof(struct s));

Q.296Medium

How do you access a member of a structure using a pointer?

Q.297Medium

What is the purpose of padding in structures?

Q.298Medium

Consider: union u { int x; double y; }; What is sizeof(u)?

Q.299Medium

Consider struct test { int x; double y; char z; }; What is the minimum size of this structure (assuming 4-byte int, 8-byte double)?

Q.300Medium

What will be printed by this code? struct s { int a; struct s *next; }; struct s *ptr; sizeof(struct s)