Memory Allocation MCQs
Practice free Memory Allocation multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 62 questions — no login required.
Question 28medium
Which function is used to release all dynamically allocated memory in C?
Question 29easy
In C, what is the purpose of the 'realloc' function?
Question 30easy
What is a memory fragment in C?
Advertisement
Question 31medium
The number of arguments for realloc() function is/are:
Question 32medium
With every use of a memory allocation function, what function should be used to release allocated memory, which is no longer needed?
Question 33medium
Array is preferred over linked list for the implementation of . . . . . . . .
Advertisement
Question 34medium
The free() function frees the memory state pointed to by a pointer and returns . . . . . . . .
Question 35medium
When the pointer is NULL, then the function realloc is equivalent to the function . . . . . . . .
Question 36hard
What will be the output of the following C code if the input entered as first and second number is 5 and 6 respectively?
#include<stdio.h>
#include<stdlib.h>
main()
{
int *p;
p=(int*)calloc(3*sizeof(int));
printf("Enter first number\n");
scanf("%d",p);
printf("Enter second number\n");
scanf("%d",p+2);
printf("%d%d",*p,*(p+2));
free(p);
}