Question: JAVA 3 REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The best-case performance for a shell sort is: --- O(1) O(n2)

JAVA 3 REVIEW

PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!!

Question 12 points

The best-case performance for a shell sort is: ---

O(1)
O(n2)
O(n)
O(n log n)

Signaler cette question

Question 22 points

The best-case performance for an array of n items using insertion sort is: ---

O(n2)
O(n)
O(1)
there is no best-case

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
infix expression
balanced expression
algebraic expression

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? ---

delete
clear
deleteAll
none of the above

Signaler cette question

Question 62 points

The pop and peek methods throw a(n) ________ exception when the stack is empty. --

runtime
checked
compile time
stackEmpty

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? ---

O(n)
O(1)
O(n log n)
O(n2)

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.
both a & b
none of the above

Signaler cette question

Question 92 points

Reverse polish notation is another term for a(n) --

postfix expression
prefix expresson
infix expression
algebraic expression

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
all of the above

Signaler cette question

Question 112 points

The O(n2) analysis of insertion sort is a(n) _______ analysis. --

worst case
best case
average case
unknown

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? ---

empty
stackEmpty
isEmpty
none of the above

Signaler cette question

Question 142 points

What object behaves like a high-level array? ---

linked-chain
vector
array-chain
all of the above

Signaler cette question

Question 152 points

Which method accesses the last entry of a vector? ---

last
lastElement
endOfVector
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? ---

add
push
put
none of the above

Signaler cette question

Question 172 points

Stacks exhibit which type of behavior? --

first in, last out
first in, first out
last in, first out
last in, first out

Signaler cette question

Question 182 points

What happens when a recursive method does not reach the base case? ---

the program crashes
a stack overflow occurs
both a and b
none of the above

Signaler cette question

Question 192 points

When you remove an item from a stack, you remove it from --

the bottom
the middle
the top
wherever the client specifies

Signaler cette question

Question 202 points

When you add an item to a stack, you place it --

on the bottom
on the top
in the middle
it doesn't matter where

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?
All of the above

Signaler cette question

Question 222 points

What is the efficiency of the iterative selection sort method for a chain of n linked nodes? --

O(2n)
O(n)
O(n log n)
O(n2)

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? ---

peek
look
lastElement
none of the above

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?
All of the above

Signaler cette question

Question 262 points

Recursion can be used to solve problems like ---

processing linked chains
processing arrays
sorting
all of the above

Signaler cette question

Question 272 points

The operation to add an entry to a stack is called a(n) --

add
put
push
peek

Signaler cette question

Question 282 points

When a vector needs to increase its size ---

the capacity is doubled
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) ---

for loop
base case
trace
all of the above

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? ---

recursive overflow
infinite recursion
activation record overflow
stack overflow

Signaler cette question

Question 312 points

What is the efficiency of the insertion sort method for a chain of n linked nodes? ---

O(2n)
O(n)
O(n2)
O(n log n)

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? ---

remove
pop
retrieve
none of the above

Signaler cette question

Question 332 points

The precedence of an operator in a postfix expression --

is always left-to-right
is always right-to-left
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? ---

O(1
O(n)
O ( n log n )
O(n2)

Signaler cette question

Question 372 points

The operation to remove all entries from a stack is called a(n) --

clear
remove
removeAll
empty

Signaler cette question

Question 382 points

In the Java Class Library, the default constructor Vector creates an empty vector with an initial capacity of ---

0
100
10
user-defined

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
throw an exception
return null
all of the above

Signaler cette question

Question 412 points

The average-case performance for shell sort is: ---

O(n2)
O(n2.5)
O(n1.5)
O(n3)

Signaler cette question

Question 422 points

A method that calls itself is called a ---

base method
iterative method
recursive method
dynamic method

Signaler cette question

Question 432 points

The condition when a recursive method does not satisfy a base case it is called ---

finite recursion
iterative recursion
infinite recursion
baseless recursion

Signaler cette question

Question 442 points

Which sorting algorithm is generally the slowest for a large number of items? ---

insertion sort
selection sort.
shell sort.
they are all the same.

Signaler cette question

Question 452 points

Polish notation is another term for a(n) --

postfix expression
prefix expression
infix expression
algebraic expression

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 is empty.
there is no base case.
the array has only one element.

Signaler cette question

Question 472 points

The worst-case performance for shell sort is: ---

O(n1.5)
O(n2)
O(n2.5)
O(n3)

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?
All of the above

Signaler cette question

Question 492 points

The operation to return a stack's top entry is called a(n) --

get
tp
peek
pop

Signaler cette question

Question 502 points

The operation to retrieve the top entry of a stack without removing it is called --

pop
look
peek
top

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!