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.

51.

Electrical connectivity is an example of equivalence relation.(a) true(b) falseMy question comes from Trees topic in chapter Trees of Data Structures & Algorithms IThe question was posed to me in exam.

Answer»

Correct CHOICE is (a) true

Easiest explanation - Electrical connectivity is REFLEXIVE, symmetric and also transitive. HENCE, electrical connectivity is an equivalence relation.

52.

A relation R on a set S, defined as x R y if and only if y R x. This is an example of?(a) reflexive relation(b) symmetric relation(c) transitive relation(d) invalid relationI want to ask this question from Trees in section Trees of Data Structures & Algorithms IThis question was posed to me in homework.

Answer» RIGHT ANSWER is (b) SYMMETRIC relation

Explanation: A symmetric PROPERTY in an equivalence relation is defined as x R y if and only y R x.
53.

How many properties will an equivalent relationship satisfy?(a) 1(b) 2(c) 3(d) 4I'm obligated to ask this question of Trees topic in portion Trees of Data Structures & Algorithms II had been asked this question by my school principal while I was bunking the class.

Answer»

The CORRECT ANSWER is (c) 3

For EXPLANATION: An equivalent relationship will satisfy three PROPERTIESREFLEXIVE, symmetric and transitive.

54.

Which operation find the value associated with a given key?(a) Insert(b) Find Next(c) Look up(d) DeleteI would like to ask this question from Trees in portion Trees of Data Structures & Algorithms II got this question in an interview.

Answer»

Correct choice is (B) Find Next

Best explanation: This data STRUCTURE implements an ABSTRACT data TYPE called associative array for the given integer keys. Hence, to find the value associated with a given key, Look Up operation is PERFORMED.

55.

On which abstract data type does van Emde Boas tree performs the operation?(a) Tree(b) Linked List(c) Heap(d) Associative ArrayThe above asked question is from Trees topic in portion Trees of Data Structures & Algorithms IThe question was asked in a job interview.

Answer» CORRECT answer is (d) Associative Array

Best explanation: The Van Emde Boas Tree DATA structure is also popularly known as Van Emde Boas Priority Queue. This data structure implements an ABSTRACT data type called associative array for the GIVEN integer keys.
56.

What is the time complexity for finding a maximum and minimum integer in Van Emde Boas data structure?(a) O (log M!)(b) O (M!)(c) O (1)(d) O (log (log M))My doubt stems from Trees in section Trees of Data Structures & Algorithms II had been asked this question in an interview for job.

Answer»

The correct option is (c) O (1)

Easy EXPLANATION - In order to find a maximum or minimum INTEGER in the Van Emde Boas data structure, the operation can be PERFORMED on an associative array. Hence, the time complexity for FINDING a maximum or minimum integer in Van Emde Boas data structure is O (1).

57.

Can operation like Find Next and Find Previous be implemented.(a) True(b) FalseThe origin of the question is Trees in chapter Trees of Data Structures & Algorithms II got this question during an internship interview.

Answer»

Correct answer is (a) True

Easy explanation - Since the Van Emde Boas data structure follows an associative array abstract data type to perform DIFFERENT operations. Hence, an OPERATION LIKE Find NEXT and Find Previous be IMPLEMENTED.

58.

What is the time complexity for deleting a key or integer in Van Emde Boas data structure?(a) O (log M!)(b) O (log (log M))(c) O (M!)(d) O (M^2)My question is taken from Trees in division Trees of Data Structures & Algorithms II had been asked this question in homework.

Answer»

The correct option is (b) O (log (log M))

For EXPLANATION: In order to delete a key or integer in the Van Emde Boas DATA structure, the operation can be performed on an associative ARRAY. HENCE, the time complexity for DELETING a key or integer in Van Emde Boas data structure is O (log (log M)).

59.

In which year was Van Emde Boas tree invented?(a) 1972(b) 1973(c) 1974(d) 1975This interesting question is from Trees topic in division Trees of Data Structures & Algorithms II got this question in an interview.

Answer»

The correct answer is (d) 1975

To explain: The VAN Emde BOAS TREE data structure is also popularly KNOWN as Van Emde Boas Priority Queue. This data structure implements the ARRAY associatively for the given integer keys. It was formulated by Peter Van Emde Boas in 1975.

60.

What is the time complexity for inserting a key or integer in Van Emde Boas data structure?(a) O (log M!)(b) O (M!)(c) O (M^2)(d) O (log (log M))My doubt stems from Trees in section Trees of Data Structures & Algorithms II had been asked this question in a job interview.

Answer»

Correct answer is (a) O (log M!)

The best explanation: In order to insert a key or integer in the VAN Emde Boas DATA structure, the operation can be PERFORMED on an ASSOCIATIVE array. Hence, the TIME complexity for inserting a key or integer in Van Emde Boas data structure is O (log (log M)).

61.

Which type of tree does Van Emde Boas require to perform basic operations?(a) Unbalanced(b) Balanced(c) Complete(d) Non – BinaryI'm obligated to ask this question of Trees topic in chapter Trees of Data Structures & Algorithms IThis question was posed to me in examination.

Answer»

The correct option is (d) Non – Binary

Easy EXPLANATION - The Van Emde Boas Tree data structure is also popularly KNOWN as Van Emde Boas PRIORITY Queue. This data structure implements the array associatively for the given integer KEYS. It was formulated by Peter Van Emde Boas. It is a non – binary type of tree.

62.

What is the time complexity for searching a key or integer in Van Emde Boas data structure?(a) O (log M!)(b) O (M!)(c) O (M^2)(d) O (log (log M))Question is from Trees in division Trees of Data Structures & Algorithms II had been asked this question in an interview for internship.

Answer»

Right CHOICE is (d) O (log (log M))

For explanation: In ORDER to search a KEY or integer in the Van Emde Boas data structure, the operation can be performed on an associative array. Hence, the time COMPLEXITY for searching a key or integer in Van Emde Boas data structure is O (log (log M)).

63.

Does Van Emde Boas data structure perform all operation in O (log (log M)) time where M = 2^m.(a) True(b) FalseMy question is based upon Trees in division Trees of Data Structures & Algorithms IThe question was posed to me in an international level competition.

Answer»

Right choice is (a) True

Best explanation: All the OPERATIONS performed on the Van Emde Boas tree with an associative array like Insertion, DELETION, Searching and many more can be performed in O (log (log M)) time where M = 2^m.

64.

What is the time complexity for storing the maximum number of elements in Van Emde Boas tree if M is the maximum number of elements?(a) O (log M)(b) O (M!)(c) O (M)(d) O (1)This interesting question is from Trees topic in division Trees of Data Structures & Algorithms IThe question was posed to me during an internship interview.

Answer»

Correct option is (c) O (M)

The BEST I can explain: In ORDER to store the MAXIMUM number of elements in Van Emde Boas data structure where M is the maximum number of elements, the tree has great EFFICIENCY for storing them. So the time complexity for WORST case is found to be O (M).

65.

Who Invented The vEB also known as Van Emde Boas Tree?(a) Peter Van Emde Boas(b) Samuel F. B. Morse(c) Friedrich Clemens Gerke(d) Alexander MorseQuestion is taken from Trees in division Trees of Data Structures & Algorithms IThis question was addressed to me in class test.

Answer»

Right option is (d) Alexander Morse

To explain: The VAN Emde Boas Tree data structure is also popularly known as Van Emde Boas Priority Queue. This data structure IMPLEMENTS the array ASSOCIATIVELY for the given integer KEYS. It was formulated by PETER Van Emde Boas.

66.

What is the other name or Van Emde Boas Tree data structure?(a) Van Emde Boas Array(b) Van Emde Boas Stack(c) Van Emde Boas Priority Queue(d) Van Emde Boas HeapThis question is from Trees in division Trees of Data Structures & Algorithms II had been asked this question at a job interview.

Answer»

The CORRECT answer is (c) Van Emde Boas Priority Queue

For explanation: The Van Emde Boas Tree data STRUCTURE is also popularly known as Van Emde Boas Priority Queue. This data structure IMPLEMENTS the array associatively for the given INTEGER keys. It was formulated by PETER Van Emde Boas.

67.

Is Node A sibling of Node B in the given K-ary tree?(a) True(b) FalseMy question is based upon K-ary Tree topic in chapter Trees of Data Structures & Algorithms II got this question in semester exam.

Answer»

The correct option is (B) False

Easy EXPLANATION - NODE D, Node C are the siblings of Node B while Node A is the parent node of Node B.

68.

How many extra nodes are there in Full K-ary tree than complete K-ary tree?(a) 1(b) 2(c) 3(d) Both have same number of nodesI would like to ask this question from K-ary Tree topic in division Trees of Data Structures & Algorithms IThe question was posed to me in final exam.

Answer»

Correct OPTION is (d) Both have same NUMBER of NODES

Best explanation: Every Full K-ary TREE is ALSO a complete K-ary tree. Therefore, both have same number of nodes.

69.

Which nodes are the siblings of Node D of given ternary tree?(a) E(b) C(c) F(d) HMy query is from K-ary Tree in section Trees of Data Structures & Algorithms IThe question was posed to me in homework.

Answer»

Correct choice is (d) H

The best I can EXPLAIN: Siblings are the nodes that SHARE same parent. Since both the Node H is parent Node D, So the SIBLING of Node D is Node H.

70.

Which one of the following is the correct formulae to find the parent node at index I?(a) (I-1)/K(b) (I+1)/K(c) (I*1)/K(d) (I-2)/KThe question is from K-ary Tree in division Trees of Data Structures & Algorithms II got this question in a national level competition.

Answer»

The correct OPTION is (a) (I-1)/K

To explain: The PARENT node for the node of INDEX I in a K-ary tree is GIVEN by (I-1)/K.

71.

What is the height of a K-ary tree having only root node?(a) 1(b) 0(c) 2(d) 3This intriguing question originated from K-ary Tree in portion Trees of Data Structures & Algorithms IThe question was posed to me in a job interview.

Answer» CORRECT choice is (b) 0

The BEST I can EXPLAIN: Height of a K-ary tree does not include the root node. So the height of the K-ary tree is without root node is 0.
72.

What is the upper bound for maximum leaves in K-ary tree with height h?(a) K*h(b) K^h(c) K+h(d) K-hQuery is from K-ary Tree topic in portion Trees of Data Structures & Algorithms II have been asked this question during an interview for a job.

Answer»

Correct answer is (b) K^H

The BEST EXPLANATION: In the K-ary tree having height h, the upper bound for having maximum NUMBER of leaves is k^h.

73.

Can child node be always called Leaf node in the K-ary tree?(a) True(b) FalseThe above asked question is from K-ary Tree in section Trees of Data Structures & Algorithms IThis question was posed to me in an interview for internship.

Answer»

Right CHOICE is (B) False

Easiest explanation - LEAF NODE is any node that does not contain any children. Child node may or may not contain more nodes. Child node will only be CALLED leaf Node if the node has no child node.

74.

Can leaf node be called child node in a K-ary tree?(a) True(b) falseMy query is from K-ary Tree in division Trees of Data Structures & Algorithms IThis question was posed to me during an interview.

Answer»

Right answer is (a) True

Explanation: Leaf node is a node that has no CHILD. Since Leaf node will always be the node on the last level of k-ary TREE, so it can be called child node of given PARENT node in K-ary tree.

75.

What is the size of Node B in given K-ary tree?(a) 1(b) 2(c) 3(d) 4This key question is from K-ary Tree topic in division Trees of Data Structures & Algorithms IThe question was asked at a job interview.

Answer»

The CORRECT ANSWER is (a) 1

Best explanation: SIZE of node is defined as the total number of descendants of that node INCLUDING itself. So, size of Node B is 1.

76.

Who is descendant of Node C?(a) A(b) E(c) D(d) GThis interesting question is from K-ary Tree topic in portion Trees of Data Structures & Algorithms IThis question was posed to me in exam.

Answer»

Correct OPTION is (d) G

Easiest explanation - Descendant node is a node which has a direct PATH from ANCESTOR node. Since Node G is CONNECTED to C, so Node G is the descendant of Node C.

77.

Who is the ancestor of Node H?(a) D(b) F(c) H(d) AQuery is from K-ary Tree in section Trees of Data Structures & Algorithms IThis question was addressed to me during an internship interview.

Answer»

The correct OPTION is (a) D

The best explanation: Ancestor NODE is a node that comes in between the PATH from the node to the root. Since Node D comes between node H and root, so Node D is called the ancestor node.

78.

What is the size of the given K-ary tree?(a) 3(b) 2(c) 6(d) 4This interesting question is from K-ary Tree in portion Trees of Data Structures & Algorithms IThe question was asked in quiz.

Answer»

Right OPTION is (c) 6

For explanation: Size of the K-ary TREE is defined as the TOTAL number of nodes present in the tree. Since there are total of 6 nodes in the K-ary tree. So the size of the K-ary tree is 6.

79.

What is the Height of the given K-ary tree?(a) 0(b) 1(c) 2(d) 3This key question is from K-ary tree in portion Trees of Data Structures & Algorithms II got this question during an online exam.

Answer»

Correct answer is (c) 2

Easy explanation - Height of the tree is DEFINED as the length of the path from ROOT node to the deepest node of the tree. Here deepest NODES are 5,6,7 which are at length 2. So the height of the K-ary tree is 2.

80.

What is the depth of Node F in the given K-ary tree?(a) 0(b) 1(c) 2(d) 3My doubt is from K-ary tree topic in division Trees of Data Structures & Algorithms II had been asked this question in class test.

Answer» RIGHT choice is (c) 2

For explanation: Depth of the NODE is the LENGTH of the path from ROOT to the node. Here, length of path from root to Node F is 2. So depth of Node F is 2.
81.

Which node is the child node of the Node B in the following K-ary tree?(a) A(b) C(c) B(d) No child nodeAsked question is from K-ary tree in chapter Trees of Data Structures & Algorithms IThe question was posed to me in a job interview.

Answer» RIGHT answer is (d) No CHILD node

The best EXPLANATION: Since Node B is the LEAF node of the above ternary tree and leaf node has no child node. So there is no child node for Node B in the above K-ary tree.
82.

Which node is the child node of Node C in the following K-ary tree?(a) A(b) C(c) G(d) HThis interesting question is from K-ary tree in portion Trees of Data Structures & Algorithms II had been asked this question in unit test.

Answer»

The correct option is (C) G

The best EXPLANATION: The Child node is the node that has a directed PATH from its parent node. Since Node C has a DIRECT path to Node G, So Node G is the Child node.

83.

Is parent node of Node 4 and root node of the given K-ary tree same?(a) True(b) FalseThis is a very interesting question from K-ary tree topic in chapter Trees of Data Structures & Algorithms II got this question in an online interview.

Answer»

The correct answer is (a) True

Easy explanation - SINCE Root NODE of the ternary tree is Node 1 and also Node 1 has three children that is Node 2, Node 3, Node 4. So parent node of Node 4 and the root node of the ternary tree are same.

84.

Which node is the parent node of Node 5?(a) 1(b) 5(c) 2(d) 3I'm obligated to ask this question of K-ary tree topic in division Trees of Data Structures & Algorithms IThis question was posed to me in semester exam.

Answer»

The correct CHOICE is (c) 2

To explain: SINCE Node 2 has two children Node 5 and Node 6, So Node 2 is the parent node of Node 5. While Node 1 is ROOT node and Node 3 and Node 5 are Leaf node.

85.

Which node is the Leaf node in the following K-ary tree?(a) A(b) B(c) D(d) FMy question comes from K-ary tree in chapter Trees of Data Structures & Algorithms II have been asked this question by my college director while I was bunking the class.

Answer»

The correct choice is (d) F

Explanation: Leaf node is any node that does not contain any CHILDREN. Since Node F is the node WITHOUT any children, So F is CALLED Leaf Node. While Node A is root node and Node B, Node C, Node D is parent node of their children.

86.

Which node is the root node of the following K-ary tree?(a) A(b) B(c) C(d) DI want to ask this question from K-ary tree in portion Trees of Data Structures & Algorithms II have been asked this question by my college director while I was bunking the class.

Answer»

Right OPTION is (a) A

To explain: Node A is CALLED the ROOT node of the above K-ary tree while the Node B, Node C, Node D are called Leaf node.

87.

What is the Height of the root node of K-ary tree?(a) 1(b) 2(c) 3(d) 0Asked question is from K-ary tree in division Trees of Data Structures & Algorithms II have been asked this question in semester exam.

Answer» CORRECT OPTION is (d) 0

For explanation: Height of K-ary TREE is DEFINED as the length of path from root to deepest node in tree. Therefore, height of root node in K-ary tree is 0.
88.

What is the depth of the root node of K-ary tree?(a) 2(b) 1(c) 0(d) 3My question is taken from K-ary tree in section Trees of Data Structures & Algorithms IThe question was asked during an internship interview.

Answer»

Right option is (c) 0

The BEST I can explain: Depth is DEFINED as the length of the path from root to the node. So the depth of root node in K-ary tree is 0.

89.

Which of the following is the name of the node having child nodes?(a) Brother(b) Sister(c) Mother(d) ParentThis intriguing question originated from K-ary tree in section Trees of Data Structures & Algorithms IThe question was asked in homework.

Answer»

Right answer is (d) Parent

The explanation is: Parent node is the node having CHILD NODES and child nodes may contain references to their PARENTS. Parent node is a node CONNECTED by a directed edge to its child.

90.

How many child nodes does each node of K-ary Tree contain?(a) 2(b) 3(c) more than k(d) at most kOrigin of the question is K-ary tree topic in division Trees of Data Structures & Algorithms II have been asked this question in an online interview.

Answer»

Correct option is (d) at most K

The explanation is: Each NODE of K-ary tree contains at most k NODES. While tree with 2 nodes is called Binary tree and tree with 3 nodes is called TERNARY tree.

91.

Which of the following is the implementation of the ternary tree?(a) AVL Tree(b) Ternary Heap(c) Hash Table(d) DictionaryEnquiry is from Ternary Tree topic in division Trees of Data Structures & Algorithms IThe question was asked in my homework.

Answer»

Correct answer is (b) Ternary Heap

Explanation: Ternary TREE is used to IMPLEMENT ternary search tree and ternary heap. While AVL Tree, hash Table, DICTIONARY are different types of DATA Structures.

92.

Can child node be always called Leaf node in the ternary tree?(a) True(b) FalseAsked question is from Ternary Tree topic in chapter Trees of Data Structures & Algorithms IThe question was posed to me during a job interview.

Answer» RIGHT CHOICE is (b) False

Explanation: Leaf node is any node that does not CONTAIN any children. Child node MAY or may not contain more nodes. Child node will only be called leaf Node if the node has no child node.
93.

Can leaf node be called child node in a ternary tree?(a) True(b) FalseI would like to ask this question from Ternary Tree topic in division Trees of Data Structures & Algorithms II have been asked this question in my homework.

Answer»

The correct option is (a) True

The best explanation: Leaf NODE is a node that has no child. SINCE Leaf node will ALWAYS be the node on the last level of ternary TREE, so it can be CALLED child node of given parent node in ternary tree.

94.

What is the size of Node A?(a) 1(b) 2(c) 3(d) 4My question is taken from Ternary Tree topic in section Trees of Data Structures & Algorithms II have been asked this question during an interview for a job.

Answer» RIGHT answer is (d) 4

The best explanation: SIZE of node is defined as the TOTAL number of DESCENDANTS of that node INCLUDING itself. So, size of Node A is 4.
95.

Who is descendant of Node B?(a) A(b) E(c) F(d) Both E and FOrigin of the question is Ternary Tree topic in chapter Trees of Data Structures & Algorithms II have been asked this question during an interview for a job.

Answer» RIGHT option is (d) Both E and F

Easiest explanation - Descendant node is a node which has a direct PATH from ANCESTOR node. Since both E and F are connected to B, so Node E and Node F are the descendants of Node B.
96.

Who is the ancestor of Node G?(a) C(b) F(c) H(d) AOrigin of the question is Ternary Tree in section Trees of Data Structures & Algorithms IThe question was asked in a national level competition.

Answer»

The CORRECT CHOICE is (a) C

The best explanation: ANCESTOR node is a node that comes in between the path from the node to the root. SINCE Node C comes between node G and root, so Node C is called the ancestor node.

97.

What is the size of the given ternary tree?(a) 3(b) 2(c) 6(d) 4I'm obligated to ask this question of Ternary Tree topic in chapter Trees of Data Structures & Algorithms IThis question was addressed to me by my college director while I was bunking the class.

Answer»

The CORRECT choice is (c) 6

Explanation: Size of the ternary TREE is defined as the total number of NODES PRESENT in the tree. Since there are total of 6 nodes in the ternary tree. So the size of the ternary tree is 6.

98.

Is Node A sibling of Node D in the given ternary tree?(a) True(b) FalseI would like to ask this question from Ternary Tree topic in division Trees of Data Structures & Algorithms II have been asked this question in an interview.

Answer» CORRECT choice is (B) False

The BEST I can explain: Node B, Node C are the siblings of Node D while Node A is the PARENT node of Node D.
99.

How many extra nodes are there in Full ternary tree than a complete ternary tree?(a) 1(b) 2(c) 3(d) Both have same number of nodesThis interesting question is from Ternary Tree in division Trees of Data Structures & Algorithms II had been asked this question in an online interview.

Answer» RIGHT answer is (d) Both have same NUMBER of nodes

The explanation is: EVERY Full ternary tree is ALSO a complete ternary tree. THEREFORE, both have same number of nodes.
100.

Which nodes are the siblings of Node B of given ternary tree?(a) E(b) C(c) F(d) Both E and FMy enquiry is from Ternary tree topic in section Trees of Data Structures & Algorithms IThis question was addressed to me in an online interview.

Answer»

The correct answer is (d) Both E and F

Easiest explanation - Siblings are the nodes that SHARE same PARENT. SINCE both the NODE E and Node F have same parent Node B, So the sibling of Node B is Node E and Node F.