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

Which function should be used to allocate memory for an array of 50 structures of size 'sizeof(struct Node)' and initialize to zero?

Q.862Medium

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

Q.863Hard

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

Q.864Hard

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

Q.865Easy

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

Q.866Medium

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

Q.867Easy

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

Q.868Easy

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

Q.869Medium

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

Q.870Medium

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

Q.871Medium

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

Q.872Medium

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

Q.873Medium

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

Q.874Easy

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

Q.875Easy

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

Q.876Hard

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

Q.877Hard

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

Q.878Hard

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

Q.879Hard

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

Q.880Easy

Which of the following is NOT a preprocessor directive in C?

C Programming MCQs & Practice Tests – Free | iGET | iGET