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

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

Q.62Medium

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

Q.63Medium

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

Q.64Hard

What is a potential issue when allocating very large contiguous blocks (>10^8 bytes) dynamically?

Q.65Hard

Consider this: char *p = malloc(10); strcpy(p, "Hello World"); What occurs?

Q.66Hard

For implementing a dynamic stack in competitive programming, which memory management approach is best?

Q.67Easy

Which function in C is used to allocate memory dynamically at runtime?

Q.68Easy

Which header file must be included to use malloc() and free() functions?

Q.69Easy

What happens when malloc() fails to allocate memory?

Q.70Medium

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

Q.71Medium

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

Q.72Medium

Which of the following is a memory leak?

Q.73Medium

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.74Easy

What is the result of calling free() on a NULL pointer?

Q.75Medium

Which scenario represents a use-after-free error?

Q.76Medium

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

Q.77Medium

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

Q.78Medium

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

Q.79Medium

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

Q.80Medium

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