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.
Consider: union Data { int i; float f; char c; }; What is the size of this union?
Answer: A
The size of a union equals the size of its largest member. Here, int is 4 bytes (largest), so union size is 4 bytes.
Q.22Easy
How do you access a member of a structure through a pointer in C?
Answer: B
The arrow operator (->) is used to access structure members through a pointer. The dot operator is used with direct variables.
Q.23Easy
Which of the following correctly demonstrates a typedef for a structure?
Answer: A
The correct syntax for typedef struct is: typedef struct { members } StructName;
Q.24Easy
Which of the following is the correct way to initialize a structure in C?
Answer: A
Structures must be initialized at declaration time using curly braces. Assignment of initializer list is not valid after declaration.
Q.25Easy
Which of the following statements about structures is TRUE?
Answer: B
A structure allows grouping of different data types. Padding may be added by the compiler for alignment.
Q.26Easy
Consider the following code: struct Data { int a; char b; }; struct Data d = {10, 'A'}; Which method of initialization is used here?
Answer: B
Values are assigned in the order they appear in the structure definition, which is positional initialization.
Q.27Easy
What is the primary difference between a struct and a union in C?
Answer: A
In a union, all members occupy the same memory space, while struct members have individual memory locations.
Q.28Easy
Which of the following correctly demonstrates accessing a member of a pointer to a structure?
Answer: B
Both (*ptr).member and ptr->member are valid. Option B uses explicit dereferencing, while the arrow operator is syntactic sugar for this.
Q.29Easy
In C, what does the 'typedef' keyword do when used with structures?
Answer: A
typedef creates an alias, allowing you to use the structure name directly without using 'struct' keyword.
Q.30Easy
Given: struct Node { int data; struct Node *next; }; This represents which data structure concept?
Answer: B
A self-referential structure with a single pointer member is the fundamental building block of a singly linked list.
Q.31Easy
In the context of structures, what does 'self-referential' mean?
Answer: A
Self-referential structures contain pointers to their own type, enabling dynamic data structures like linked lists and trees.
Q.32Easy
What is the key difference between a structure and a union in C?
Answer: B
In structures, memory is allocated for each member independently. In unions, all members share the same memory location, so total memory allocated equals the size of the largest member.
Q.33Easy
struct Node { int data; struct Node *next; }; This is an example of which design pattern?
Answer: B
A self-referential structure contains a pointer to its own type. This is the fundamental building block for creating linked lists, trees, and other dynamic data structures.
Q.34Easy
Given a structure with array members, how would you efficiently pass it to a function to avoid copying overhead?
Answer: B
Passing a pointer to the structure avoids copying the entire structure in memory, which is especially important for large structures with array members. This improves performance significantly.