iGET

C Programming - MCQ Practice Questions

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

978 questions | 100% Free

Q.621Medium

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

Q.622Easy

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

Q.623Medium

What will be the output of this code? union Data { int x; char y; }; Data d = {65}; d.y = 'A'; printf("%d", d.x);

Q.624Easy

Which of these is a valid declaration of a structure variable using dot operator immediately after struct definition?

Q.625Medium

What is the issue with bit fields in structures regarding portability?

Q.626Hard

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

Q.627Medium

What happens when you access a union member that wasn't the last one to be written?

Q.628Easy

Which of the following correctly demonstrates self-referential structure (for linked list)?

Q.629Hard

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

Q.630Medium

When comparing nested structures, which access method is INVALID? struct Address { char city[20]; }; struct Person { Address addr; }; Person p;

Q.631Medium

Which structure feature is most suitable for implementing a state machine with limited states?

Q.632Medium

What is the primary use case for unions in embedded systems?

Q.633Easy

When structure is passed by value to a function, which of these is true?

Q.634Easy

What is the correct way to dynamically allocate an array of structures? struct Student { int roll; char name[50]; };

Q.635Hard

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

Q.636Hard

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

What is the size of the following structure on a 32-bit system? struct Point { char c; int x; };

Q.638Easy

Which of the following statements about unions is correct?

Q.639Easy

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

Q.640Medium

Which feature of structures makes them suitable for implementing linked lists?