iGET

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

Q.1Medium

What happens when you initialize a structure variable without assigning values?

Q.2Medium

Which of the following correctly declares a pointer to a structure?

Q.3Medium

What is the difference between struct and typedef struct?

Q.4Medium

What will be printed? struct s { int a; char b; int c; }; printf("%lu", sizeof(struct s));

Q.5Medium

How do you access a member of a structure using a pointer?

Q.6Medium

What is the purpose of padding in structures?

Q.7Medium

Consider: union u { int x; double y; }; What is sizeof(u)?

Q.8Medium

Consider struct test { int x; double y; char z; }; What is the minimum size of this structure (assuming 4-byte int, 8-byte double)?

Q.9Medium

What will be printed by this code? struct s { int a; struct s *next; }; struct s *ptr; sizeof(struct s)

Q.10Medium

In a nested structure, how do you access the innermost member? struct outer { struct inner { int value; } in; } obj;

Q.11Medium

Which of the following correctly initializes a structure array? struct point { int x, y; } arr[3] = ?

Q.12Medium

What happens when you modify a union member that overlaps with another?

Q.13Medium

Which statement is correct about bit fields in structures?

Q.14Medium

What is the difference between struct tag and struct type in C?

Q.15Medium

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

Q.16Medium

Which initialization method for structures is used in designated initializers (C99 feature)?

Q.17Medium

How much memory (in bytes) will the following structure occupy on a 32-bit system? struct Data { char c; int i; short s; };

Q.18Medium

What is the primary difference between passing a structure by value vs by pointer in function calls?

Q.19Medium

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

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