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

Which of the following is a valid declaration of nested structure?

Q.642Medium

What is the primary advantage of using unions in embedded systems?

Q.643Hard

In a structure, what does the #pragma pack(1) directive do?

Q.644Easy

Which of the following correctly demonstrates a typedef for a structure?

Q.645Hard

If a structure contains a flexible array member, where must it be declared?

Q.646Medium

How can you create a structure that can hold either an integer or a floating-point number, but not both simultaneously?

Q.647Medium

What is the difference between 'struct' and 'typedef struct' in C?

Q.648Hard

In competitive programming, when implementing a graph using adjacency lists, which data structure is most suitable?

Q.649Medium

What will be the output if you read a union member that was not last written to?

Q.650Easy

Which of the following is the correct way to initialize a structure in C?

Q.651Hard

If you have a structure with bit fields, which statement about their behavior is true?

Q.652Medium

In a nested structure scenario, how do you access a member of the inner structure?

Q.653Easy

Which of the following statements about structures is TRUE?

Q.654Medium

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

Q.655Easy

Consider the following code: struct Data { int a; char b; }; struct Data d = {10, 'A'}; Which method of initialization is used here?

Q.656Easy

What is the primary difference between a struct and a union in C?

Q.657Medium

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);

Q.658Easy

Which of the following correctly demonstrates accessing a member of a pointer to a structure?

Q.659Medium

What is the size of the following union? union Test { int a[5]; char b[10]; double c; }

Q.660Easy

In C, what does the 'typedef' keyword do when used with structures?