Binary Trees and Traversals - Implementations in C++ - Applications

Download Q&A
Q. In a binary tree, what does a level-order traversal use to keep track of nodes?
  • A. Stack
  • B. Queue
  • C. Array
  • D. Linked List
Q. What is the maximum number of nodes at level 'h' in a binary tree?
  • A. h
  • B. 2^h
  • C. 2^(h+1) - 1
  • D. h^2
Q. What is the result of a post-order traversal on the following binary tree: A, B, C, D?
  • A. A B C D
  • B. D C B A
  • C. B D C A
  • D. C B D A
Q. What is the result of a pre-order traversal of the binary tree with root 1, left child 2, and right child 3?
  • A. 1, 2, 3
  • B. 2, 1, 3
  • C. 3, 1, 2
  • D. 1, 3, 2
Q. Which of the following is a valid way to implement a binary tree node in C++?
  • A. struct Node { int data; Node* left; Node* right; };
  • B. class Node { int data; Node left; Node right; };
  • C. struct Node { int data; Node left; Node right; };
  • D. class Node { public: int data; Node* left; Node* right; };
Q. Which of the following is NOT a valid way to implement a binary tree in C++?
  • A. Using a struct with pointers
  • B. Using an array
  • C. Using a linked list
  • D. Using a vector
Showing 1 to 6 of 6 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely