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.1Hard

Which statement is true about nested structures in C?

Q.2Hard

What happens if you assign a union member and then access another member?
struct u { int a; char b; }; u.a = 257; printf("%d", u.b);

Q.3Hard

How can you initialize a structure array of 10 elements partially in C?

Q.4Hard

What is the difference between self-referential and recursive structures?

Q.5Hard

Given union test { int x; char y[4]; }; If you set y[0]=65, y[1]=66, what happens to x?

Q.6Hard

Which approach is more memory efficient for storing 100 flags: array of char or bit fields in a structure?

Q.7Hard

In nested structures with pointers, which access method is correct? struct outer { struct inner *ptr; } *o; Accessing inner's member x:

Q.8Hard

What is the relationship between structure alignment and padding in modern C compilers?

Q.9Hard

In a structure with flexible array members, which statement is INCORRECT?
struct FlexArray { int len; int arr[]; };

Q.10Hard

What is the output of the following?
struct S { int a:3; int b:3; int c:3; };
printf("%zu", sizeof(struct S));

Q.11Hard

In competitive programming, when should you use union instead of struct?

Q.12Hard

What will be the output of this code?
struct X { int a; float b; };
struct Y { struct X x; int c; };
printf("%zu", sizeof(struct Y));

Q.13Hard

In a structure, what does the #pragma pack(1) directive do?

Q.14Hard

If a structure contains a flexible array member, where must it be declared?

Q.15Hard

In competitive programming, when implementing a graph using adjacency lists, which data structure is most suitable?

Q.16Hard

If you have a structure with bit fields, which statement about their behavior is true?

Q.17Hard

What is the output of this complex code?
struct S { char c; int i; } s;
printf("%lu", sizeof(s));

Q.18Hard

In competitive programming, when you need a structure that can hold either an integer or a floating-point number (but not both simultaneously) in the most memory-efficient way, which should you use?

Q.19Hard

What will be the output of the following code?
union Test {
int a;
char b;
};
union Test t;
t.a = 65;
printf("%d %c", t.a, t.b);

Q.20Hard

In competitive programming for GATE/ISRO 2025, which scenario would union be preferable over structure?