iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

972 questions | 100% Free

Q.601Easy

What is the purpose of padding in C structures?

Q.602Easy

How do you access a structure member through a pointer in C?

Q.603Medium

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

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

Q.605Medium

In a nested structure, how do you access the innermost member? struct outer { struct inner { int value; } in; } obj;

Q.606Easy

What is the primary advantage of using structures in C?

Q.607Medium

Which of the following correctly initializes a structure array? struct point { int x, y; } arr[3] = ?

Q.608Medium

What happens when you modify a union member that overlaps with another?

Q.609Medium

Which statement is correct about bit fields in structures?

Q.610Medium

What is the difference between struct tag and struct type in C?

Q.611Hard

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

Q.612Medium

What will be the behavior of this code? struct s { int a; }; struct s obj = {5}; struct s *ptr = &obj; ptr->a = 10; printf("%d", obj.a);

Q.613Hard

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

Q.614Hard

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

Q.615Medium

Which initialization method for structures is used in designated initializers (C99 feature)?

Q.616Easy

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);

Q.617Medium

How much memory (in bytes) will the following structure occupy on a 32-bit system? struct Data { char c; int i; short s; };

Q.618Easy

Which of the following is true about typedef struct?

Q.619Medium

What is the primary difference between passing a structure by value vs by pointer in function calls?

Q.620Easy

Consider union u { int i; char c; float f; }; What is the size of this union?