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.
Can we pass a structure variable to a function in C?
Answer: C
Structures can be passed by value (copy of structure) or by reference (using pointers to structure).
Q.182Easy
Which of the following is a key difference between struct and union in C?
Answer: B
In unions, all members share the same memory location, so only one member can hold a value at a time. In structs, each member has its own memory space.
Q.183Easy
What will be the output of sizeof() for the following union? union data { int a; float b; double c; }
Answer: B
The size of a union is the size of its largest member. Here, double (8 bytes) is the largest, so sizeof(union data) = 8 bytes.
Q.184Easy
In C, what is a self-referential structure?
Answer: A
A self-referential structure contains a pointer to its own type, commonly used in creating linked lists, trees, and other data structures.
Q.185Easy
Which keyword is used to define a new name for a structure in C?
Answer: B
The typedef keyword creates an alias for a data type, allowing you to use a shorter name instead of the full struct declaration.
Q.186Easy
What is the purpose of padding in C structures?
Answer: B
Padding adds unused bytes between members to align them on word boundaries, improving CPU access efficiency and performance.
Q.187Easy
How do you access a structure member through a pointer in C?
Answer: B
The arrow operator (->) is used to access structure members through a pointer. It dereferences the pointer and accesses the member in one operation.
Q.188Easy
What is the primary advantage of using structures in C?
Answer: B
Structures allow you to combine multiple data types into a single composite type, making code organization and data management more efficient.
Q.189Easy
What is the output of the following code? struct Point { int x; int y; }; struct Point p = {5}; printf("%d %d", p.x, p.y);
Answer: A
When initializing a struct with fewer values than members, remaining members are zero-initialized. p.x=5, p.y=0.
Q.190Easy
Which of the following is true about typedef struct?
Answer: A
typedef creates an alias for the struct type, allowing direct use without 'struct' keyword.
Q.191Easy
Consider union u { int i; char c; float f; }; What is the size of this union?
Answer: A
Union size equals the largest member size. float is typically 4 bytes, which is largest.
Q.192Easy
Which of these is a valid declaration of a structure variable using dot operator immediately after struct definition?
Answer: D
Both methods are valid - A uses named struct tag with variable declaration, C uses anonymous struct with variable declaration.
Q.193Easy
Which of the following correctly demonstrates self-referential structure (for linked list)?
Answer: A
In C, self-referential structures require the struct keyword in pointer declarations within the structure definition.
Q.194Easy
When structure is passed by value to a function, which of these is true?
Answer: B
Pass by value creates a complete copy of the structure on the function's stack frame.
Q.195Easy
What is the correct way to dynamically allocate an array of structures? struct Student { int roll; char name[50]; };
Answer: A
Correct allocation requires pointer declaration, proper cast, and multiplying n with sizeof(struct Student).
Q.196Easy
Which of the following statements about unions is correct?
Answer: A
Union members share the same memory location, and the union size equals the size of its largest member.
Q.197Easy
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.198Easy
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.199Easy
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.200Easy
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.