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

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

Q.842Medium

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

Q.843Medium

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

Q.844Medium

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

Q.845Hard

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

Q.846Hard

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

Q.847Hard

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

Q.848Easy

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

Q.849Easy

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

Q.850Easy

What happens when malloc() fails to allocate memory?

Q.851Medium

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

Q.852Medium

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

Q.853Medium

Which of the following is a memory leak?

Q.854Medium

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

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

Q.856Medium

Which scenario represents a use-after-free error?

Q.857Medium

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

Q.858Medium

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

Q.859Medium

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

Q.860Medium

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