补充实践
Posted nhy1669862196
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了补充实践相关的知识,希望对你有一定的参考价值。
第六章
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 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
以上是关于补充实践的主要内容,如果未能解决你的问题,请参考以下文章