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
What happens when you access a union member that wasn't the last one to be written?
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?
What is the size of the following structure on a 32-bit system? struct Point { char c; int x; };
Which feature of structures makes them suitable for implementing linked lists?
What happens if you attempt to assign one structure variable to another of the same type?
Which of the following is a valid declaration of nested structure?
What is the primary advantage of using unions in embedded systems?
How can you create a structure that can hold either an integer or a floating-point number, but not both simultaneously?
What is the difference between 'struct' and 'typedef struct' in C?
What will be the output if you read a union member that was not last written to?
In a nested structure scenario, how do you access a member of the inner structure?
What is the size of the following structure on a 32-bit system? struct Point { char c; int x; double y; }
What will be the output of this code? union Data { int a; char b; }; union Data d; d.a = 257; printf("%d %c", d.a, d.b);
What is the size of the following union? union Test { int a[5]; char b[10]; double c; }
Consider a structure with bit fields: struct Flags { unsigned int flag1 : 1; unsigned int flag2 : 3; unsigned int flag3 : 4; }; What is the minimum size of this structure?
What will happen if you try to compare two structures using the == operator directly?
Which of the following is a valid way to pass a structure to a function?
In a nested structure scenario like struct A contains struct B, how do you access a member of B from A's variable?