1. What is the maximum number of children that a binary tree node can have?
a) 0
b) 1
c) 2
d) 3
Answer: c
Explanation:
In a binary tree, a node can have atmost 2 nodes (i.e.) 0,1 or 2 left and right child.
2. A binary tree is a rooted tree but not an ordered tree.
a) true
b) false
Answer: b
Explanation:
A binary tree is a rooted tree and also an ordered tree (i.e) every node in a binary tree has at most two children.
3. How many common operations are performed in a binary tree?
a) 1
b) 2
c) 3
d) 4
Answer: c
Explanation:
Three common operations are performed in a binary tree- they are insertion, deletion and traversal.
4. What is the traversal strategy used in the binary tree?
a) depth-first traversal
b) breadth-first traversal
c) random traversal
d) Priority traversal
Answer: b
Explanation:
Breadth first traversal, also known as level order traversal is the traversal strategy used in a binary tree. It involves visiting all the nodes at a given level.
5. How many types of insertion are performed in a binary tree?
a) 1
b) 2
c) 3
d) 4
Answer: b
Explanation:
Two kinds of insertion operation is performed in a binary tree- inserting a leaf node and inserting an internal node.
6. General ordered tree can be encoded into binary trees.
a) true
b) false
Answer: a
Explanation:
General ordered tree can be mapped into binary tree by representing them in a left-child-right-sibling way.
7. How many bits would a succinct binary tree occupy?
a) n+O(n)
b) 2n+O(n)
c) n/2
d) n
Answer: b
Explanation:
A succinct binary tree occupies close to minimum possible space established by lower bounds. A succinct binary tree would occupy 2n+O(n) bits.
8. The average depth of a binary tree is given as?
a) O(N)
b) O(√N)
c) O(N2)
d) O(log N)
Answer: b
Explanation:
The average depth of a binary tree is given as O(√N). In case of a binary search tree, it is O(log N).
9. How many orders of traversal are applicable to a binary tree (In General)?
a) 1
b) 4
c) 2
d) 3
Answer: d
Explanation:
The three orders of traversal that can be applied to a binary tree are in-order, pre-order and post order traversal.
10. If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?
a) 2i+1
b) 2i+2
c) 2i
d) 4i
Answer: a
Explanation:
If binary trees are represented in arrays, left children are located at indices 2i+1 and right children at 2i+2.
11. Using what formula can a parent node be located in an array?
a) (i+1)/2
b) (i-1)/2
c) i/2
d) 2i/2
Answer: b
Explanation:
If a binary tree is represented in an array, parent nodes are found at indices (i-1)/2.
12. Which of the following properties are obeyed by all three tree – traversals?
a) Left subtrees are visited before right subtrees
b) Right subtrees are visited before left subtrees
c) Root node is visited before left subtree
d) Root node is visited before right subtree
Answer: a
Explanation:
In preorder, inorder and postorder traversal the left subtrees are visited before the right subtrees. In Inorder traversal, the Left subtree is visited first then the Root node then the Right subtree. In postorder traversal, the Left subtree is visited first, then Right subtree and then the Root node is visited.
13. Which of the following is the predefined function for array reversal in javascript?
a) reverse()
b) arr_reverse()
c) array_reverse()
d) rev()
Answer: a
Explanation:
The predefined function for reversing an array is reverse() in javascript. It does not requires any argument.
14. Predefined function reverse() in C++ is available under which header file?
a) math
b) stdio
c) stdlib
d) algorithm
Answer: d
Explanation:
The predefined function for reversing an array is reverse() in C++ which comes under the library called an algorithm. It requires 2 arguments the first being the pointer to the starting index of the array and the second being the pointer to the last index of the array.
15. What is the time complexity of the juggling algorithm to rotate an array?
a) O(1)
b) O(n)
c) O(d)
d) O(n*d)
Answer: b
Explanation:
Time complexity of juggling algorithm is O(n). Its auxiliary space complexity is O(1).
16. Reversal algorithm and juggling algorithm for array rotation have the same time complexity.
a) True
b) False
Answer: a
Explanation:
Time complexity of juggling algorithm is O(n) which like that of reversal algorithm. They also have the same space complexity
- Top 10 Stories About Gajapati Raju, Paralakhemundi Palace
- Most Beautiful Gandahati Water Fall of Paralakhemundi District
- Top 10 Key Tips for Clearing the Job Winning Interview [Job Tips]
- 10 Simple Strategies to Build a Perfect Resume [Job Tips]
- Why China Bans Ivory Business Trade?
- A Must-Read To Clear Any Testing Interview [100+ Solved]
- RRB Exam Question With Answers 2023
- TOP 20+ MCQs on Evaluation of an Infix Expression Data Structure with Answers