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

In a competitive programming scenario, you need to store strings dynamically. What is safe practice?

Q.422Medium

A program uses realloc() to expand an array from 100 to 200 elements. The old address is p. After realloc():?

Q.423Medium

For a graph with V vertices and E edges stored dynamically, what is typical space complexity?

Q.424Medium

What is the critical issue with this code? int *p = (int*)malloc(sizeof(int)); free(p); p = NULL;

Q.425Medium

In 2024-2025 competitive exams, for storing variable number of test cases (up to 10^5), which approach is optimal?

Q.426Medium

In a competitive programming problem, you need to allocate a 2D array of size 5x5 dynamically. Which approach is most efficient?

Q.427Medium

What is the critical issue with this code snippet? int *ptr = (int*)malloc(10); ptr[11] = 5;

Q.428Medium

Which of the following is a memory leak?

Q.429Medium

In the 2024-2025 competitive exam pattern, a dynamic array needs to grow from 100 to 200 elements. Using realloc(), what should be the concern?

Q.430Medium

Which scenario represents a use-after-free error?

Q.431Medium

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

Q.432Medium

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

Q.433Medium

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

Q.434Medium

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

Q.435Medium

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

Q.436Medium

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

Q.437Medium

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

Q.438Medium

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

Q.439Medium

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

Q.440Medium

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