iGET

C Programming - MCQ Practice Questions

C questions in placement tests and university exams are rarely about syntax alone. Most of what you will find here is output prediction, pointer arithmetic, arrays and strings, structures and unions, storage classes, recursion, and file handling. The explanations walk through memory behaviour step by step, which is usually where the confusion sits rather than in the code itself.

972 questions | 100% Free

Q.41Medium

Which scenario represents a use-after-free error?

Q.42Medium

For storing variable-length strings dynamically in a competitive program, what's the safest approach?

Q.43Medium

What potential issue occurs with this code in a large-scale system?
while(1) { int *arr = malloc(1000000); }

Q.44Medium

In graph algorithms with dynamic adjacency lists, what's the memory requirement for a sparse graph with V vertices and E edges?

Q.45Medium

What is the advantage of dynamic allocation over static allocation in competitive programming?

Q.46Medium

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

Q.47Medium

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

Q.48Medium

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

Q.49Medium

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

Q.50Medium

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

Q.51Medium

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

Q.52Medium

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

Q.53Medium

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