0% found this document useful (0 votes)
2K views

Test Questions

This document contains 30 multiple choice questions about trees and tree data structures. Specifically, it covers topics like binary trees, binary search trees, tree traversal, and tree representations using arrays. The questions test understanding of tree terminology like root, child, parent, sibling, leaf nodes, as well as properties of different types of trees like binary, balanced binary, and complete binary trees.

Uploaded by

michaelp7897
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Test Questions

This document contains 30 multiple choice questions about trees and tree data structures. Specifically, it covers topics like binary trees, binary search trees, tree traversal, and tree representations using arrays. The questions test understanding of tree terminology like root, child, parent, sibling, leaf nodes, as well as properties of different types of trees like binary, balanced binary, and complete binary trees.

Uploaded by

michaelp7897
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CIS-18C: Java Programming, Data Structures

Chapter 11: Trees

1) Which of the following ADT is value-oriented? a) list b) sorted list c) stack d) queue e) binary tree 2) The ADT stack manages an association between data items and the ______ of the data items. a) names b) values c) sizes d) positions 3) The operations of the ADT sorted list are based upon the ______ of data items. a) names b) values c) sizes d) positions 4) The ______ is a position-oriented ADT that is not linear. a) sorted list b) queue c) binary tree d) list 5) Which of the following ADT is position-oriented? a) binary tree b) sorted list c) table d) priority queue 6) A node of a tree is called a(n) ______. a) edge b) root c) branch d) vertex 7) The lines between the nodes of a tree are called ______. a) branches b) edges c) arches d) subtrees 8) The node that is directly above node n in a tree is called the ______ of node n. a) root b) leaf c) parent d) child

Fall 2011

CIS-18C: Java Programming, Data Structures


9) A node directly below node n in a tree is called a ______ of node n. a) root b) leaf c) parent d) child 10) In a tree, the children of the same parent are called ______. a) leafs b) siblings c) roots d) contemporaries 11) Each node in a tree has ______. a) exactly one parent b) at most one parent c) exactly two parents d) at most two parents 12) A node on the path from the root to node n is a(n) ______ of node n. a) ancestor b) descendant c) subtree d) leaf 13) A descendant of node n is a node on a path from node n to ______. a) the root b) a leaf c) a sibling of node n d) a child of node n 14) A subtree of node n is a subtree rooted at ______. a) node n b) the parent of node n c) a child of node n d) a sibling of node n 15) Each node in a binary tree has ______. a) exactly one child b) at most one child c) exactly two children d) at most two children 16) The ______ of a tree is the number of nodes on the longest path from the root to a leaf. a) height b) length c) width d) age 17) In a ______ of height h, all nodes that are at a level less than h have two children each. a) general tree b) binary tree c) full binary tree d) complete binary tree

Fall 2011

CIS-18C: Java Programming, Data Structures


18) A ______ of height h is full down to level h 1, with level h filled in from left to right. a) full binary tree b) complete binary tree c) balanced binary tree d) general tree 19) In ______, the left and right subtrees of any node have heights that differ by at most 1. a) all trees b) all binary tress c) n-ary trees d) balanced binary trees

20) Which of the following is NOT a property of a complete binary tree of height h? a) all nodes at level h 2 and above have two children each b) when a node at level h 1 has children, all nodes to its left at the same level have two children each c) when a node at level h 1 has one child, it is a left child d) all leaves are at level h 21) The traversal of a binary tree is ______. a) O(n) b) O(1) c) O(n2) d) O(log2n) 22) In an array based representation of a complete binary tree, which of the following represents the left child of node tree[i]? a) tree[i+2] b) tree[i2] c) tree[2*i+1] d) tree[2*i+2] 23) In an array based representation of a complete binary tree, which of the following represents the right child of node tree[i]? a) tree[i+2] b) tree[i2] c) tree[2*i+1] d) tree[2*i+2] 24) In an array based representation of a complete binary tree, which of the following represents the parent of node tree[i]? a) tree[i2] b) tree[(i1)/2] c) tree[2*i1] d) tree[2*i2] 25) A data element within a record is called a ______. a) field b) tree c) collection d) key

Fall 2011

CIS-18C: Java Programming, Data Structures


26) The maximum number of comparisons for a retrieval operation in a binary search tree is the ______. a) length of the tree b) height of the tree c) number of nodes in the tree d) number of leaves in the tree 27) The maximum height of a binary tree of n nodes is ______. a) n b) n / 2 c) (n / 2) 2 d) log2(n + 1) 28) The minimum height of a binary tree of n nodes is ______. a) n b) n / 2 c) (n / 2) 2 d) log2(n + 1) 29) A full binary tree with height 4 has ______ nodes. a) 7 b) 8 c) 15 d) 31 30) In a general tree, the leftmost child of a node is called the ______. a) left child b) oldest child c) youngest child d) binary child

Fall 2011

You might also like