Explore topic-wise MCQs in Data Structures and Algorithms.

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

1.

An array consists of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in order of

A. O(n*n*logn)
B. O(n*logn)
C. O(n*n)
D. O(n *logn *logn)
Answer» C. O(n*n)
2.

If we implement heap as maximum heap , adding a new node of value 15 to the left most node of right subtree. What value will be at leaf nodes of the right subtree of the heap.

A. 15 and 1
B. 25 and 1
C. 3 and 1
D. 2 and 3
Answer» B. 25 and 1
3.

If we implement heap as min-heap, deleting root node (value 1)from the heap. What would be the value of root node after second iteration if leaf node (value 100) is chosen to replace the root at start.

A. 2
B. 100
C. 17
D. 3
Answer» B. 100
4.

The worst case complexity of deleting any arbitrary node value element from heap is __________

A. O(logn)
B. O(n)
C. O(nlogn)
D. O(n2)
Answer» B. O(n)
5.

Out of the following given options, which is the fastest algorithm?

A. fibonacci heap
B. pairing heap
C. d-ary heap
D. binary heap
Answer» B. pairing heap
6.

How is a pairing heap represented?

A. binary tree
B. fibonacci tree
C. heap ordered tree
D. treap
Answer» D. treap
7.

What is the fundamental operation performed in skew heaps?

A. intersection
B. difference
C. merging
D. sorting
Answer» D. sorting
8.

Is decrease priority operation performed more quickly in a ternary heap with respect to the binary heap.

A. True
B. False
Answer» B. False
9.

What is the reason for the efficiency of a pairing heap?

A. simplicity
B. time-efficient
C. space-efficient
D. advanced
Answer» B. time-efficient
10.

What is the efficiency of merge used in leftist heaps?

A. O(N)
B. O(N log N)
C. O(M log N)
D. O(log N)
Answer» E.
11.

Min heap is a complete binary tree.

A. True
B. False
Answer» B. False
12.

On which data structure is a d-ary heap based?

A. stack
B. queue
C. linked list
D. priority queue
Answer» E.
13.

d-heap is shallower than a binary heap.

A. true
B. false
Answer» B. false
14.

What is the basic operation performed in a pairing heap?

A. merge
B. deletion
C. insertion
D. swapping
Answer» B. deletion
15.

d-heap is similar to that of a?

A. binary heap
B. fibonacci heap
C. leftist heap
D. treap
Answer» B. fibonacci heap
16.

Min heap can be used to implement selection sort.

A. True
B. False
Answer» B. False
17.

What is the amortized efficiency of skew merge?

A. O(N)
B. O( log N)
C. O( N log N)
D. O(N2)
Answer» C. O( N log N)
18.

In a binary min heap containing n elements, the largest element can be found in __________ time.

A. O(n)
B. O(nlogn)
C. O(logn)
D. O(1)
Answer» B. O(nlogn)
19.

The ascending heap property is ___________

A. A[Parent(i)] =A[i]
B. A[Parent(i)] <= A[i]
C. A[Parent(i)] >= A[i]
D. A[Parent(i)] > 2 * A[i]
Answer» C. A[Parent(i)] >= A[i]
20.

How many basic operations can be performed in a d-heap?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
21.

The actual pairing heap implementation uses the right child and left child representation.

A. true
B. false
Answer» C.
22.

Multiplication and division to find children and parents cannot be implemented in a d-heap.

A. true
B. false
Answer» C.
23.

What is the time complexity for deleting root key in a ternary heap of n elements?

A. O (log n/ log 3)
B. O (3log n/ log 3)
C. O (n)
D. O (1)
Answer» C. O (n)
24.

Which operation is not efficiently performed in a d-heap?

A. insert
B. delete
C. find
D. merge
Answer» E.
25.

In what time can a leftist heap be built?

A. O(N)
B. O(N log N)
C. O(log N)
D. O(M log N)
Answer» B. O(N log N)
26.

What is a ternary heap?

A. An array with three elements
B. Linked list with three elements
C. Tree with three children
D. Heap with all nodes having three children
Answer» E.
27.

