250+ TOP MCQs on Queue using Array and Answers

Data Structure Multiple Choice Questions on “Queue using Array”.

1. Which of the following properties is associated with a queue?
a) First In Last Out
b) First In First Out
c) Last In First Out
d) Last In Last Out
Answer: b
Clarification: Queue follows First In First Out structure.

2. In a circular queue, how do you increment the rear end of the queue?
a) rear++
b) (rear+1) % CAPACITY
c) (rear % CAPACITY)+1
d) rear–
Answer: b
Clarification: Ensures rear takes the values from 0 to (CAPACITY-1).

3. What is the term for inserting into a full queue known as?
a) overflow
b) underflow
c) null pointer exception
d) program won’t be compiled
Answer: a
Clarification: Just as stack, inserting into a full queue is termed overflow.

4. What is the time complexity of enqueue operation?
a) O(logn)
b) O(nlogn)
c) O(n)
d) O(1)
Answer: d
Clarification: Enqueue operation is at the rear end, it takes O(1) time to insert a new item into the queue.

5. What does the following Java code do?

public Object function()
{
	if(isEmpty())
	return -999;
	else
	{
		Object high;
		high = q[front];
		return high;
	}
}

a) Dequeue
b) Enqueue
c) Return the front element
d) Return the last element
Answer: c
Clarification: q[front] gives the element at the front of the queue, since we are not moving the ‘front’ to the next element,
it is not a dequeue operation.

6. What is the need for a circular queue?
a) effective usage of memory
b) easier computations
c) to delete elements based on priority
d) implement LIFO principle in queues
Answer: a
Clarification: In a linear queue, dequeue operation causes the starting elements of the array to be empty, and there is no way you can use that space, while in a circular queue, you can effectively use that space. Priority queue is used to delete the elements based on their priority. Higher priority elements will be deleted first whereas lower priority elements will be deleted next. Queue data structure always follows FIFO principle.

7. Which of the following represents a dequeue operation? (count is the number of elements in the queue)
a)

public Object dequeue()
{
	if(count == 0)
	{
		System.out.println("Queue underflow");
		return 0;
	}
	else
	{
		Object ele = q[front];
		q[front] = null;
		front = (front+1)%CAPACITY;
		count--;
		return ele;
	}
}

b)

public Object dequeue()
{
	if(count == 0)
	{
		System.out.println("Queue underflow");
		return 0;
	}
	else
	{
		Object ele = q[front];
		front = (front+1)%CAPACITY;
		q[front] = null;
		count--;
		return ele;
	}
}

c)

public Object dequeue()
{
	if(count == 0)
	{
		System.out.println("Queue underflow");
		return 0;
	}
	else
	{
		front = (front+1)%CAPACITY;
		Object ele = q[front];
		q[front] = null;
		count--;
		return ele;
	}
}

d)

public Object dequeue()
{
	if(count == 0)
	{
		System.out.println("Queue underflow");
		return 0;
	}
	else
	{
		Object ele = q[front];
		q[front] = null;
		front = (front+1)%CAPACITY;
		return ele;
		count--;
	}
}

View Answer

Answer: a
Clarification: Dequeue removes the first element from the queue, ‘front’ points to the front end of the queue and returns the first element.

 
 

8. Which of the following best describes the growth of a linear queue at runtime? (Q is the original queue, size() returns the number of elements in the queue)
a)

private void expand()
{
	int length = size();
	int[] newQ = new int[length<<1];
	for(int i=front; i<=rear; i++)
	{
		newQ[i-front] = Q[i%CAPACITY];
	}
	Q = newQ;
	front = 0;
	rear = size()-1;
}

b)

private void expand()
{
	int length = size();
	int[] newQ = new int[length<<1];
	for(int i=front; i<=rear; i++)
	{
		newQ[i-front] = Q[i%CAPACITY];
	}
	Q = newQ;
}

c)

private void expand()
{
	int length = size();
	int[] newQ = new int[length<<1];
	for(int i=front; i<=rear; i++)
	{
		newQ[i-front] = Q[i];
	}
	Q = newQ;
	front = 0;
	rear = size()-1;
}

d)

