Home > C Programming > Quizzes > C Programming Practice Test: Dynamic Memory Allocation
C Programming Practice Test: Dynamic Memory Allocation
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 47% Most missed: “In the function realloc(), if the new size of the memory block is larger than th…”
Quiz questions on static and dynamic memory allocation, dma functions, memory leak and dangling pointers. Dynamic memory allocation is a fundamental concept in C programming that allows programmers to allocate and deallocate memory while a program is running. This is in contrast to static memory allocation, which occurs at compile time and is fixed for the duration of the program's execution. Dynamic memory allocation is achieved through the use of the following functions defined in the stdlib.h header: malloc(): Allocates a block of memory of the specified size in bytes and returns a... Show more
C Programming Practice Test: Dynamic Memory Allocation
Time left 00:00
23 Questions

1. In the function realloc(), if the new size of the memory block is larger than the old size, then the added memory ___________
2. Array is preferred over linked list for the implementation of ________
3. The type of linked list in which the node does not contain any pointer or reference to the previous node is _____________
4. When the pointer is NULL, then the function realloc is equivalent to the function ___________
5. The advantage of using linked lists over arrays is that ________
6. In the function malloc(), each byte of allocated space is initialized to zero.
7. The number of arguments taken as input which allocating memory dynamically using malloc() is ___________
8. Local variables are stored in an area called ___________
9. Queue data structure works on the principle of ____________
10. Which of the following functions allocates multiple blocks of memory, each block of the same size?
11. A condition where in memory is reserved dynamically but not accessible to any of the programs is called _____________
12. If the space in memory allocated by malloc is not sufficient, then an allocation fails and returns ___________
13. Which of the following header files must necessarily be included to use dynamic memory allocation functions?
14. The size of both stack and heap remains the same during run time.
15. Garbage collector frees the programmer from worrying about ___________
16. Choose the statement which is incorrect with respect to dynamic memory allocation.
17. Pick out the correct statement with respect to the heap.
18. The incorrect statement with respect to dangling pointers is ___________
19. Which of the following is an example of static memory allocation?
20. Which of the following is an example for non linear data type?
21. The free() function frees the memory state pointed to by a pointer and returns ___________
22. If malloc() and calloc() are not type casted, the default return type is ___________
23. Suppose we have a one dimensional array, named ‘x’, which contains 10 integers. Which of the following is the correct way to allocate memory dynamically to the array ‘x’ using malloc()?