What is the run time efficiency of delete-min operation?

A. O(log N)
B. O(logd N)
C. O(d logd N)
D. O(d)
Answer» D. O(d)
28.

The worst case analysis for a naïve merge is given as?

A. O(N)
B. O( log N)
C. O( N log N)
D. O(N2)
Answer» B. O( log N)
29.

What happens if the null path length is not updated?

A. error occurs
B. all null path lengths will be 0
C. all null path lengths will be -1
D. all null path lengths will be 1
Answer» C. all null path lengths will be -1
30.

Why is this heap named leftist heap?

A. only left subtrees exist
B. the tree is biased to get deep down the left
C. it is balanced
D. right trees are unbalanced
Answer» C. it is balanced
31.

What is the process of building a ternary heap called?

A. Heapify
B. Hashing
C. Linking
D. Merging
Answer» B. Hashing
32.

What is the time complexity for inserting a new item in a ternary heap of n elements?

A. O (log n/ log 3)
B. O (n!)
C. O (n)
D. O (1)
Answer» B. O (n!)
33.

The Statement “Fibonacci heap has better amortized running time in compare to a binomial heap”.

A. True
B. False
Answer» B. False
34.

If there are c children of the root, how many calls to the merge procedure is required to reassemble the heap?

A. c
B. c+1
C. c-1
D. 1
Answer» D. 1
35.

What is the time complexity for increasing priority of key in a minimum ternary heap of n elements?

A. O (log n/ log 3)
B. O (3log n/ log 3)
C. O (n)
D. O (1)
Answer» C. O (n)
36.

Pointer manipulation is generally more time-consuming than multiplication and division.

A. true
B. false
Answer» B. false
37.

Given an array of element 5,7,9,1,3,10,8,4. Tick all the correct sequences of elements after inserting all the elements in a min-heap.

A. 1,3,4,7,8,9,10
B. 1,4,3,8,9,5,7,10
C. 1,3,4,5,8,7,9,10
D. None of the mentioned
Answer» B. 1,4,3,8,9,5,7,10
38.

Naïve merge cannot be done in a skew merge.

A. true
B. false
Answer» C.
39.

Which of these operations have same complexities?

A. Insertion, find_min
B. Find_min, union
C. Union, Insertion
D. Deletion, Find _max
Answer» D. Deletion, Find _max
40.

A leftist heap is also said to be a binary heap.

A. true
B. false
Answer» B. false
41.

Who invented d-ary heap?

A. Carl Rick
B. Alan Turing
C. Donald Johnson
D. Euclid
Answer» D. Euclid
42.

Which node contains a pointer to its parent?

A. root node
B. right most child
C. left most child
D. left sibling
Answer» D. left sibling
43.

In skew heaps, certain constraints are to be met in order to perform swapping.

A. true
B. false
Answer» C.
44.

What will be the position of 5, when a max heap is constructed on the input elements 5, 70, 45, 7, 12, 15, 13, 65, 30, 25?

A. 5 will be at root
B. 5 will be at last level
C. 5 will be at second level
D. 5 can be anywhere in heap
Answer» C. 5 will be at second level
45.

What is the time complexity for decreasing priority of key in a minimum ternary heap of n elements?

A. O (log n/ log 3)
B. O (n!)
C. O (n)
D. O (1)
Answer» B. O (n!)
46.

Which operation cannot be directly performed in a d-heap?

A. insert
B. delete
C. find
D. create
Answer» D. create
47.

What is the fundamental operation on leftist heap?

A. insertion
B. merging
C. deletion
D. swapping
Answer» C. deletion
48.

The amortized time efficiency for performing deletion of a minimum element is?

A. O(N)
B. O(log N)
C. O(N2)
D. O(M log N)
Answer» C. O(N2)
49.

How many properties does a leftist heap support?

A. 1
B. 2
C. 3
D. 4
Answer» D. 4
50.

What would be the result if the left subtree of the root has a null path length of 1 and the right subtree has a null path length of 2?

A. merge occurs without violation
B. violation at left subtree
C. violation at right subtree
D. violation at the root
Answer» E.