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
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
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
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
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
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
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
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
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
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
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.
- Check Programming Books
- Check Computer Science Books
- Apply for Computer Science Internship
- Check Data Structure Books
- Practice Design & Analysis of Algorithms MCQ