JAVA 3 LECTURE REVIEW
PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!!
Question 12 points
The best-case performance for a shell sort is: ---
Signaler cette question
Question 22 points
The best-case performance for an array of n items using
insertion sort is: ---
Signaler cette question
Question 3 2 points
A recursive method that processes a chain of linked nodes
---
|
uses the first node in the
chain |
|
uses the last node in the
chain |
|
divides the chain in half
placing the middle node in the left chain |
|
divides the chain in half
placing the middle node in the right chain |
Signaler cette question
Question 42 points
An expression that has correctly paired delimiters is called
a(n) ---
|
Reverse Po0lish expresson |
Signaler cette question
Question 52 points
In a vector implementation of a Stack ADT, you clear all of the
contents of a stack using which vector method? ---
Signaler cette question
Question 62 points
The pop and peek methods throw a(n) ________ exception when the
stack is empty. --
Signaler cette question
Question 72 points
In an array-based chain implementation of a Stack ADT, what is
the performance of the ensureCapacity method when the array is not
full? ---
Signaler cette question
Question 82 points
Which statement is true about the VectorStack class methods?
---
|
they invoke the methods of the
Vector class. |
|
they require slightly more
execution time than the ArrayStack methods. |
Signaler cette question
Question 92 points
Reverse polish notation is another term for a(n) --
Signaler cette question
Question 102 points
Recursive methods ---
|
do not use an
if-statement |
|
are useful when each recursive
call is a solution to a smaller, identical problem |
|
are not useful in
programming |
Signaler cette question
Question 112 points
The O(n2) analysis of insertion sort is a(n) _______ analysis.
--
Signaler cette question
Question 122 points
Traversing a chain of linked nodes ---
|
is easier to do iteratively
than recursively |
|
is easier to do recursively
than iteratively |
|
is impossible to do
recursively |
|
is easy to do iteratively |
Signaler cette question
Question 132 points
In a vector implementation of a Stack ADT, you check for an
empty stack using which vector method? ---
Signaler cette question
Question 142 points
What object behaves like a high-level array? ---
Signaler cette question
Question 152 points
Which method accesses the last entry of a vector? ---
|
you can't access the last
entry directly |
Signaler cette question
Question 162 points
In a vector implementation of a Stack ADT, you add an entry to
the top of a stack using which vector method? ---
Signaler cette question
Question 172 points
Stacks exhibit which type of behavior? --
Signaler cette question
Question 182 points
What happens when a recursive method does not reach the base
case? ---
Signaler cette question
Question 192 points
When you remove an item from a stack, you remove it from --
|
wherever the client
specifies |
Signaler cette question
Question 202 points
When you add an item to a stack, you place it --
Signaler cette question
Question 212 points
What question should you keep in mind when debugging a recursive
method? ---
|
Does each base case produce a
result that is correct for that case? |
|
are there enough base
cases? |
|
is at least one of the cases a
base case that has no recursive call? |
Signaler cette question
Question 222 points
What is the efficiency of the iterative selection sort method
for a chain of n linked nodes? --
Signaler cette question
Question 232 points
In a vector implementation of a Stack ADT, you retrieve the top
entry without removing it using which vector method? ---
Signaler cette question
Question 242 points
The shell sort works by ---
|
using insertion sort on
subarrays of equally spaced entries. |
|
using insertion sort on
subarrays of equal size consecutive entries. |
|
iteratively searching for the
smallest entry in subarrays of equally spaced entries. |
|
iteratively searching for the
smallest entry in subarrays of equal size consecutive entries. |
Signaler cette question
Question 252 points
What question should you keep in mind when debugging a recursive
method? ---
|
Should a for-loop be included
in the method? |
|
Are the activation records
correct? |
|
if the method returns a value,
does each of the cases return a value? |
Signaler cette question
Question 262 points
Recursion can be used to solve problems like ---
Signaler cette question
Question 272 points
The operation to add an entry to a stack is called a(n) --
Signaler cette question
Question 282 points
When a vector needs to increase its size ---
|
the capacity is increased by
10 empty entries |
|
the capacity is increased by 1
as needed |
|
the capacity increase is
user-defined |
Signaler cette question
Question 292 points
Recursive methods need a(n) ---
Signaler cette question
Question 302 points
When too many recursive calls are made creating more activation
records than the allocated program memory can handle, what kind of
error occurs? ---
|
activation record
overflow |
Signaler cette question
Question 312 points
What is the efficiency of the insertion sort method for a chain
of n linked nodes? ---
Signaler cette question
Question 322 points
In a vector implementation of a Stack ADT, you remove an entry
from the top of a stack using which vector method? ---
Signaler cette question
Question 332 points
The precedence of an operator in a postfix expression --
|
is implied by the order in
which the operators and operands occur |
|
depends on the compiler
implementation |
Signaler cette question
Question 342 points
The best-case scenario for an insertion sort is --
|
the elements are in reverse
sorted order |
|
the elements are already in
sorted order |
|
the elements are in random
order |
|
there is no best-case
scenario |
Signaler cette question
Question 352 points
Shell sort can be improved by: ---
|
using selection sort instead
of insertion sort as the final step. |
|
alternating insertion sort and
selection sort each iteration. |
|
you cannot improve the
algorithm's time efficiency. |
|
adding 1 to the space when it
is even. |
Signaler cette question
Question 362 points
In an array-based chain implementation of a Stack ADT, what is
the performance of the ensureCapacity method when the array is
full? ---
Signaler cette question
Question 372 points
The operation to remove all entries from a stack is called a(n)
--
Signaler cette question
Question 382 points
In the Java Class Library, the default constructor Vector
creates an empty vector with an initial capacity of ---
Signaler cette question
Question 392 points
The best-case scenario for an selection sort is: --
|
there is no best-case
scenario. |
|
the elements are in reverse
sorted order. |
|
the elements are in random
order. |
|
the elements are already in
sorted order. |
Signaler cette question
Question 402 points
A reasonable action when attempting to remove an item from an
empty stack is --
|
assume a precondition that the
stack is not empty has been met |
Signaler cette question
Question 412 points
The average-case performance for shell sort is: ---
Signaler cette question
Question 422 points
A method that calls itself is called a ---
Signaler cette question
Question 432 points
The condition when a recursive method does not satisfy a base
case it is called ---
Signaler cette question
Question 442 points
Which sorting algorithm is generally the slowest for a large
number of items? ---
Signaler cette question
Question 452 points
Polish notation is another term for a(n) --
Signaler cette question
Question 462 points
What is the base case in the recursive selection sort method?
---
|
the array is found to be
sorted. |
|
the array has only one
element. |
Signaler cette question
Question 472 points
The worst-case performance for shell sort is: ---
Signaler cette question
Question 482 points
What question should you keep in mind when debugging a recursive
method? ---
|
is there at least one
recursive call? |
|
Did you consider all possible
cases? |
|
Does the method contain a
statement to test an input value and leads to different cases? |
Signaler cette question
Question 492 points
The operation to return a stack's top entry is called a(n)
--
Signaler cette question
Question 502 points
The operation to retrieve the top entry of a stack without
removing it is called --