Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Accessing free list very frequently for wide range of addresses can lead to(a) paging(b) segmentation fault(c) memory errors(d) cache problemsMy enquiry is from Free List in portion Types of Lists of Data Structures & Algorithms II had been asked this question in an international level competition.

Answer» CORRECT answer is (a) PAGING

To EXPLAIN: Paging in/out of DISK will be CAUSED.
2.

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 mentionedEnquiry is from Free List topic in section Types of Lists of Data Structures & Algorithms IThis question was addressed to me during an interview for a job.

Answer»

Correct answer is (a) circular linked list and increasing addressing order

The best 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.

3.

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 correctThis intriguing question originated from Free List in division Types of Lists of Data Structures & Algorithms IThe question was posed to me in an online quiz.

Answer»

The correct answer is (d) both a and C are correct

The best I can EXPLAIN: Internal fragmentation is an issue to be dealt and it TAKES so much SPACE.

4.

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 guessI want to ask this question from Free List in division Types of Lists of Data Structures & Algorithms IThe question was posed to me in final exam.

Answer»

Right ANSWER is (c) certain blocks cannot be used if there are no pointers to them and HENCE they can be freed

The explanation is: When no pointers pointing a block that MEANS it is USELESS to be in memory.

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 listsI'd like to ask this question from Free List topic in portion Types of Lists of Data Structures & Algorithms IThe question was asked during an interview for a job.

Answer»

Correct answer is (b) BUDDY allocation keeps several‭ ‬free lists,‭ ‬each ONE holds blocks which are of one PARTICULAR size

The best 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.

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 fitsimple-best fitThis interesting question is from Free List topic in division Types of Lists of Data Structures & Algorithms II had been asked this question by my school teacher while I was bunking the class.

Answer»

Correct option is (a) BEST fit, first fit, worst fit, simple-first fit

For 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.

7.

What datastructures can be used in implementing a free list?(a) only linked list(b) linked list or sort trees(c) arrays(d) treesI need to ask this question from Free List topic in division Types of Lists of Data Structures & Algorithms II had been asked this question in an online interview.

Answer»

Right choice is (B) LINKED LIST or sort trees

For explanation: Sort trees can ALSO be USED in impelementing free lists which remaincomplex.

8.

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 favoredMy question is based upon Free List in section Types of Lists of Data Structures & Algorithms IThis question was addressed to me in exam.

Answer»

The CORRECT ANSWER is (a) GARBAGE collection and new or MALLOC operators respectively

Easiest explanation - Gc and new most widely KNOWN.

9.

Free lists are used in(a) static memory allocation(b) dynamic memory allocation(c) contagious allocations(d) are used for speeding up linked list operationsAsked question is from Free List in division Types of Lists of Data Structures & Algorithms II had been asked this question in an interview.

Answer» RIGHT CHOICE is (B) DYNAMIC memory allocation

For explanation: Their property is meant for dynamic allocations.
10.

What does first and last nodes of a xor linked lists contain ? (let address of first and last be A and B)(a) NULL xor A and B xor NULL(b) NULL and NULL(c) A and B(d) NULL xor A and BMy doubt is from Xor Linked List topic in section Types of Lists of Data Structures & Algorithms IThis question was addressed to me at a job interview.

Answer»

The correct answer is (a) NULL XOR A and B xor NULL

Easy EXPLANATION - NULL xor A and B xor NULL.

11.

What does a xor linked list have?(a) every node stores the XOR of addresses of previous and next nodes(b) actuall memory address of next node(c) every node stores the XOR of addresses of previous and next two nodes(d) every node stores xor 0 and the current node addressThis is a very interesting question from Xor Linked List in portion Types of Lists of Data Structures & Algorithms IThis question was posed to me in class test.

Answer»

The correct CHOICE is (a) EVERY NODE STORES the XOR of ADDRESSES of previous and next nodes

The best explanation: Every node stores the XOR of addresses.

12.

What is xor linked list?(a) uses of bitwise XOR operation to decrease storage requirements for doubly linked lists(b) uses of bitwise XOR operation to decrease storage requirements for linked lists(c) uses of bitwise operations to decrease storage requirements for doubly linked lists(d) just another form of linked listQuestion is taken from Xor Linked List in portion Types of Lists of Data Structures & Algorithms II got this question by my college director while I was bunking the class.

Answer» CORRECT answer is (a) uses of bitwise XOR OPERATION to decrease storage requirements for doubly LINKED lists

For explanation: Why we USE bitwise XOR operation is to decrease storage requirements for doubly linked lists.
13.

Which of the following is not the rearranging method used to implement self-organizing lists?(a) count method(b) move to front method(c) ordering method(d) least frequently usedEnquiry is from Types of Lists topic in chapter Types of Lists of Data Structures & Algorithms II had been asked this question during an internship interview.

Answer»

Correct answer is (d) least frequently USED

