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
Consider union u { int i; char c; float f; }; What is the size of this union?
What will be the output of this code? union Data { int x; char y; }; Data d = {65}; d.y = 'A'; printf("%d", d.x);
Which of these is a valid declaration of a structure variable using dot operator immediately after struct definition?
What is the issue with bit fields in structures regarding portability?
In a structure with flexible array members, which statement is INCORRECT? struct FlexArray { int len; int arr[]; };
What happens when you access a union member that wasn't the last one to be written?
Which of the following correctly demonstrates self-referential structure (for linked list)?
What is the output of the following? struct S { int a:3; int b:3; int c:3; }; printf("%zu", sizeof(struct S));
When comparing nested structures, which access method is INVALID? struct Address { char city[20]; }; struct Person { Address addr; }; Person p;
Which structure feature is most suitable for implementing a state machine with limited states?
What is the primary use case for unions in embedded systems?
When structure is passed by value to a function, which of these is true?
What is the correct way to dynamically allocate an array of structures? struct Student { int roll; char name[50]; };
In competitive programming, when should you use union instead of struct?
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));
What is the size of the following structure on a 32-bit system? struct Point { char c; int x; };
Which of the following statements about unions is correct?
Consider: union Data { int i; float f; char c; }; What is the size of this union?
Which feature of structures makes them suitable for implementing linked lists?
How do you access a member of a structure through a pointer in C?