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

What happens when you try to free a pointer that was not allocated by malloc/calloc/realloc?

Q.82Hard

In a dynamic stack implementation for competitive programming, how should you handle reallocation when the stack becomes full?

Q.83Hard

Which of these represents proper error handling for malloc in competitive programming?

Q.84Easy

How many bytes are allocated by malloc(sizeof(int) * 10) on a system where int is 4 bytes?

Q.85Medium

Which of the following correctly deallocates a 2D dynamically allocated array created as int **arr?

Q.86Easy

What is the primary difference between calloc() and malloc() in C?

Q.87Easy

In a dynamic queue implementation, if front pointer is NULL, what does it indicate?

Q.88Medium

What happens when realloc() is called on a pointer allocated by malloc() with a larger size?

Q.89Medium

For implementing a dynamic circular buffer of size n, how many pointers are minimally required?

Q.90Medium

Which scenario is most likely to cause a segmentation fault in dynamic memory?

Q.91Medium

In competitive programming for graph problems, if adjacency list uses dynamic arrays, what is the time complexity of adding an edge?

Q.92Medium

What is the correct way to store variable-length strings dynamically?

Q.93Easy

If malloc() returns NULL, what should a program do?

Q.94Easy

In implementing a dynamic doubly-linked list, what additional field is required compared to singly-linked list?

Q.95Hard

For a dynamic hash table with chaining, if collision occurs, the new element should be inserted where?

Q.96Hard

What is the memory overhead when allocating 1000 integers vs 1 integer in a system with malloc metadata?

Q.97Hard

In competitive coding, when implementing dynamic trees, which traversal is most suitable for level-order?

Q.98Hard

Which memory allocation technique provides better locality of reference for accessing array elements?