DS4

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

1. 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 list
2. . Skip lists are similar to which of the following datastructure?
a) stack
b) heap
c) binary search tree
d) balanced binary search tree
3. 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(n2) where n is number of elements
4. 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 lists
5. The nodes in a skip list may have many forward references. their number is
determined
a) probabilistically
b) randomly
c) sequentially
d) orthogonally
6. 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) reconstruction
7. 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 tree
8. The self organizing list improves the efficiency of _______
a) binary search
b) jump search
c) sublist search
d) linear search
9. 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 node
10. 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 node
11. 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(n2)
12. 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 list
13. 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) exchange
14. 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 array
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 method
16. The self organizing list improves _____
a) average access time
b) insertion
c) deletion
d) binary search
17. 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 used
18. 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 list
19. 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 address
20. 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 B
21. Which of the following is an advantage of XOR list?
a) Almost of debugging tools cannot follow the XOR chain, making debugging
difficult
b) You need to remember the address of the previously accessed node in order to
calculate the next node’s address
c) In some contexts XOR of pointers is not defined
d) XOR list decreases the space requirement in doubly linked list
22. Which of the following is not the properties of XOR lists?
a) X⊕X = 0
b) X⊕0 = X
c) (X⊕Y)⊕Z = X⊕(Y⊕Z)
d) X⊕0 = 1
23. In the above question would using arrays and swaping of elements in place of xor
linked list would have been more efficient?
a) no not all
b) yes arrays would have been better than xor lists
c) both would be same in efficiency
d) can’t say
24. 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
25. 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
26. What datastructures can be used in implementing a free list?
a) only linked list
b) linked list or sort trees
c) arrays
d) trees
27. 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
28. 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
29. 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
30. 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
31. 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
32. Accessing free list very frequently for wide range of addresses can lead to
a) paging
b) segmentation fault
c) memory errors
d) cache problems
33. What is/are the disadvantages of implementing tree using normal arrays?
a) difficulty in knowing children nodes of a node
b) difficult in finding the parent of a node
c) have to know the maximum number of nodes possible before creation of trees
d) difficult to implement
34. What must be the ideal size of array if the height of tree is ‘l’?
a) 2l-1
b) l-1
c) l
d) 2l
35. What are the children for node ‘w’ of a complete-binary tree in an array
representation?
a) 2w and 2w+1
b) 2+w and 2-w
c) w+1/2 and w/2
d) w-1/2 and w+1/2
36. What is the parent for a node ‘w’ of a complete binary tree in an array
representation when w is not 0?
a) floor(w-1/2)
b) ceil(w-1/2)
c) w-1/2
d) w/2
37.  If the tree is not a complete binary tree then what changes can be made for easy
access of children of a node in the array?
a) every node stores data saying which of its children exist in the array
b) no need of any changes continue with 2w and 2w+1, if node is at i
c) keep a seperate table telling children of a node
d) use another array parallel to the array with tree
38. Consider a situation of writing a binary tree into a file with memory storage
efficiency in mind, is array representation of tree is good?
a) yes because we are overcoming the need of pointers and so space efficiency
b) yes because array values are indexable
c) No it is not efficient in case of sparse trees and remaning cases it is fine
d) No linked list representation of tree is only fine
39. Can a tree stored in an array using either one of inorder or post order or pre order
traversals be again reformed?
a) Yes just traverse through the array and form the tree
b) No we need one more traversal to form a tree
c) No in case of sparse trees
d) Yes by using both inorder and array elements
40. Advantages of linked list representation of binary trees over arrays?
a) dynamic size
b) ease of insertion/deletion
c) ease in randomly accessing a node
d) both dynamic size and ease in insertion/deletion
41. Disadvantages of linked list representation of binary trees over arrays?
a) Randomly accessing is not possible
b) Extra memory for a pointer is needed with every element in the list
c) Difficulty in deletion
d) Random access is not possible and extra memory with every element
42. Which of the following traversing algorithm is not used to traverse in a tree?
a) Post order
b) Pre order
c) Post order
d) Randomized
43. Level order traversal of a tree is formed with the help of
a) breadth first search
b) depth first search
c) dijkstra’s algorithm
d) prims algorithm
44. Identify the reason which doesn’t play a key role to use threaded binary trees?
a) The storage required by stack and queue is more
b) The pointers in most of nodes of a binary tree are NULL
c) It is Difficult to find a successor node
d) They occupy less size
45. The following lines talks about deleting a node in a binary tree.(the tree property
must not be violated after deletion)
i) from root search for the node to be deleted
ii)
iii) delete the node at
what must be statement ii) and fill up statement iii)
a) ii)-find random node,replace with node to be deleted. iii)- delete the node
b) ii)-find node to be deleted. iii)- delete the node at found location
c) ii)-find deepest node,replace with node to be deleted. iii)- delete a node
d) ii)-find deepest node,replace with node to be deleted. iii)- delete the deepest node
46. What may be the psuedo code for finding the size of a tree?
a) find_size(root_node–>left_node) + 1 + find_size(root_node–>right_node)
b) find_size(root_node–>left_node) + find_size(root_node–>right_node)
c) find_size(root_node–>right_node) – 1
d) find_size(root_node–>left_node + 1

Binary Trees using Linked Lists

You might also like