private void expand()
{
	int length = size();
	int[] newQ = new int[length*2];
	for(int i=front; i<=rear; i++)
	{
		newQ[i-front] = Q[i%CAPACITY];
	}
	Q = newQ;
}

View Answer

Answer: a
Clarification: A common technique to expand the size of array at run time is simply to double the size. Create a new array of double the previous size and copy all the elements, after copying do not forget to assign front = 0 and rear = size()-1, as these are necessary to maintain the decorum of the queue operations.

 
 

9. What is the space complexity of a linear queue having n elements?
a) O(n)
b) O(nlogn)
c) O(logn)
d) O(1)
Answer: a
Clarification: Because there are n elements.

10. What is the output of the following Java code?

public class CircularQueue
{
	protected static final int CAPACITY = 100;
	protected int size,front,rear;
	protected Object q[];
	int count = 0;
 
	public CircularQueue()
	{
		this(CAPACITY);
	}
	public CircularQueue (int n)
	{
		size = n;
		front = 0;
		rear = 0;
		q = new Object[size];
	}
 
 
	public void enqueue(Object item)
	{
		if(count == size)
		{
			System.out.println("Queue overflow");
				return;
		}
		else
		{
			q[rear] = item;
			rear = (rear+1)%size;
			count++;
		}
	}
	public Object dequeue()
	{
		if(count == 0)
		{
			System.out.println("Queue underflow");
			return 0;
		}
		else
		{
			Object ele = q[front];
			q[front] = null;
			front = (front+1)%size;
			count--;
			return ele;
		}
	}
	public Object frontElement()
	{
		if(count == 0)
		return -999;
		else
		{
			Object high;
			high = q[front];
			return high;
		}
	}
	public Object rearElement()
	{
		if(count == 0)
		return -999;
		else
		{
			Object low;
			rear = (rear-1)%size;
			low = q[rear];
			rear = (rear+1)%size;
			return low;
		}
	}
}
public class CircularQueueDemo
{
	public static void main(String args[])
	{
		Object var;
		CircularQueue myQ = new CircularQueue();
		myQ.enqueue(10);
		myQ.enqueue(3);
		var = myQ.rearElement();
		myQ.dequeue();
		myQ.enqueue(6);
		var = mQ.frontElement();
		System.out.println(var+" "+var);
	}
}

a) 3 3
b) 3 6
c) 6 6
d) 10 6
Answer: a
Clarification: First enqueue 10 and 3 into the queue, followed by a dequeue(removes 10), followed by an enqueue(6), At this point, 3 is at the front end of the queue and 6 at the rear end, hence a call to frontElement() will return 3 which is displayed twice.

250+ TOP MCQs on Balanced Parenthesis and Answers

Data Structures & Algorithms Multiple Choice Questions on “Balanced Parenthesis”.

1. What is the time complexity of balancing parentheses algorithm?
a) O (N)
b) O (N log N)
c) O (M log N)
d) O (N2)

Answer: a
Clarification: The time complexity of balancing parentheses algorithm is mathematically found to be O (N).

2. Which application of stack is used to ensure that the pair of parentheses is properly nested?
a) Balancing symbols
b) Reversing a stack
c) Conversion of an infix to postfix expression
d) Conversion of an infix to prefix expression

Answer: a
Clarification: Balancing symbols application ensures that the pair of parentheses are properly nested while reversing stack reverses a stack.

3. In balancing parentheses algorithm, the string is read from?
a) right to left
b) left to right
c) center to right
d) center to left

Answer: b
Clarification: Any string is read by the compiler from left to right and not from right to left.

4. Which is the most appropriate data structure for applying balancing of symbols algorithm?
a) stack
b) queue
c) tree
d) graph

Answer: a
Clarification: Stack is the most appropriate data structure for balancing symbols algorithm because stack follows LIFO principle (Last In First Out).

5. Which of the following does the balancing symbols algorithm include?
a) balancing double quotes
b) balancing single quotes
c) balancing operators and brackets
d) balancing parentheses, brackets and braces

Answer: d
Clarification: The balancing symbols algorithm using stack only includes balancing parentheses, brackets and braces and not any other symbols.

6. Which of the following statement is incorrect with respect to balancing symbols algorithm?
a) {[()]}
b) ([ )]
c) {( )}
d) { [ ] }

Answer: b
Clarification: ([ )] is incorrect because’)’ occurs before the corresponding ‘]’ is encountered.

7. What should be done when an opening parentheses is read in a balancing symbols algorithm?
a) push it on to the stack
b) throw an error
c) ignore the parentheses
d) pop the stack

Answer: a
Clarification: When an opening bracket/braces/parentheses is encountered, it is pushed on to the stack. When the corresponding end bracket/braces/parentheses is not found, throw an error.

8. When the corresponding end bracket/braces/parentheses is not found, what happens?
a) The stack is popped
b) Ignore the parentheses
c) An error is reported
d) It is treated as an exception

Answer: c
Clarification: When the corresponding end bracket/braces/parentheses is not found, throw an error since they don’t match.

9. If the corresponding end bracket/braces/parentheses is encountered, which of the following is done?
a) push it on to the stack
b) pop the stack
c) throw an error
d) treated as an exception

Answer: b
Clarification: When the corresponding end bracket/braces/parentheses is encountered, the stack is popped. When an opening bracket/braces/parentheses is encountered, it is pushed on to the stack.

10. An error is reported when the stack is not empty at the end.
a) True
b) False

Answer: a
Clarification: When the stack contains elements at the end, it means that the given string of parentheses is not balanced.

11. Is the given statement ((A+B) + [C-D]] valid with respect to balancing of symbols?
a) True
b) False

Answer: b
Clarification: The given statement is invalid with respect to balancing of symbols because the last bracket does not correspond to the opening braces.

12. How many passes does the balancing symbols algorithm makes through the input?
a) one
b) two
c) three
d) four

Answer: a
Clarification: The balancing symbols algorithm makes only one pass through the input since it is linear.

13. Which of the following statement is invalid with respect to balancing symbols?
a) [(A+B) + (C-D)]
b) [{A+B}-{C-[D+E]}]
c) ((A+B) + (C+D)
d) {(A+B) + [C+D]}

Answer: c
Clarification: ((A+B) + (C+D) is invalid because the last close brace is not found in the statement.

250+ TOP MCQs on Binary Trees using Array and Answers

Data Structure Multiple Choice Questions on “Binary Trees using Array”.

1. How many children does a binary tree have?
a) 2
b) any number of children
c) 0 or 1 or 2
d) 0 or 1
Answer: c
Clarification: Can have atmost 2 nodes.

2. 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
Answer: c
Clarification: The size of array is fixed in normal arrays. We need to know the number of nodes in the tree before array declaration. It is the main disadvantage of using arrays to represent binary trees.

3. 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
Answer: a
Clarification: Maximum elements in a tree (complete binary tree in worst case) of height ‘L’ is 2L-1. Hence size of array is taken as 2L-1.

4. 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
Answer: a
Clarification: The left child is generally taken as 2*w whereas the right child will be taken as 2*w+1 because root node is present at index 0 in the array and to access every index position in the array.

5. 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
Answer: a
Clarification: Floor of w-1/2 because we can’t miss a node.

6. 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
Answer: a
Clarification: Array cannot represent arbitrary shaped trees. It can only be used in case of complete trees. If every node stores data saying that which of its children exists in the array then elements can be accessed easily.

7. What must be the missing logic in place of missing lines for finding sum of nodes of binary tree in alternate levels?

  //e.g:-consider -complete binary tree:-height-3, [1,2,3,4,5,6,7]-answer must be 23
  n=power(2,height)-1; //assume input is height and a[i] contains tree elements
  for(i=1;i<=n;)
  {
        //present level is initialized to 1 and sum is initialized to  0
        for(j=1;j<=pow(2,currentlevel-1);j++) 
        {
           sum=sum+a[i];
           i=i+1;
        }
     //missing logic
  }

a)

   i=i+pow(2,currentlevel);
   currentlevel=currentlevel+2;
   j=1;

b)

   i=i+pow(2,currentlevel);
   currentlevel=currentlevel+2;
   j=0;

c)

   i=i-pow(2,currentlevel);
   currentlevel=currentlevel+2;
   j=1;

