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
In a nested structure, how do you access the innermost member? struct outer { struct inner { int value; } in; } obj;
Which of the following correctly initializes a structure array? struct point { int x, y; } arr[3] = ?
What happens when you modify a union member that overlaps with another?
Which statement is correct about bit fields in structures?
What is the difference between struct tag and struct type in C?
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);
Which initialization method for structures is used in designated initializers (C99 feature)?
How much memory (in bytes) will the following structure occupy on a 32-bit system? struct Data { char c; int i; short s; };
What is the primary difference between passing a structure by value vs by pointer in function calls?
What will be the output of this code? union Data { int x; char y; }; Data d = {65}; d.y = 'A'; printf("%d", d.x);
What is the issue with bit fields in structures regarding portability?
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?