Memory Allocation - Study Mode

[#51] What is the difference between 'free' and 'delete' in C?
Correct Answer

(A) 'free' is used for dynamic memory, 'delete' is used for static memory

[#52] Which function is used to release all dynamically allocated memory in C?
Correct Answer

(C) freeall()

[#53] In C, what is the purpose of the 'realloc' function?
Correct Answer

(A) To change the size of a previously allocated block of memory

[#54] What is a memory fragment in C?
Correct Answer

(A) Unused memory between allocated blocks

[#55] 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
")
scanf("%d",p)
printf("Enter second number
")
scanf("%d",p+2)
printf("%d%d",*p,*(p+2))
free(p)
}
Correct Answer

(D) Error