d)

   i=i+pow(2,currentlevel);
   currentlevel=currentlevel+1;
   j=1;

View Answer

Answer: a
Clarification: The i value must skip through all nodes in the next level and current level must be one+next level.

 
 

8. 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
Answer: c
Clarification: In case of sparse trees (where one node per level in worst cases), the array size (2h)-1 where h is height but only h indexes will be filled and (2h)-1-h nodes will be left unused leading to space wastage.

9. Why is heap implemented using array representations than tree(linked list) representations though both tree representations and heaps have same complexities?

for binary heap
-insert: O(log n)
-delete min: O(log n)
 
for a tree
-insert: O(log n)
-delete: O(log n)

Then why go with array representation when both are having same values ?
a) arrays can store trees which are complete and heaps are not complete
b) lists representation takes more memory hence memory efficiency is less and go with arrays and arrays have better caching
c) lists have better caching
d) In lists insertion and deletion is difficult
Answer: b
Clarification: In memory the pointer address for next node may not be adjacent or nearer to each other and also array have wonderful caching power from os and manipulating pointers is a overhead. Heap data structure is always a complete binary tree.

10. 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
Answer: b
Clarification: We need any two traversals for tree formation but if some additional stuff or techniques are used while storing a tree in an array then one traversal can facilitate like also storing null values of a node in array.

250+ TOP MCQs on Top Tree and Answers

Data Structures & Algorithms Multiple Choice Questions on “Top Tree”.

1. Which algorithm is used in the top tree data structure?
a) Divide and Conquer
b) Greedy
c) Backtracking
d) Branch

Answer: a
Clarification: Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to solve path related problems. It allows an algorithm called divide and conquer.

2. For how many vertices in a set, is top tree defined for underlying tree?
a) 3
b) 4
c) 5
d) 2

Answer: d
Clarification: Top tree is defined for a set having a maximum of 2 vertices for its underlying tree. Those sets having at maximum 2 vertices is called External Boundary Vertices.

3. How many edges are present in path cluster?
a) 2
b) 3
c) 6
d) 1

Answer: a
Clarification: There are at least 2 edges present in path cluster. Cluster in data structure is defined as the subtree that is connect having maximum of 2 vertices known as Boundary Vertices.

4. How many edges does a leaf cluster contain?
a) 0
b) 1
c) 2
d) 3

Answer: a
Clarification: If a cluster has no edges and contains only one vertex known as boundary vertex then, it is known as leaf cluster. So a leaf cluster doesn’t contain any edges. It is also known as Point cluster.

5. How many edges are present in Edge cluster?
a) 0
b) 1
c) 2
d) 4

Answer: b
Clarification: A cluster containing only single edge is known as Edge cluster. So there are in total 1 edge present in edge cluster. Cluster in data structure is defined as the subtree that is connect having maximum of 2 vertices known as Boundary Vertices.

6. Which data structure is used to maintain a dynamic forest using a link or cut operation?
a) Top Tree
b) Array
c) Linked List
d) Stack

Answer: a
Clarification: Top tree data structure is used to maintain a dynamic forest using link or cut operations. Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to solve path related problems.

7. If A ꓵ B (A and B are two clusters) is a singleton set then it is a Merge able cluster.
a) True
b) False

Answer: a
Clarification: If A ꓵ B is a singleton set where A and B are two clusters, that is there are only one node that is common between the clusters then they are known as Merge able cluster.

8. Is Top tree used for maintaining Dynamic set of trees called forest.
a) True
b) False

Answer: a
Clarification: Top tree data structure is used to maintain a dynamic forest using link or cut operations. Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to solve path related problems.

9. What is the time complexity for the initialization of top tree?
a) O (n)
b) O (n2)
c) O (log n)
d) O (n!)

Answer: a
Clarification: Generally, trees have weight on its edges. Also there is one to one correspondence of the edges with the top trees. Therefore, top trees can be initialized in O (n) time.

10. How many top trees are there in a tree with single vertex?
a) 0
b) 1
c) 2
d) 3

Answer: a
Clarification: Tree having a single vertex has no clusters of tree present in the structure. Therefore, there are empty top trees in a tree having a single vertex. Trees with one node are single node.

