Data Structure Questions and Answers – Free List

This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on “Free List”.

1. Free lists are used in
a) static memory allocation
b) dynamic memory allocation
c) contagious allocations
d) are used for speeding up linked list operations
View Answer

Answer: b
Explanation: Their property is meant for dynamic allocations.

2. What are implicit and explicit implementations of freelists?
a) garbage collection and new or malloc operators respectively
b) new or malloc and garbage collection respectively
c) implicit implementation is not favored
d) explicit implementation is not favored
View Answer

Answer: a
Explanation: Gc and new most widely known.

3. What datastructures can be used in implementing a free list?
a) only linked list
b) linked list or sort trees
c) arrays
d) trees
View Answer

Answer: b
Explanation: Sort trees can also be used in impelementing free lists which remaincomplex.

4. What are different ways of implementing free lists and which is simple among them?
a) best fit, first fit, worst fit, simple-first fit
b) best fit, first fit, worst fit, simple-best fit
c) best fit, first fit, worst fit, simple-worst fit
d) best fit simple-best fit
View Answer

Answer: a
Explanation: The‭ ‬simplest form of memory management system can be called as first-fit.‭ ‬a device or system maintains a single‭ ‬list of free memory locations.‭ ‬When request to memory is sent,‭ ‬the list is searched and the first block that is large enough is returned.

5. What is buddy memory management of free lists ?
a) modified version of first fit
b) buddy allocation keeps several‭ ‬free lists,‭ ‬each one holds blocks which are of one particular size
c) modified version of best fit
d) a tree representation of free lists
View Answer

Answer: b
Explanation: When an allocation request is received,‭ ‬the list that holds blocks that are just large enough to satisfy the request are considered, and an open location is returned.‭ ‬If no‭ ‬free‭ ‬blocks that are smaller than two times the size that are requested are available,‭ ‬a larger block is split in two to satisfy the requirements.

6. How does implicit free lists(garbage collection) works in adding memory to free list ?
a) whichever comes last will be added to free list
b) whichever comes first will be added to free list
c) certain blocks cannot be used if there are no pointers to them and hence they can be freed
d) makes a probabilistic guess
View Answer

Answer: c
Explanation: When no pointers pointing a block that means it is useless to be in memory.

7. What are the disadvantages in implementing buddy system algorithm for free lists?
a) internal fragmentation
b) it takes so much space
c) we no more have the hole lists in order of memory address, so it is difficult to detect if 2 holes remain adjacent in memory and shall be merged into one hole
d) both a and c are correct
View Answer

Answer: d
Explanation: Internal fragmentation is an issue to be dealt and it takes so much space.

8. Assume there is a free list which contains nodes and is filled with a value if it is already assigned and the value will be the size of requested block else will be 0.

 z = startpoint;
 while ((z < end) &&    \\ didn't reach end
   (*z <= len))          \\ too small to satisfy request
   assign this block

The above code represents what?
a) code for first fit
b) code for best fit
c) code for worst fit
d) none of the mentioned
View Answer

Answer: a
Explanation: As z is start point and now from beginning we are moving and checking if we reached end and then checking size naively assigning the first block which is bigger than required size hence it is first fit.

9. How are free blocks linked together mostly and in what addressing order?
a) circular linked list and increasing addressing order
b) linked list and decreasing addressing order
c) linked list and in no addressing order
d) none of the mentioned
View Answer

Answer: a
Explanation: A common way is circular linked list and address are arranged in increasing order because merging would be easier which is actually a problem in buddy memory allocation.

10. Accessing free list very frequently for wide range of addresses can lead to
a) paging
b) segmentation fault
c) memory errors
d) cache problems
View Answer

Answer: a
Explanation: Paging in/out of disk will be caused.

Sanfoundry Global Education & Learning Series – Data Structure.

To practice all areas of Data Structure, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.