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

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.622Easy

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

Q.623Medium

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

Q.624Hard

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

Q.625Medium

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

Q.626Easy

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

Q.627Hard

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

Q.628Medium

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

Q.629Medium

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

Q.630Medium

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

Q.631Easy

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

Q.632Easy

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

Q.633Hard

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

Q.634Hard

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

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

Q.636Easy

Which of the following statements about unions is correct?

Q.637Easy

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

Q.638Medium

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

Q.639Easy

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

Q.640Medium

What happens if you attempt to assign one structure variable to another of the same type?