11. Which property makes top tree a binary tree?
a) Nodes as Cluster
b) Leaves as Edges
c) Root is Tree Itself
d) All of the mentioned

Answer: d
Clarification: Top tree can be considered as a binary tree if the nodes form a cluster, leaves act as an edge and the root of the top tree acts as a tree itself. Then the top tree is called binary tree.

12. Which of the dynamic operations are used in Top Tree data structure implementation?
a) Link
b) Cut
c) Expose
d) All of the mentioned

Answer: d
Clarification: Link returns a single tree having different vertices from top trees. Cut removes the edge from the top tree. Expose is used to implement queries on top trees. Hence all of the options are used as dynamic operations.

13. Which of the following are used as an internal operation in Top tree?
a) Merge
b) Cut
c) Expose
d) Link

Answer: a
Clarification: Link returns a single tree having different vertices from top trees. Cut removes the edge from the top tree. Expose is used to implement queries on top trees. While merge is an internal operation used to merge two clusters and return as a parent cluster.

14. What is the time complexity for maintaining a dynamic set of weighted trees?
a) O (n)
b) O (n2)
c) O (log n)
d) O (n!)

Answer: c
Clarification: A lot of applications have been implemented using Top tree interface. Maintaining a dynamic set of weighted trees is one such application which can be implemented with O (log n) time complexity.

250+ TOP MCQs on KD Tree and Answers

Data Structures & Algorithms Multiple Choice Questions on “KD Tree”.

1. In what time can a 2-d tree be constructed?
a) O(N)
b) O(N log N)
c) O(N2)
d) O(M log N)

Answer: b
Clarification: A perfectly balanced 2-d tree can be constructed in O(N log N) time. This value is computed mathematically.

2. Insertion into a 2-d tree is a trivial extension of insertion into a binary search tree.
a) true
b) false

Answer: a
Clarification: Insertion of elements in a 2-d tree is similar to that of a binary search tree. Hence, it is a trivial extension of the binary search tree.

3. In a two-dimensional search tree, the root is arbitrarily chosen to be?
a) even
b) odd
c) depends on subtrees
d) 1

Answer: b
Clarification: In a two- dimensional k-d tree (i.e.) 2-d tree, the root is arbitrarily chosen to be an odd level and it applies to all 2-d trees.

4. Which of the following is the simplest data structure that supports range searching?
a) Heaps
b) binary search trees
c) AA-trees
d) K-d trees

Answer: d
Clarification: K-d trees are the simplest data structure that supports range searching and also it achieves the respectable running time.

5. In a k-d tree, k originally meant?
a) number of dimensions
b) size of tree
c) length of node
d) weight of node

Answer: a
Clarification: Initially, 2-d trees were created. Then, 3-d trees, 4-trees etc., where k meant the number of dimensions.

7. Each level in a k-d tree is made of?
a) dimension only
b) cutting and dimension
c) color code of node
d) size of the level

Answer: b
Clarification: Each level in a k-d tree is made of dimensions and cutting. Cutting and dimensions are used for insertion, deletion and searching purposes.

8. What is the worst case of finding the nearest neighbour?
a) O(N)
b) O(N log N)
c) O( log N)
d) O(N3)

Answer: a
Clarification: The worst case analysis of finding the nearest neighbour in a k-d tree is mathematically found to be O(N).

9. What is the run time of finding the nearest neighbour in a k-d tree?
a) O(2+ log N)
b) O( log N)
c) O(2d log N)
d) O( N log N)

Answer: c
Clarification: The run time of finding the nearest neighbour in a kd tree is given as O(2d log N) where 2d is the time taken to search the neighbourhood.

10. How many prime concepts are available in nearest neighbour search in a kd tree?
a) 1
b) 2
c) 3
d) 4

Answer: c
Clarification: Three important concepts are available in finding the nearest neighbour. They are partial results, pruning, traversal order.

11. Reducing search space by eliminating irrelevant trees is known as?
a) pruning
b) partial results
c) freeing space
d) traversing

Answer: a
Clarification: Pruning is eliminating irrelevant trees. Partial results are keeping best results and updating. Traversal is visiting all the nodes of a tree.

