View Assessment Result: Multiple Choice Quiz 10



Your performance was as follows:

1.
Which of the following is true about the depth of a tree with exactly 3 nodes?

(a) There is no bound on the depth.
(b) It is at most 2.
(c) It is at most 3.
(d) It is at most 1.

Correct answer is (b)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (b) No Feedback



2.
Which of the following is true about the total number of nodes in a binary tree with depth 2?

(a) It is at most 2.
(b) There is no bound on the number of nodes.
(c) It is at most 4.
(d) It is at most 7.

Correct answer is (d)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (d) No Feedback



3.
A full node in a binary tree has how many children?

(a) 2
(b) 1
(c) 1 or 2
(d) 0

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (a) No Feedback



4.
In the standard array implementation of a binary tree the nodes are stored in an array. What is the convention for the array position of the parent of the node in position p of the array?

(a) p/2
(b) 2 * p + 1
(c) 2 * p
(d) p - 1

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (a) No Feedback



5.

Consider the following pseudo-code, which indicates part of a standard binary tree algorithm.

      print( node )
      {
      if( there is a left child )  print( left child );
      print  data;
      if( there is a right child )  print( right child );
      }

Which of the following is the standard name for this algorithm?



(a) Binary search
(b) Inorder traversal
(c) Postorder traversal
(d) Preorder traversal

Correct answer is (b)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (b) No Feedback



6.
A tree can be implemented as a graph whose vertices are the nodes of the tree and where an edge (u,v) indicates that u is the parent of v. Which of the following indicates all the nodes of such an implementation that are reachable by a depth first search starting at the root?

(a) Only the nodes in the left subtree of the root
(b) Only the leaves of the tree
(c) All nodes in the tree
(d) Only the interior nodes of the tree

Correct answer is (c)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (c) No Feedback



7.
Which of the following traversals of a binary search tree will produce a sorted list if a visit to a node prints what is stored there?

(a) Preorder
(b) Inorder
(c) Level-by-level
(d) Postorder

Correct answer is (b)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (b) No Feedback



8.
Searching for an element in a binary search tree takes O(s) steps where s is

(a) the depth of the tree
(b) the number of leaves of the tree
(c) 1 (the search takes constant time)
(d) the size of the tree

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (a) No Feedback



9.

Suppose S is a binary search tree and x is not an element of S. Consider the following code fragment.

      S.remove( x );
      S.insert( x );

If T is the tree that results from executing the fragment, what is the relationship between S and T?



(a) S and T differ but how depends on S.
(b) S is a proper subtree of T.
(c) S and T differ in exactly the root.
(d) S and T are the same.

Correct answer is (a)

Your score on this question is: 0.00

Feedback:
   See section 2.3.1 of the course notes.
   (d) No Feedback



10.
If numbers 1,2,...,n are inserted into a binary search tree, in order, then the result for large n is a

(a) totally unbalanced tree
(b) mildly unbalanced tree
(c) completely balanced tree
(d) tree where all nodes are full

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 2.3.1 of the course notes.
   (a) No Feedback



Go to top of assessment.

Total score: 90.00