The EXPLANATION is: Least frequently used is a BUFFER replacement policy, while other three are methods to reorder the nodes in the self-organizing LISTS based on their ACCESS probability.

14.

The self organizing list improves _____(a) average access time(b) insertion(c) deletion(d) binary searchThis question is from Types of Lists topic in division Types of Lists of Data Structures & Algorithms IThis question was posed to me during an online exam.

Answer» RIGHT option is (a) average access time

Easy explanation - The self-organizing list rearranges the nodes based on the access PROBABILITIES of the nodes. So the required ELEMENTS can be LOCATED efficiently. Therefore, self-organizing list is mainly used to improve the average access time.
15.

Which of the following method performs poorly when elements are accessed in sequential order?(a) count method(b) move to front method(c) transpose meth(d) ordering methodI'd like to ask this question from Types of Lists topic in chapter Types of Lists of Data Structures & Algorithms IThis question was addressed to me in a job interview.

Answer»

Right CHOICE is (b) move to FRONT method

Easy explanation - Move-to-front method performs POORLY when the elements are accessed in sequential order, especially if that sequential order is then repeated multiple TIMES.

16.

What technique is used in Transpose method?(a) searched node is swapped with its predecessor(b) node with highest access count is moved to head of the list(c) searched node is swapped with the head of list(d) searched nodes are rearranged based on their proximity to the head nodeMy question is based upon Types of Lists topic in chapter Types of Lists of Data Structures & Algorithms II had been asked this question in an online quiz.

Answer»

Correct option is (a) searched node is swapped with its predecessor

Easy explanation - In Transpose METHOD, if any node is searched, it is swapped with the node in front unless it is the HEAD of the LIST. So, in Transpose method searched node is swapped with its predecessor.

17.

Symbol tables during compilation of program is efficiently implemented using __________(a) a singly linked list(b) a doubly linked list(c) a self organizing list(d) an arrayThis question is from Types of Lists in chapter Types of Lists of Data Structures & Algorithms II had been asked this question by my college director while I was bunking the class.

Answer»

The correct ANSWER is (c) a self ORGANIZING list

Easy explanation - Self organizing list allows fast sequential search and it is SIMPLE to IMPLEMENT and requires no extra storage. Self-organizing list is USED to implement the symbol table.

18.

In _____________ method, whenever a node is accessed, it might move to the head of the list if its number of accesses becomes greater than the records preceding it.(a) least recently used(b) count(c) traspose(d) exchangeMy doubt stems from Types of Lists topic in section Types of Lists of Data Structures & Algorithms IThe question was posed to me in examination.

Answer»

The correct answer is (b) count

Easy explanation - In the count method, the NUMBER of times a node was ACCESSED is counted and is stored in a counter variable associated with each node. Then the NODES are arranged in DESCENDING order based on their ACCESS counts. And the node with highest access count is head of the list.

19.

Which of the following data structure is preferred to have lesser search time when the list size is small?(a) search tree(b) sorted list(c) self organizing list(d) linked listThis intriguing question comes from Types of Lists topic in chapter Types of Lists of Data Structures & Algorithms II had been asked this question during an interview.

Answer»

Correct answer is (c) self organizing list

The best explanation: Self-organizing list is EASY and simple to IMPLEMENT than search tree and it REQUIRES no additional space. So using self organizing list is PREFERRED when list size is small.

20.

The worst case running time of a linear search on the self organizing list is ____(a) O(1)(b) O(logn)(c) O(n)(d) O(n^2)This key question is from Types of Lists in section Types of Lists of Data Structures & Algorithms IThis question was addressed to me during an interview.

Answer»

The correct answer is (C) O(n)

The best I can explain: Worst case OCCURS when the ELEMENT is located at the very end of list. So n comparisons must be made to the locate element. So the worst case running time of linear search on SELF organizing list is O(n).

21.

Which of the following is true about the Move-To-Front Method for rearranging nodes?(a) node with highest access count is moved to head of the list(b) requires extra storage(c) may over-reward infrequently accessed nodes(d) requires a counter for each nodeI'd like to ask this question from Types of Lists in chapter Types of Lists of Data Structures & Algorithms II had been asked this question in an internship interview.

Answer»

The correct option is (c) may over-reward infrequently accessed nodes

For explanation: In Move-To-front Method the ELEMENT which is searched is moved to the head of the list. And if a NODE is searched even once, it is moved to the head of the list and given maximum PRIORITY even if it is not going to be accessed frequently in the future. Such a SITUATION is REFERRED to as over-rewarding.

22.

The self organizing list improves the efficiency of _______(a) binary search(b) jump search(c) sublist search(d) linear searchMy doubt is from Types of Lists in section Types of Lists of Data Structures & Algorithms II got this question during an internship interview.

Answer»

The correct OPTION is (d) linear search

Explanation: Linear search in a linked list has TIME complexity O(n). To improve the efficiency of the linear search the self ORGANIZING list is used. A self-organizing list improves the efficiency of linear search by moving more frequently ACCESSED elements towards the HEAD of the list.

23.

What is indexed skip list?(a) it stores width of link in place of element(b) it stores index values(c) array based linked list(d) indexed treeI want to ask this question from Skip List topic in chapter Types of Lists of Data Structures & Algorithms IThe question was asked during an online interview.

Answer» CORRECT answer is (a) it stores width of link in place of element

The best explanation: The width is DEFINED as number of BOTTOM layer LINKS that are being traversed by each of higher layer elements. e.g: for a level-2 skip LISTS, all level-1 nodes have 1 as width, for level-2 width will be 2.
24.

Is a skip list like balanced tree?(a) true(b) falseI would like to ask this question from Skip List in division Types of Lists of Data Structures & Algorithms IThis question was addressed to me at a job interview.

Answer» RIGHT ANSWER is (a) true

Explanation: Skip list behaves as a BALANCED tree with HIGH probability and can be commented as such because nodes with different heights are MIXED up evenly.
25.

How to maintain multi-level skip list properties when insertions and deletions are done?(a) design each level of a multi-level skip list with varied probabilities(b) that cannot be maintained(c) rebalancing of lists(d) reconstructionAsked question is from Skip List in chapter Types of Lists of Data Structures & Algorithms IThe question was asked in semester exam.

Answer»

The correct answer is (a) design each level of a multi-level skip list with VARIED probabilities

Easy explanation - For EXAMPLE consider a 2 level skip list. the level-2 skip list can skip one NODE on a average and at some places may skip 2 nodes, depending on probabilities. this ensures O(logn).

26.

Are the below statements true about skiplists?In a sorted set of elements skip lists can implement the below operationsi.given a element find closest element to the given value in the sorted set in O(logn)ii.find the number of elements in the set whose values fall a given range in O(logn)(a) true(b) falseThis is a very interesting question from Skip List topic in section Types of Lists of Data Structures & Algorithms IThis question was addressed to me during a job interview.

Answer»

Right option is (a) true

The explanation is: To ACHIEVE above OPERATIONS AUGMENT with few ADDITIONAL stuff like partial counts.

27.

The nodes in a skip list may have many forward references. their number is determined(a) probabilistically(b) randomly(c) sequentially(d) orthogonallyAsked question is from Skip List in chapter Types of Lists of Data Structures & Algorithms IThis question was posed to me in examination.

Answer» RIGHT ANSWER is (a) probabilistically

Easy explanation - The number of forward references are determined probabilistically, that is why SKIP list is a probabilistic algorithm.
28.

To which datastructure are skip lists similar to in terms of time complexities in worst and best cases?(a) balanced binary search trees(b) binary search trees(c) binary trees(d) linked listsThe doubt is from Skip List in chapter Types of Lists of Data Structures & Algorithms IThis question was posed to me during a job interview.

Answer»

Correct answer is (a) balanced BINARY search trees

The explanation is: Skip LISTS are similar to any RANDOMLY built binary search tree. a BST is balanced because to avoid skew tree formations in case of sequential input and HENCE achieve O(logn) in all 3 CASES. now skip lists can gurantee that O(logn) complexity for any input.

29.

What is the time complexity improvement of skip lists from linked lists in insertion and deletion?(a) O(n) to O(logn) where n is number of elements(b) O(n) to O(1) where n is number of elements(c) no change(d) O(n) to O(n^2) where n is number of elementsThis interesting question is from Skip List topic in portion Types of Lists of Data Structures & Algorithms II got this question in homework.

Answer»

The correct CHOICE is (a) O(n) to O(logn) where n is NUMBER of elements

Easy explanation - In Skip list we skip some of the elements by adding more layers. In this the skip list RESEMBLES BALANCED binary search trees. Thus we can change the TIME complexity from O (n) to O (logn)

30.

Skip lists are similar to which of the following datastructure?(a) stack(b) heap(c) binary search tree(d) balanced binary search treeOrigin of the question is Skip List topic in portion Types of Lists of Data Structures & Algorithms IThis question was posed to me in a job interview.

Answer»

The correct choice is (d) balanced binary search tree

The explanation is: Skip lists have the same ASYMPTOTIC time complexity as balanced binary search tree. For a Balanced Binary Search Tree, we skip almost half of the NODES after ONE comparison with root element. The same thing done in the skip lists. Hence skip lists are similar to balanced Binary search trees.

31.

What is a skip list?(a) a linkedlist with size value in nodes(b) a linkedlist that allows faster search within an ordered sequence(c) a linkedlist that allows slower search within an ordered sequence(d) a tree which is in the form of linked listThe doubt is from Skip List in portion Types of Lists of Data Structures & Algorithms IThis question was posed to me in homework.

Answer»

Correct answer is (b) a linkedlist that allows faster search within an ORDERED sequence

Easy explanation - It is a DATASTRUCTURE, which can MAKE search in sorted linked list faster in the same way as BINARY search tree and sorted array (using binary search) are faster.