12. Several kinds of queries are possible on a k-d called as?
a) partial queries
b) range queries
c) neighbour queries
d) search queries

Answer: b
Clarification: Several range queries are possible on a k-d tree. One of the range queries is known as a partial match query.

13. What is the time taken for a range query for a perfectly balanced tree?
a) O(N)
b) O(log N)
c) O(√N+M)
d) O(√N)

Answer: c
Clarification: For a perfectly balanced k-d tree, the range query could take O(√N+M) in the worst case to report M matches.

14. The 2d search tree has the simple property that branching on odd levels is done with respect to the first key.
a) True
b) False

Answer: a
Clarification: Branching on odd levels is done with respect to the first key and branching on even levels is done with respect to the second key in a 2-d tree.

15. Who invented k-d trees?
a) Arne Andersson
b) Jon Bentley
c) Jon Von Newmann
d) Rudolf Bayer

Answer: b
Clarification: Jon Bentley found k-d trees. Rudolf Bayer found red black trees. Arne Andersson found AA- trees.

250+ TOP MCQs on Hash Tables and Answers

Data Structure Multiple Choice Questions on “Hash Tables”.

1. What is a hash table?
a) A structure that maps values to keys
b) A structure that maps keys to values
c) A structure used for storage
d) A structure used to implement stack and queue
Answer: b
Clarification: A hash table is used to implement associative arrays which has a key-value pair, so the has table maps keys to values.

2. If several elements are competing for the same bucket in the hash table, what is it called?
a) Diffusion
b) Replication
c) Collision
d) Duplication
Answer: c
Clarification: In a hash table, if sevaral elements are computing for the same bucket then there will be a clash among elements. This condition is called Collision. The Collision is reduced by adding elements to a linked list and head address of linked list is placed in hash table.

3. What is direct addressing?
a) Distinct array position for every possible key
b) Fewer array positions than keys
c) Fewer keys than array positions
d) Same array position for all keys
Answer: a
Clarification: Direct addressing is possible only when we can afford to allocate an array that has one position for every possible key.

4. What is the search complexity in direct addressing?
a) O(n)
b) O(logn)
c) O(nlogn)
d) O(1)
Answer: d
Clarification: Since every key has a unique array position, searching takes a constant time.

5. What is a hash function?
a) A function has allocated memory to keys
b) A function that computes the location of the key in the array
c) A function that creates an array
d) A function that computes the location of the values in the array
Answer: b
Clarification: In a hash table, there are fewer array positions than the keys, so the position of the key in the array has to be computed, this is done using the hash function.

6. Which of the following is not a technique to avoid a collision?
a) Make the hash function appear random
b) Use the chaining method
c) Use uniform hashing
d) Increasing hash table size
Answer: d
Clarification: On increasing hash table size, space complexity will increase as we need to reallocate the memory size of hash table for every collision. It is not the best technique to avoid a collision. We can avoid collision by making hash function random, chaining method and uniform hashing.

7. What is the load factor?
a) Average array size
b) Average key size
c) Average chain length
d) Average hash table length
Answer: c
Clarification: In simple chaining, load factor is the average number of elements stored in a chain, and is given by the ratio of number of elements stored to the number of slots in the array.

8. What is simple uniform hashing?
a) Every element has equal probability of hashing into any of the slots
b) A weighted probabilistic method is used to hash elements into the slots
c) Elements has Random probability of hashing into array slots
d) Elements are hashed based on priority
Answer: a
Clarification: In simple uniform hashing, any given element is equally likely to hash into any of the slots available in the array.

9. In simple uniform hashing, what is the search complexity?
a) O(n)
b) O(logn)
c) O(nlogn)
d) O(1)
Answer: d
Clarification: There are two cases, once when the search is successful and when it is unsuccessful, but in both the cases, the complexity is O(1+alpha) where 1 is to compute the hash function and alpha is the load factor.

10. In simple chaining, what data structure is appropriate?
a) Singly linked list
b) Doubly linked list
c) Circular linked list
d) Binary trees
Answer: b
Clarification: Deletion becomes easier with doubly linked list, hence it is appropriate.