Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Chapter 20 Starting out with C++ Binary Trees


 

Download  file with the answers

Not a member!
Create a FREE account here to get access and download this file with answers


 

Chapter Twenty

MULTIPLE CHOICE

1. In a binary tree, each node may point to ____________ other nodes.
a. no
b. one
c. two
d. All of these
e. None of these

2. A strong reason to use the binary tree structure is:
a. to expedite the process of searching large sets of information
b. aesthetics and program design
c. code readability
d. it is more flexible than the Unary Tree structure
e. None of these

3. The first node in a binary tree list is called the
a. head pointer
b. binary node
c. root node
d. pointer node
e. None of these

4. A node that has no children is a
a. root node
b. head node
c. leaf node
d. pure binary node
e. None of these

5. When a binary tree is used to facilitate a search, it is referred to as a:
a. binary queue
b. binary ordered deque
c. binary search tree
d. sort algorithm
e. None of these

6. When an application begins searching a binary tree, it starts at:
a. the outermost leaf node
b. the middle node, halfway between the root and the longest branch
c. the root node
d. the rightmost child of the root node
e. None of these

7. The ___________ in a binary tree is similar to the head pointer in a linked list.
a. root pointer
b. leaf pointer
c. null pointer
d. binary pointer
e. None of these

8. Stepping through the nodes of a tree is known as:
a. climbing
b. traversing
c. walking through
d. branching out
e. None of these

9. Binary trees may be implemented as templates, but any data types used with them must support the ______________ operator.
a. < b. >
c. ==
d. All of these
e. None of these

10. In a binary tree, a node that has more than two children:
a. will be cut back by the compiler
b. is theoretically impossible in a correctly-developed binary tree structure
c. is known as a triplet node
d. None of these

11. Values are typically stored in a binary search tree so that a node’s _________ child holds data is less than the ___________ data.
a. right, node’s
b. left, node’s
c. right, left child’s
d. left, right child’s
e. None of these

12. Deleting a node that has two children offers an opportunity to use
a. a function that returns a pointer to a pointer
b. a function parameter that is a pointer to a pointer
c. double indirection
d. All of these
e. None of these

13. When you dereference a pointer to a pointer, the result is:
a. a value of the data type pointed to
b. another pointer
c. not possible to determine
d. NULL
e. None of these

14. In a non-linear linked list, a node can point to:
a. only the next node in sequence
b. only the previous node in sequence
c. more than one other node, plus the previous node in sequence
d. all of the other nodes in the list
e. None of these

15. The head pointer, anchored at the top of a tree, is called the
a. root node
b. tree pointer
c. binary pointer
d. either a or c
e. None of these

16. The root node points to two other nodes, referred to as
a. child nodes, or children
b. parent nodes, or parents
c. binary nodes
d. subnodes
e. None of these

17. All node pointers that do not point to other nodes are set to
a. the root of the tree
b. a parent node
c. their left-most child node
d. NULL
e. None of these

18. Binary trees can be divided into
a. branches
b. leaves
c. subtrees
d. sawdust
e. None of these

19. An operation that can be performed on a binary search tree is
a. insertion
b. finding
c. deleting
d. All of these
e. None of these

20. A binary tree can be created using a struct or class containing a data value and
a. a pointer to the first child node
b. a pointer to the last child node
c. two pointers, one for the left child and one for the right child
d. two data nodes
e. None of these

21. In a binary tree class, you usually have a pointer as a member that is set to:
a. the leftmost child node
b. the first leaf node
c. the root of the tree
d. the deepest leaf node
e. None of these

22. The shape of a binary tree is:
a. always triangular
b. always balanced
c. determined by the programmer
d. determined by the order in which values are inserted
e. None of these

23. Methods of traversing a tree are:
a. Inorder traversal
b. Preorder traversal
c. Postorder traversal
d. All of these
e. None of these

24. Inorder, Preorder, and Postorder traversals can be accomplished using _____.
a. recursion
b. no pointers
c. no arguments
d. no parameters
e. None of these

25. A tree with a height of three has:
a. six nodes
b. one root and three nodes with two children each
c. three levels
d. three subtrees
e. None of these

TRUE/FALSE

1. True/False: The binary tree structure is called a “tree” because it resembles an upside-down tree.

2. True/False: The inorder method of traversing a binary tree involves traversing the node’s left subtree, processing the node’s data, then traversing the node’s right subtree.

3. True/False: A subtree is an entire branch of a tree, from one particular node down.

4. True/False: Output will be the same if you use inorder, postorder, or preorder traversals of the same binary tree.

5. True/False: The height of a tree describes how many levels there are in the tree.

6. True/False: Binary trees are commonly used to organize key values that index database records.

7. True/False: Deleting a leaf node from a binary tree is not difficult. Deleting a non-leaf node requires several steps.

8. True/False: In a binary tree, each node must have a minimum of two children.

9. True/False: The preorder method of traversing a binary tree involves processing the node’s data, traversing the node’s left subtree, then traversing the node’s right subtree.

10. True/False: Dereferencing a pointer to a pointer gives you another pointer.

11. True/False: To remove a node that has children, you must first remove the children.

12. True/False: The width of a tree is the largest number of nodes in the same level.

13. True/False: All nodes to the right of a node hold values greater than the node’s value.

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!