1. A data structure that uses object reference variables to create links between
ID: 3537961 • Letter: 1
Question
1. A data structure that uses object reference variables to create links between objects is:
A. Linked Structure
B. Pointer
C. Self-referential
D. Array
Answer:
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
Answer:
3. Stacks operate as _______________.
A. Last Out, First In
B. First In, First Out
C. Last In, First Out
D. None of the above
Answer:
4. A ______ can be used to reverse the order of a set of data.
A. Queue
B. Stack
C. Software
D. Heaps
Answer:
5. A pop operation on a Stack returns a(n)
A. node
B. element
C. variable
D. pointer
Answer:
6. Object reference variables can be used to create ___________.
A. Arrays
B. Class Diagrams
C. Linked Structures
D. None of the above
Answer:
7. To add an element to a stack you use the method.
A. push
B. pop
C. peek
D. size
Answer:
8. 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
Answer:
9. 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
Answer:
10. 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
Answer:
11. 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
Answer:
12. Queues operate as _______________.
A. Last Out, First In
B. First In, First Out
C. Last In, First Out
D. None of the above
Answer:
13. A ______ can be used to preserve the order of a set of data.
A. Queue
B. Stack
C. Software
D. Heaps
Answer:
14. To add an element to a queue you use the method.
A. push
B. enqueue
C. dequeue
D. pop
Answer:
15. The shifting of elements in a noncircular array implementation creates an _______ complexity.
A. O(1)
B. O(n)
C. O(nlogn)
D. O(logn)
Answer:
16. 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
Answer:
17. 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
Answer:
18. 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
Answer:
19. 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
Answer:
20. List collections can be categorized as ______, ________, or __________.
A. Ordered, unordered, indexed
B. Linked, array, interface
C. Double, single, array
D. None of the above
Answer:
21. The elements of an _____________ have an inherent relationship defining their order.
A. Ordered list
B. Unordered list
C. Indexed list
D. None of the above
Answer:
22. The elements of an _____________ are kept in whatever order the client chooses.
A. Ordered list
B. Unordered list
C. Indexed list
D. None of the above
Answer:
23. An _______________ maintains a contiguous numeric index range for its elements.
A. Ordered list
B. Unordered list
C. Indexed list
D. None of the above
Answer:
24. 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
Answer:
25. An ___________ is an object that provides a means to iterate over a collection.
A. Search
B. Comparable
C. Iterator
D. toString
Answer:
26. Interfaces can be used to derive other interfaces. The child interface contains all ____________ of the parent.
A. Non-abstract methods
B. Abstract methods
C. Parameters
D. None of the above
Answer:
27. 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 interface.
A. Calls
B. Implements
C. Associates
D. None of the above
Answer:
28. Interfaces allow us to make ____________ references, in which the method that is invoked is based on the particular object being referenced at the time.
A. Polymorphic
B. Multiple
C. Interface
D. None of the above
Answer:
29. Only __________objects can be stored in an ordered list.
A. Ordered
B. Polymorphic
C. Comparable
D. None of the above
Answer:
30. The Java Collections API contains _________ implementations of an indexed list.
A. Two
B. Three
C. Four
D. Five
Answer:
31. Any recursive definition must have a non-recursive part, called the ___________, which permits the recursion to eventually end.
A. base case
B. foundation
C. primary case
D. first case
Answer:
32. Recursion is a programming technique in which a ________ calls itself.
A. program
B. method
C. variable
D. parameter
Answer:
33. ____________ problems and formulas are often expressed recursively.
A. Business
B. Programmatic
C. Variable
D. Mathematical
Answer:
34. Each recursive call to a method creates new __________ and __________.
A. Local variables
B. Parameters
C. Methods
D. A and B
Answer:
35. A careful _______ of recursive processing can provide insight into the way it is used to solve a problem.
A. review
B. trace
C. observation
D. use
Answer:
36. Recursion is the most elegant and appropriate way to solve ________ problems, but for others it is less intuitive than an iterative solution.
A. some
B. most
C. all
D. none of the above
Answer:
37. The order of a recursive algorithm can be determined using techniques similar to analyzing ______ processing.
A. programmatic
B. variable
C. iterative
D. interface
Answer:
38. The Towers of Hanoi solution has ___________ complexity, which is very inefficient. Yet the implementation of the solution is incredibly short and elegant.
A. quadratic
B. linear
C. exponential
D. none of the above
Answer:
39. __________ is the process of arranging a list of items into a defined order based on some criteria.
A) searching
B) categorizing
C) classifying
D) sorting
Answer:
40. What type does "compareTo" return?
A) int
B) String
C) boolean
D) char
Answer:
41. Which of these have the smallest time complexity?
A) Insertion sort
B) Quick Sort
C) Bubble Sort
D) Selection Sort
Answer:
42. _______ orders a list of values by repetitively comparing neighboring elements and swapping their positions if necessary.
A) Insertion sort
B) Quick Sort
C) Bubble Sort
D) Selection Sort
Answer:
43. 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 order.
A) Merge
B) Quick
C) Linear
D) Lazy
Answer:
44. This type of sequential sort algorithm sorts a list by repeatedly placing the next smallest element into its final sorted position.
A) insertion sort
B) bubble sort
C) selection sort
D) merge sort
Answer:
45. The best comparison sort in terms of order is:
A) O(1)
B) O(n)
C) O(log(n))
D) O(nlog(n))
Answer:
46. Which sort method starts by repeatedly splitting the list in half?
A) Bubble sort
B) Insertion sort
C) Merge sort
D) selection sort
Answer:
47. What is the time complexity of a Quick sort?
A) 2logn
B) logn
C) nlogn
D) n^2
Answer
48. Merge Sort has time complexity O(___).
A) O(n^2)
B) b)O(n)
C) c)O(nlog(n))
D) d)O(n^2)
Answer:
49. 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
Answer:
50. 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
Answer:
51. _________ traversal means visit the node, then the left child, then the right child.
A. preorder
B. postorder
C. inorder
D. level-order
Answer:
52. _________ traversal means visit the left child, then the node, then the right child.
A. preorder
B. postorder
C. inorder
D. level-order
Answer:
53. ________ traversal means visit the left child, then the right child, then the node.
A. preorder
B. postorder
C. inorder
D. level-order
Answer:
54. ___________ 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
Answer:
55. In the computational strategy to implement a tree with an array, the children of node n are stored at 2n + 1 and 2(n + 1) respectively.
A. 2n + 1
B. 2n + 2
C. 2(n + 1)
D. A and B
E. A and C
F. B and C
Answer:
56. A node that does not have a ___________ is called the root of a tree.
Answer:
57. A collection where each node can have from 0 to 2 children is called a ________ Tree.
Answer:
58. 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
Answer:
59. The definition of a binary search tree is an extension of the definition of a ______________.
A. stack
B. queue
C. list
D. binary tree
Answer:
60. Each BinaryTreeNode object maintains a reference to the element stored at that node as well as references to each of the node%u2019s __________.
A. children
B. siblings
C. ancestors
D. None of the above
Answer:
61. 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
Answer:
62. 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
Answer:
63. One of the uses of trees is to provide _________ implementations of other collections.
A. efficient
B. easy
C. useful
D. None of the above
Answer:
64. 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
Answer:
65. What is the order of the following growth function? t(n)= 5nlogn + 20n - 4 A. O(1) B. O(log n) C. O(n) D. O(n log n)
Answer:
66. The following code segment has ______ time complexity?
for(int i = 0; i < n; i++){
for(int j = 0; j < n: j=j*2){
int val = (j*i);
System.out.println(val)
}
}
A. O(1)
B. O(n)
C. O(n2)
D. O(nlogn)
Answer:
67. Which Growth function has the highest order?
A. O(n log n)
B. O(n2)
C. O(2n)
D. O(log n)
Answer:
68. What is the time complexity of the following loop?
for (int count = 0; count = <n; count ++)
{
for (int count2 = 0; count2 < n; count2++)
{
}
}
A. O(n2)
B. O(n3)
C. O(n)
D. O(2n)
Answer:
69. Which of the following has the smallest time complexity?
A. 3n+5+2n
B. Logn + 2
C. 3n+4
D. n logn
Answer:
70. 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
Answer:
71. 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
Answer:
72. What is the O(_) of this growth function
3n4+n2+3n-867.5309 ?
Answer:
73. A ______ function shows time or space utilization relative to the problem size.
Answer:
74. Software must make efficient use of resources such as CPU time and memory.
Algorithm __________ is a fundamental computer science topic.
Answer:
75. The __________ of an algorithm is found by eliminating constants and all but the dominant term in the algorithm%u2019s growth function.
Answer:
76. The order of an algorithm provides an ___________ to the algorithm%u2019s
growth function.
Answer:
77. If the algorithm is ___________, a faster processor will not help in the long run.
Answer:
78. The time complexity of a loop is found by multiplying the complexity of the
______________ by how many times the loop will execute.
Answer:
79. The analysis of nested loops must take into account both the _____________.
Answer:
80. The order of an algorithm refers to the ______________ of the algorithm%u2019s growth function.
Answer:
81. True/False. The order of an algorithm is found by eliminating constants and all but the dominant term in the algorithm%u2019s growth function.
Answer:
82. True/False. 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.
Answer:
83. True/False. A growth function shows time or space utilization relative to the problem size.
Answer:
84. True/False. Software must make efficient use of resources such as CPU time and memory.
Answer:
85. True/False. The order of an algorithm provides a lower bound to the algorithm%u2019s growth function.
Answer:
86. True/False. If the algorithm is inefficient, a faster processor will help.
Answer:
87. True/False. 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.
Answer:
88. True/False. The analysis of nested loops must take into account both the inner and outer loops.
Answer:
89. True/False. The order of an algorithm refers to the asymptotic complexity of the algorithm%u2019s growth function.
Answer:
90. True/False. Method calls are always O(n).
Answer:
91. What is the difference between the growth function of an algorithm and the order of that algorithm?
Answer:
92. Why does speeding up the CPU not necessarily speed up the process by the same amount?
Answer:
.
93. How do we use the growth function of an algorithm to determine its order?
Answer:
94. How do we determine the time complexity of a loop?
Answer:
95. How do we determine the time complexity of a method call?
Answer:
Explanation / Answer
1. A. Linked Structure
Explanation: A Linked List uses two parts in a node info part and reference part to keep the address of its successor. It uses object reference variables to create links between objects.
2. A. A stack reverses order whereas a queue preserves order
Explanation: As stack uses Last In, first out principle means it reverses the whole string or expression, whereas queue uses First In, First Out Principle means it displays the string or expression as it is given.
3. C. Last In, First Out
Explanation: Stack is a container that inserts the element at the top of the stack and removes from the top of the stack. Means if an element is inserted at last, will be removed first. Thus, it can be said stack operates on Last in, first out.
4. B. Stack
Explanation: As stack uses Last in, first out principle means the element pushed at top will be popped first and then next. Thus, it can be said that if the whole string is popped then it will be popped in reverse. Thus, a stack is used to reverse the order of a set of data.
5. B. Element
Explanation: Whenever pop operation is done at stack it removes an element from the top of the stack.
6. Linked Structure
Explanation: Object reference variables used to create Linked Lists.
7. Push
Explanation: To add or insert at top of the stack, push method is used.
8. D. A and B
Explanation: Elements in a collection are typically organized by the order of their addition to the collection and by some inherent relationship among the elements
9. Rear
Explanation: A linked implementation of a stack adds and removes elements from the Rear of the Linked List.
10.isEmpty
Explanation: isEmpty examines whether the stack is empty or not. If it’s not empty then it examines the first element or front of the queue.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.