补充实践
第一第二章
1
The degree to which software adheres to its specific requirements is called
A
Correctness
B
Reliability
C
Robustness
D
Usability
正确答案: A
2
___________ refers to the ability to easily move software from one system to another
A
Correctness
B
Reliability
C
Robustness
D
Portability
正确答案: D
3
Issues related to the interaction between the user and system, including the design of such things as help options, meaningful messages, consistent layout, appropriate use of color, error prevention, and error recovery, are generally referred to as ____________
A
Correctness
B
Reliability
C
Robustness
D
Usability
正确答案: D
4
Robustness refers to _______
A
the degree to which software adheres to its specific requirements
B
the frequency and criticality of software failure
C
The degree to which erroneous situations are handled gracefully
D
The ease with which users can be made to the software
正确答案: C
5
Which of the following is not an aspect of software quality:
A
Correctness
B
Credibility
C
Usability
D
Robustness
正确答案: B
6
Which of the following is a goal of software engineering?
A
Solve the right problem
B
Deliver a high-quality solution
C
Deliver a solution on time and budget
D
All of the above
正确答案: D
7
The degree to which erroneous situations are handled gracefully is ____________
A
Reliability
B
Usability
C
Efficiency
D
Robustness
正确答案: D
8
The ability to use software systems or parts of systems for a variety of purposes without having to rewrite them each time refers to the quality of ____________
A
Reliability
B
Reusability
C
Efficiency
D
Robustness
正确答案: B
9
A system that makes appropriate use of both CPU Time and Memory exhibits the quality characteristic of ____________
A
Reliability
B
Reusability
C
Efficiency
D
Robustness
正确答案: C
10
A system that is well designed, written, and documented exhibits the quality characteristic of ____________
A
Reliability
B
Maintainability
C
Efficiency
D
Robustness
正确答案: B
11
Software that is easily portable, can be moved from one computing environment to another with little or no effort
A
True
B
Flase
正确答案: A
12
An efficient system handles problems gracefully
A
True
B
Flase
正确答案: B
13
The study of the techniques and theory that support the development of high-quality software is electrical engineering
A
True
B
Flase
正确答案: B
14
Reliability refers to the frequency and criticality of software failure
A
True
B
Flase
正确答案: A
15
Reliable software seldom fails and, when it does, it minimizes the effects of that failure
A
True
B
Flase
正确答案: A
16
Software systems need only to work to support the work of developers, maintainers, and users
A
True
B
Flase
正确答案: B
17
Software must make efficient use of resources such as CPU time and memory
A
True
B
Flase
正确答案: A
18
A stack can be used to preserve the order of a set of data
A
True
B
Flase
正确答案: B
19
A queue preserves the order of its data
A
True
B
Flase
正确答案: A
20
A Robust system handles problems gracefully
A
True
B
Flase
正确答案: A
21
What is the order of the following growth function? tn)= 5nlogn + 20n - 4
A
O1)
B
Olog n)
C
On)
D
On log n)
正确答案: D
22
The following code segment has ______ time complexity?
forint i = 0; i < n; i++){
forint j = 0; j < n: j=j2){
int val = ji);
Systemoutprintlnval)
}
}
A
O1)
B
On)
C
On2)
D
Onlogn)
正确答案: D
23
Which Growth function has the highest order?
A
On log n)
B
On2)
C
O2n)
D
Olog n)
正确答案: C
24
What is the time complexity of the following loop?
for int count = 0; count = <n; count ++)
{
for int count2 = 0; count2 < n; count2++)
{
}
}
A
On2)
B
On3)
C
On)
D
O2n)
正确答案: A
25
Which of the following has the smallest time complexity?
A
3n+5+2n
B
logn+2
C
3n+4
D
nlogn
正确答案: B
26
What does a growth function show?
A
How big a program must be before completed
B
How many times a program can be re used
C
Time or space utilization relative to the problem size
D
How many lines a program is
正确答案: C
27
Software must make efficient use of resources such as _______ and _______
A
Hard Drive, Video Card
B
CPU time, Memory
C
CPU time, Video Card
D
Memory, Hard Drive
正确答案: B
28
The order of an algorithm is found by eliminating constants and all but the dominant term in the algorithm’s growth function
A
True
B
Flase
正确答案: A
29
Speeding up the processor by a factor of 10 will increase the processing speed by a factor of 10 regardless of the efficiency of the algorithm
A
True
B
Flase
正确答案: B
30
A growth function shows time or space utilization relative to the problem size
A
True
B
Flase
正确答案: A
31
Software must make efficient use of resources such as CPU time and memory
A
True
B
Flase
正确答案: A
32
The order of an algorithm provides a lower bound to the algorithm’s growth function
A
True
B
Flase
正确答案: B
33
If the algorithm is inefficient, a faster processor will help
A
True
B
Flase
正确答案: B
34
The time complexity of a loop is found by multiplying the complexity of the body of the loop by how many times the loop will execute
A
True
B
Flase
正确答案: A
35
The analysis of nested loops must take into account both the inner and outer loops
A
True
B
Flase
正确答案: A
36
The order of an algorithm refers to the asymptotic complexity of the algorithm’s growth function
A
True
B
Flase
正确答案: A
37
Method calls are always On)
A
True
B
Flase
正确答案: B
第三第四章
1
What is the principle difference in behavior between a stack and a queue?
A
a stack reverses order whereas a queue preserves order
B
a stack does nothing whereas a queue can preserve and reverse order
C
there is no difference
D
a stack preserves order whereas a queue reverses order
正确答案: A
2
Stacks operate as _______________
A
Last Out, First In
B
First In, First Out
C
Last In, First Out
D
None of the above
正确答案: A
3
A ______ can be used to reverse the order of a set of data
A
Queue
B
Stack
C
Software
D
Heaps
正确答案: B
4
A pop operation on a Stack returns an)
A
node
B
element
C
variable
D
pointer
正确答案: B
5
To add an element to a stack you use the ___method
A
push
B
pop
C
peek
D
size
正确答案: A
6
Which of the following is the correct way to instantiate an array of 10 generic objects?
A
Which of the following is the correct way to instantiate an array of 10 generic objects?
B
T[10] x = new T[]
C
T[] x = T[])new object[10])
D
None of the above
正确答案: C
7
Elements in a collection are typically organized by
A
the order of their addition to the collection
B
by some inherent relationship among the elements
C
randomly
D
A and B
E
None of the above
正确答案: D
8
A polymorphic reference uses , not the type of the reference, to determine which version of a method to invoke
A
the type of the object
B
the type of the reference
C
both A and B
D
none of the above
正确答案: A
9
In an array implementation of a Stack, the array is ___________ causing the implementation to have to create a new larger array and copy the contents of the stack into the new array in order to expand the capacity of the stack
A
Dynamic
B
Static
C
Flexible
D
Polymorphic
正确答案: B
10
The variable top in the array implementation of a Stack refers to
A
The next available position in the array
B
The item at the top of the Stack
C
The number of items in the stack
D
A and C
E
None of the above
正确答案: D
11
A polymorphic reference can refer to different types of objects over time
A
true
B
false
正确答案: A
12
A reference variable can refer to any object created from any class related to it by inheritance
A
true
B
false
正确答案: A
13
By using the interface name as a return type, the interface doesn’t commit the method to the use of any particular class that implements a stack
A
true
B
false
正确答案: A
14
If an exception is not caught and handled where it occurs, it is propagated to the calling method
A
true
B
false
正确答案: A
15
The implementation of the collection operations should affect the way users interact with the collection
A
true
B
false
正确答案: B
16
A well-defined interface masks the implementation of the collection
A
true
B
false
正确答案: A
17
An array dynamically grows as needed and essentially has no capacity limitations
A
true
B
false
正确答案: B
18
The pop operation is implemented by returning a reference to the element currently stored at the top of the stack and adjusting the top reference to the new top of the stack
A
true
B
false
正确答案: A
19
A data structure is the underlying programming construct used to implement a collection
A
true
B
false
正确答案: A
20
Stack elements are processed in a FIFO manner—the first element in is the first element out
A
true
B
false
正确答案: B
21
Inherited variables and methods can be used in the derived class as if they had been declared locally
A
true
B
false
正确答案: A
22
Inheritance creates an is-a relationship between all parent and child classes
A
true
B
false
正确答案: A
23
Common features should be located as low in a class hierarchy as is reasonable, minimizing maintenance efforts
A
true
B
false
正确答案: B
24
The most efficient way to implement an array-based stack keeps the top of the stack at the position 0 of the array?
A
true
B
false
正确答案: B
25
A data structure that uses object reference variables to create links between objects is
A
Linked Structure
B
Pointer
C
Self-referential
D
Array
正确答案: A
26
What is the principle difference in behavior between a stack and a queue?
A
a stack reverses order whereas a queue preserves order
B
a stack does nothing whereas a queue can preserve and reverse order
C
there is no difference
D
a stack preserves order whereas a queue reverses order
正确答案: A
27
Stacks operate as _______________
A
Last Out, First In
B
First In, First Out
C
Last In, First Out
D
None of the above
正确答案: A
28
A ______ can be used to reverse the order of a set of data
A
Queue
B
Stack
C
Software
D
Heaps
正确答案: B
29
A pop operation on a Stack returns an)
A
node
B
element
C
variable
D
pointer
正确答案: B
30
Object reference variables can be used to create ___________
A
Arrays
B
Class Diagrams
C
Linked Structures
D
None of the above
正确答案: C
31
To add an element to a stack you use the method
A
push
B
pop
C
peek
D
size
正确答案: A
32
Elements in a collection are typically organized by
A
the order of their addition to the collection
B
by some inherent relationship among the elements
C
randomly
D
A and B
E
None of the above
正确答案: D
33
A linked implementation of a stack adds and removes elements from the _______ of the linked list
A
Front
B
Rear
C
Middle
D
None of the above
正确答案: A
34
A linked list has no set capacity limitations other than the size of the computers memory
A
true
B
false
正确答案: A
35
A linked structure uses object reference variables to link one object to another
A
true
B
false
正确答案: A
36
The order in which references are changed is crucial to maintaining a linked list
A
true
B
false
正确答案: A
37
The pop operation is implemented by returning a reference to the element currently stored at the top of the stack and adjusting the top reference to the new top of the stack
A
true
B
false
正确答案: A
38
Stack elements are processed in a FIFO manner—the first element in is the first element out
A
true
B
false
正确答案: B
39
A linked list dynamically grows as needed and essentially has no capacity limitations
A
true
B
false
正确答案: A
40
Implementing a list with a sentinel node or dummy node as the first node eliminates the special cases dealing with the first node
A
true
B
false
正确答案: A
41
Objects that are stored in a collection should contain implementation details of the underlying data structure
A
true
B
false
正确答案: B
第五章
1
Which of the following operations of a queue examines the element at the front of the queue?
A
Enqueue
B
isEmpty
C
size
D
first
正确答案: D
2
What is the principle difference in behavior between a stack and a queue?
A
a stack reverses order whereas a queue preserves order
B
a stack does nothing whereas a queue can preserve and reverse order
C
there is no difference
D
a stack preserves order whereas a queue reverses order
正确答案: A
3
Queues operate as _______________
A
Last Out, First In
B
First In, First Out
C
Last In, First Out
D
None of the above
正确答案: B
4
A ______ can be used to preserve the order of a set of data
A
Queue
B
Stack
C
Software
D
Heaps
正确答案: A
5
To add an element to a queue you use the method
A
push
B
enqueue
C
dequeue
D
pop
正确答案: B
6
The shifting of elements in a noncircular array implementation creates an _______ complexity
A
O1)
B
On)
C
Onlogn)
D
Ologn)
正确答案: B
7
A linked implementation of a queue is facilitated by references to the ______ and ______ elements of the linked list
A
First, second
B
First, middle
C
Middle, last
D
First, last
正确答案: D
8
When an element is removed from a queue using the dequeue operation, that element is removed from the ____________ of the collection
A
Front
B
Rear
C
Middle
D
None of the above
正确答案: A
9
When an element is added to a queue using the enqueue operation, that element is added to the ____________ of the collection
A
Front
B
Rear
C
Middle
D
None of the above
正确答案: B
10
A circular array implementation of a queue is more efficient than a fixed array implementation of a queue because elements never have to be ___________
A
added
B
removed
C
shifted
D
initialized
正确答案: C
11
The enqueue and dequeue operations work on opposite ends of the collection
A
True
B
False
正确答案: A
12
The first operation removes an element at the front of the queue and returns a reference to it
A
True
B
False
正确答案: B
13
Queue elements are processed in a FIFO manner—the first element in is the first element out
A
True
B
False
正确答案: A
14
Because queue operations modify both ends of the collection, fixing one end at index 0 eliminates the requirement that elements be shifted
A
True
B
False
正确答案: B
15
Treating arrays as circular eliminates the need to shift elements in an array queue implementation
A
True
B
False
正确答案: A
第六章
1
List collections can be categorized as,,or__________A
Ordered,unordered,indexed
B
Linked,array,interface
C
Double,single,array
D
None of the above
正确答案:A
2
The elements of an_____________have an inherent relationship defining their orderA
Ordered list
B
Unordered list
C
Indexed list
D
None of the above
正确答案:A
3
The elements of an_____________are kept in whatever order the client choosesA
Ordered list
B
Unordered list
C
Indexed list
D
None of the above
正确答案:B
4
An_______________maintains a contiguous numeric index range for its elementsA
Ordered list
B
Unordered list
C
Indexed list
D
None of the above
正确答案:C
5
Many common operations can be defined for all list types.The differences between them stem from how elements are__________A
Added
B
Removed
C
Found
D
None of the above
正确答案:A
6
An___________is an object that provides a means to iterate over a collectionA
Search
B
Comparable
C
Iterator
D
toString
正确答案:C
7
Interfaces can be used to derive other interfaces.The child interface contains all____________of the parentA
Non-abstract methods
B
Abstract methods
C
Parameters
D
None of the above
正确答案:B
8
An interface name can be used to declare an object reference variable.An interface reference can refer to any object of any class that__________the interfaceA
Calls
B
Implements
C
Associates
D
None of the above
正确答案:B
9
Interfaces allow us to make____________references,in which the method that is invoked is based on the particular object being referenced at the timeA
Polymorphic
B
Multiple
C
Interface
D
None of the above
正确答案:A
10
Only__________objects can be stored in an ordered listA
Ordered
B
Polymorphic
C
Comparable
D
None of the above
正确答案:C
11
The Java Collections API contains_________implementations of an indexed listA
Two
B
Three
C
Four
D
Five
正确答案:B
12
List collections can be categorized as ordered,unordered,and indexedA
True
B
False
正确答案:A
13
The elements of an ordered list do not have an inherent relationship defining their orderA
True
B
False
正确答案:B
14
The elements of an unordered list are kept in whatever order the client choosesA
True
B
False
正确答案:A
15
An indexed list maintains a contiguous numeric index range for its elementsA
True
B
False
正确答案:A
16
An iterator is an object that provides a means to iterate over a collectionA
True
B
False
正确答案:A
17
Interfaces cannot be derived from other interfacesA
True
B
False
正确答案:B
18
An interface name can be used to declare an object reference variable.An interface reference can refer to any object of any class that implements the interfaceA
True
B
False
正确答案:A
19
Interfaces allow us to make polymorphic references,in which the method that is invoked is based on the type of the reference variable rather than the particular object being referenced at the timeA
True
B
False
正确答案:B
20
Only Comparable objects can be stored in an ordered listA
True
B
False
正确答案:A
第九章
1
__________ is the process of arranging a list of items into a defined order based on some criteriaA
searching
B
categorizing
C
classifying
D
sorting
正确答案: D
2
What type does "compareTo" return?
A
int
B
String
C
boolean
D
char
正确答案: A
3
Which of these have the smallest time complexity?
A
Insertion sort
B
Quick sort
C
Bubble sort
D
Selection sort
正确答案: B
4
_______ orders a list of values by repetitively comparing neighboring elements and swapping their positions if necessaryA
Insertion sort
B
Quick sort
C
Bubble sort
D
Selection sort
正确答案: C
5
The _____ sort algorithm sorts a list by recursively dividing the list in half until each sub-list has one element and then merging these sub-lists into the sorted orderA
Merge
B
Quick
C
Linear
D
Lazy
正确答案: A
6
This type of sequential sort algorithm sorts a list by repeatedly placing the next smallest element into its final sorted positionA
insertion sort
B
bubble sort
C
selection sort
D
merge sort
正确答案: C
7
The best comparison sort in terms of order is:
A
O1)
B
On)
C
Ologn))
D
Onlogn))
正确答案: D
8
Which sort method starts by repeatedly splitting the list in half?
A
Bubble sort
B
Insertion sort
C
merge sort
D
Selection sort
正确答案: C
9
What is the time complexity of a Quick sort?
A
2logn
B
logn
C
nlogn
D
n^2
正确答案: C
10
Merge Sort has time complexity O)A
On^2)
B
On)
C
Onlogn))
D
On^2)
正确答案: C
11
After one pass on the numbers 5 3 9 5 ), what would be the result if you were to use Bubble Sort?
A
5 3 5 9
B
5 5 3 9
C
3 5 5 9
D
9 5 5 3
正确答案: C
12
An efficient search maximizes the number of comparisons madeA
true
B
false
正确答案: B
13
A binary search capitalizes on the fact that the list is not sortedA
true
B
false
正确答案: B
14
A binary search can only be performed if the search pool is sorted
A
true
B
false
正确答案: A
15
Linear search has logarithmic complexity, making it very efficient for a large search poolA
true
B
false
正确答案: B
16
Bubble, Selection and Insertion sort all have time complexity of On)A
true
B
false
正确答案: B
17
Insertion sort is an algorithm that sorts a list of values by repetitively putting a particular value into its final, sorted, positionA
true
B
false
正确答案: B
第九章
1
A collection where each node can have from 0 to 2 children is called a ___________
A
Stack
B
Queue
C
List
D
Binary tree
正确答案: D
2
A node that does not have a parent is called the ______ of a tree
A
foot
B
root
C
leaf
D
top
正确答案: B
3
A tree is a nonlinear structure whose elements are organized into a __________
A
stack
B
hierarchy
C
queue
D
list
正确答案: B
4
The simulated link strategy allows array positions to be allocated contiguously regardless of the _________ of the tree
A
size
B
order
C
completeness
D
root
正确答案: C
5
In general, a balanced n-ary tree with m elements will have height _______
A
lognm
B
logmm
C
logmn
D
lognn
正确答案: A
6
There are four basic methods for traversing a tree: preorder, inorder, postorder, and level-order
A
Top down, bottom up, inorder, and postorder
B
Top down, inorder, postorder, and level-order
C
Bottom up, preorder, in order, and postorder
D
preorder, inorder, postorder, and level-order
正确答案: D
7
_________ traversal means visit the node, then the left child, then the right child
A
preorder
B
postorder
C
inorder
D
level-order
正确答案: A
8
_________ traversal means visit the left child, then the node, then the right child
A
preorder
B
postorder
C
inorder
D
level-order
正确答案: C
9
________ traversal means visit the left child, then the right child, then the node
A
preorder
B
postorder
C
inorder
D
level-order
正确答案: B
10
___________ traversal means visit the nodes at each level, one level at at time, starting with the root
A
preorder
B
postorder
C
inorder
D
level-order
正确答案: D
11
In the computational strategy to implement a tree with an array, the children of node n are stored at _______ and ________ respectively
A
2n + 1
B
2n
C
2n + 1)
D
A and B
E
A and C
F
B and C
正确答案: E
12
The binary tree shown above is balanced
A
True
B
False
正确答案: A
13
The binary tree shown above is complete
A
True
B
False
正确答案: A
14
A collection where each node can have from 0 to 3 children is called a Binary Tree
A
True
B
False
正确答案: B
15
A find operation on a balanced binary search tree is Ologn) where as a find operation for binary search tree without the balance assumption is On)
A
True
B
False
正确答案: A
16
A node that has a parent is called the root of a tree
A
True
B
False
正确答案: B
17
A tree is a nonlinear structure whose elements are organized into a hierarchy
A
True
B
False
正确答案: A
18
The simulated link strategy does not allow array positions to be allocated contiguously regardless of the completeness of the tree
A
True
B
False
正确答案: B
19
In general, a balanced n-ary tree with m elements will have height lognm
A
True
B
False
正确答案: A
20
Preorder traversal means visit the left child, then the right child, then the node
A
True
B
False
正确答案: B
21
Inorder traversal means visit the left child, then the node, then the right child
A
True
B
False
正确答案: A
22
Postorder traversal means visit the node, then the left child, then the right child
A
True
B
False
正确答案: B
23
Level-order traversal means visit the nodes at each level, one level at at time, starting with the root
A
True
B
False
正确答案: A
24
In the computational strategy to implement a tree with an array, the children of node n are stored at 2n + 1 and 2n + 1) respectively
A
True
B
False
正确答案: A
第十章
1
A binary search tree is a binary tree with the added property that the left child is less than the parent,which is less than or equal to the___________
A
Left child
B
Right child
C
Middle child
D
None of the above
正确答案:B
2
The definition of a binary search tree is an extension of the definition of a______________
A
stack
B
queue
C
list
D
binary tree
正确答案:D
3
Each BinaryTreeNode object maintains a reference to the element stored at that node as well as references to each of the node’s__________
A
children
B
siblings
C
ancestors
D
None of the above
正确答案:A
4
In removing an element from a binary search tree,another node must be___________to replace the node being removed
A
duplicated
B
demoted
C
promoted
D
None of the above
正确答案:C
5
The leftmost node in a binary search tree will contain the__________element,while the rightmost node will contain the__________element
A
Maximum,minimum
B
Minimum,maximum
C
Minimum,middle
D
None of the above
正确答案:B
6
One of the uses of trees is to provide_________implementations of other collections
A
efficient
B
easy
C
useful
D
None of the above
正确答案:A
7
If a binary search tree is not__________,it may be less efficient than a linear structure
A
complete
B
empty
C
balanced
D
None of the above
正确答案:C
8
The height of the right subtree minus the height of the left subtree is called the___________of a node
A
height
B
balance factor
C
order
D
None of the above
正确答案:B
9
The balance restriction on a red/black tree is somewhat less strict than that for AVL trees However,in both cases,the find operation is order______
A
n
B
log n
C
n log n
D
None of the above
正确答案:B
10
The Java Collections API provides two implementations of balanced binary search trees,TreeSet and TreeMap,both of which use a___________tree implementation
A
AVL
B
red/black
C
binary search
D
None of the above
正确答案:B
11
A binary search tree is a binary tree with the added property that the left child is greater than the parent,which is less than or equal to the right child
A
True
B
Flase
正确答案:B
12
The definition of a binary search tree is an extension of the definition of a binary tree
A
True
B
Flase
正确答案:A
13
Each BinaryTreeNode object maintains a reference to the element stored at that node as well as references to each of the node’s children
A
True
B
Flase
正确答案:A
14
In removing an element from a binary search tree,another node must be demoted to replace the node being removed
A
True
B
Flase
正确答案:B
15
The leftmost node in a binary search tree will contain the minimum element,while the rightmost node will contain the maximum element
A
True
B
Flase
正确答案:A
16
One of the uses of trees is to provide simpler implementations of other collections
A
True
B
Flase
正确答案:B
17
If a binary search tree is not balanced,it may be less efficient than a linear structure
A
True
B
Flase
正确答案:A
18
The height of the right subtree minus the height of the left subtree is called the balance factor of a node
A
True
B
Flase
正确答案:A
19
There are only two ways that a tree,or any subtree of a tree,can become unbalanced:through the insertion of a node or through the deletion of a node
A
True
B
Flase
正确答案:A
20
The balance restriction on a red/black tree is somewhat less strict than that for AVL trees However,in both cases,the find operation is order n
A
True
B
Flase
正确答案:B
第十二章
第⼗⼆章测试
1、A minheap is a complete binary tree in which each node is less than or
equal to both the left child and the right child.
A .Minheap
B .Maxheap
C .Heap
D .Binary search tree
答案:A
2、A minheap stores its smallest element at the ________ of the binary
tree.
A .leaf
B .internal node
C .root
D .sibling
答案:C
3、Both children of the root of a minheap are _________.
A .Minheaps
B .Maxheaps
C .Heaps
D .Binary search trees
答案: A
4、The __________ method adds a given Comparable element to the
appropriate location in the heap, maintaining both the completeness
property and the ordering property of the heap.
A .add
B .addNext
C .addElement
D .none of the above
答案:C
5、Since a heap is a complete tree, there is only one correct location for
the insertion of a new node, and that is either the next open position from
the left at level h or the first position on the left at level h+1 if level h is full.
A .Minheap
B .Maxheap
C .Balanced tree
D .Complete tree
答案: D
6、Typically, in heap implementations, we keep track of the position of the
last node or, more precisely, the last leaf in the tree.
A .root
B .internal node
C .leaf
D .tree
答案: C
7、To maintain the completeness of the tree, there is only one valid
element to replace the , and that is the element stored in the last
leaf in the tree.
A .root
B .internal node
C .leaf
D .tree
答案: A
8、Though not a queue at all, a minheap provides an efficient
implementation of a ___.
A .Priority queue
B .Circular queue
C .Deque
D .None of the above
答案: A
9、Because of the requirement that we be able to traverse up the tree after
an insertion, it is necessary for the nodes in a heap to store a pointer to
their ________.
A .children
B .parent
C .siblings
D .none of the above
答案: B
10、In an array implementation of a binary tree, the root of the tree is in
position 0, and for each node n, n’s left child is in position ________ and
n’s right child is in position ________.
A .2n + 1
B .2n + 2
C .2(n + 1)
D .A and B
E .A and C
F .B and
答案: E
11、The addElement operation for both the linked and array
implementations is O().
A .n
B .log n
C .n log n
D .None of the above
答案: B
12、The removeMin operation for both the linked and array
implementations is O(log n).
A .n
B .log n
C .n log n
D .None of the above
答案: B
13、The __________ method consists of adding each of the elements of
the list to a heap and then removing them one at a time.
A .heapSort
B .heapify
C .toString
D .None of the above
答案: A
14、Heap sort is O().
A .n
B .log n
C .n log n
D .None of the above
答案: C
15、A minheap is a complete binary tree in which each node is less than or
equal to both the left child and the right child.
A .True
B .Flas
答案: A
16、A minheap stores its largest element at the root of the binary tree, and
both children of the root of a minheap are also minheaps.
A .True
B .Flase
答案: B
17、The addElement method adds a given Comparable element to the
appropriate location in the heap, maintaining both the completeness
property and the ordering property of the heap.
A .True
B .Flase
答案: A
18、Since a heap is a binary search tree, there is only one correct location
for the insertion of a new node, and that is either the next open position
from the left at level h or the first position on the left at level h+1 if level h is
full.
A .True
B .Flase
答案: B
19、Typically, in heap implementations, we keep track of the position of the
last node or, more precisely, the last leaf in the tree.
A .True
B .Flase
答案: A
20、To maintain the completeness of the tree, there is only one valid
element to replace the root, and that is the element stored in the first leaf in
the tree.
A .True
B .Flase
答案: B
21、Though not a queue at all, a minheap provides an efficient
implementation of a priority queue.
A .True
B .Flase
答案: A
22、Because of the requirement that we be able to traverse up the tree
after an insertion, it is necessary for the nodes in a heap to store a pointer
to their parent.
A .True
B .Flase
答案: A
23、In an array implementation of a binary tree, the root of the tree is in
position 0, and for each node n, n’s left child is in position 2(n+1) and n’s
right child is in position 2(n+2).
A .True
B .Flase
答案: B
24、The addElement operation for both the linked and array
implementations is O(n log n).
A .True
B .Flase
答案: B
25、The removeMin operation for both the linked and array
implementations is O(log n).
A .True
B .Flase
答案: A
26、The heapSort method consists of adding each of the elements of the
list to a heap and then removing them one at a time.
A .True
B .Flase
答案: A
27、Heap sort is O(n log n).
A .True
B .Flase
答案: A