Which statement about free() is correct?
In dynamic 2D array creation:
int arr = (int)malloc(m * sizeof(int*));
what does the first malloc() allocate?
What happens if you use a pointer after calling free() on it (without reallocating)?
Which scenario best demonstrates a memory leak?
What is the output of this code?
int *p = (int*)calloc(3, sizeof(int));
printf("%d %d %d", p[0], p[1], p[2]);
Advertisement
If realloc() cannot expand memory at the current location, what does it do?
In competitive exams, why is dynamic allocation preferred over static arrays for unknown input sizes?
What is the correct way to allocate a dynamic array of struct for 'n' elements?
struct Node { int data; char name[20]; };
A competitive programmer allocates a 2D array dynamically. What is the correct approach?
Consider a program that repeatedly allocates memory in a loop but never frees it. What problem occurs?
What happens if you call free() twice on the same pointer?
In a competitive programming scenario, you need to store strings dynamically. What is safe practice?
A program uses realloc() to expand an array from 100 to 200 elements. The old address is p. After realloc():?
For a graph with V vertices and E edges stored dynamically, what is typical space complexity?
What is the critical issue with this code? int *p = (int*)malloc(sizeof(int)); free(p); p = NULL;
In 2024-2025 competitive exams, for storing variable number of test cases (up to 10^5), which approach is optimal?
In a competitive programming problem, you need to allocate a 2D array of size 5x5 dynamically. Which approach is most efficient?
What is the critical issue with this code snippet?
int *ptr = (int*)malloc(10);
ptr[11] = 5;
Which of the following is a memory leak?
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?