Engineering Questions with Answers - Multiple Choice Questions

Data Structure MCQ – Free List

1 - Question

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 - Question

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 - Question

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 - Question

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 - Question

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 - Question

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 - Question

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 - Question

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 - Question

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 - Question

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.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners