• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Tree Traversal with Interview Question and Answers | DSA Quiz

Question 31

Choose the equivalent prefix form of the following expression (a + (b − c))* ((d − e)/(f + g − h))
  • * +a − bc /− de − +fgh
  • * +a −bc − /de − +fgh
  • * +a − bc /− ed + −fgh
  • * +ab − c /− ed + −fgh

Question 32

The number of rotations required to insert a sequence of elements 9,6,5,8,7,10 into an empty AVL tree is?
  • 0
  • 1
  • 2
  • 3

Question 33

Consider the following statements: (a) Depth - first search is used to traverse a rooted tree. (b) Pre - order, Post-order and Inorder are used to list the vertices of an ordered rooted tree. (c) Huffman’s algorithm is used to find an optimal binary tree with given weights. (d) Topological sorting provides a labelling such that the parents have larger labels than their children. Which of the above statements are true?
  • (a) and (b)
  • (c) and (d)
  • (a), (b) and (c)
  • (a), (b), (c) and (d)

Question 34

The inorder and preorder Traversal of binary Tree are dbeafcg and abdecfg respectively. The post-order Traversal is __________.
  • dbefacg
  • debfagc
  • dbefcga
  • debfgca

Question 35

Level order Traversal of a rooted Tree can be done by starting from root and performing:
  • Breadth First Search
  • Depth First Search
  • Root Search
  • Deep Search

Question 36

The in-order traversal of a tree resulted in FBGADCE. Then the pre-order traversal of that tree would result in
  • FGBDECA
  • ABFGCDE
  • BFGCDEA
  • AFGBDEC

Question 37

Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the inorder traversal sequence of the resultant tree?
  • 7 5 1 0 3 2 4 6 8 9
  • 0 2 4 3 1 6 5 9 8 7
  • 0 1 2 3 4 5 6 7 8 9
  • 9 8 6 4 2 3 0 1 5 7

Question 38

Assume that the operators +, −, × are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, ×, +, −. The postfix expression corresponding to the infix expression is
a + b × c − d ^ e ^ f
  • abc x + def ^ ^ −
  • abc x + de ^ f ^ −
  • ab + c × d − e^f^
  • − + a × b c^^ def

Question 39

If Tree-1 and Tree-2 are the trees indicated below : Which traversals of Tree-1 and Tree-2, respectively, will produce the same sequence?

  • Preorder, postorder

  • Postorder, inorder

  • Postorder, preorder

  • Inorder, preorder

Question 40

If all the edge weights of an undirected graph are positive, then any subset of edges that connects all the vertices and has minimum total weight is a  
  • Hamiltonian cycle
  • grid
  • hypercube
  • tree

There are 42 questions to complete.

Last Updated :
Take a part in the ongoing discussion