Question

JAVA 3 LECTURE REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The...

JAVA 3 LECTURE 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
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

1)  O(n)
2)  O(n)
3)  uses the first node in the chain
4)  balanced expression

As per the guidelines we are only allowed to answer first 4 questions per post Please post remaining questions in a new post

Add a comment
Know the answer?
Add Answer to:
JAVA 3 LECTURE REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question...

    JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question 12 pts Which is a valid constructor for Thread? Thread ( Runnable r, int priority ); Thread ( Runnable r, String name ); Thread ( int priority ); Thread ( Runnable r, ThreadGroup g ); Flag this Question Question 22 pts What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds? pause(). sleep(). hang(). kill(). Flag...

  • Name: Each question is worth 1 point. 20 1. In a linked-chain implementation of a Stack...

    Name: Each question is worth 1 point. 20 1. In a linked-chain implementation of a Stack ADT, the performance of pushing an entry onto the stack is a. 0(2) b. О(n) С. 0(r) Answer: What is the entry returned by the peek method after the following stack operations. push(A), push(R), pop0. push(D), popO, push(L), pop0, pushJ), push(S), pop). pop 2. b.S c. L d. D Answer: n an efficient array-based chain implementation of a Stack ADT, the entry peek returns...

  • Here is the recursion tree for the above: I need to know the formula that counts...

    Here is the recursion tree for the above: I need to know the formula that counts the nodes in that recursion tree. An example: the recursion tree for a selection sort with an array of 4 in the worst case scenario looks like this: That is the type of solution I am looking for. Please determine the formula to count the number of nodes in the recursion tree for the insertion sort with an array size of 5 (n=5) where...

  • Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up...

    Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up for helping. True/False (13) Chapter 14 - A List Implementation that Links Data Adding a node to an empty chain is the same as adding a node to the beginning of a chain. Adding a node at the end of a chain of n nodes is the same as adding a node at position n. You need a temporary variable to reference nodes as...

  • Assignment on Java programing 1. Write programs for the following exercises in Java. Each file should...

    Assignment on Java programing 1. Write programs for the following exercises in Java. Each file should have short description of the implemented class and for files with main method the problem it is solving. Make sure your files have appropriate names. Programs should write output to the Console. b) BST: Implement Binary Search Tree ADT with insert(int key), delete(int key), Node find(int key), and in-order traverse() where it prints the value of the key. Your operations should use recursion. The...

  • PYTHON please help this is very confusing! THANK YOU! Q5 18 Points In this question, we...

    PYTHON please help this is very confusing! THANK YOU! Q5 18 Points In this question, we will implement the DrippingStack class. This is a fixed capacity stack; it's size does not increase or decrease automatically. Capacity of this DrippingStack will be determined during initialization. When push is invoked with the DrippingStack at full capacity, rather than throwing a FullStack exception, a more typical semantic is to accept the pushed element at the top while dripping the oldest element from the...

  • please answer all questions thanks Question 21 Not yet In a linked-node implementation of a ADT,...

    please answer all questions thanks Question 21 Not yet In a linked-node implementation of a ADT, node does not reference the data in another node answered Points out of 2.00 Select one: True P Flag question False Question 23 Not yet An array implementation of an ADT potentially wastes more space than a linked implementation answered Points out of 2.00 Select one: True P Flag question False Question 25 Should Node be a public class? Briefly explain Not yet answered...

  • PYTHON 3 node Node ADT Question. Question 3 (18 points): Purpose: To practice working with node chains created using...

    PYTHON 3 node Node ADT Question. Question 3 (18 points): Purpose: To practice working with node chains created using the Node ADT to implement slightly harder functionality Degree of Difficulty: Moderate to Tricky In this question you'll implement merge sort for node chains! Recall, merge sort is a divide-and-conquer technique that uses recursion to sort a given sequence (in this case a node chain). A overview of the algorithm is given below. Algorithm mergeSort (NC) Borts node chain NC using...

  • A java program for this question please! Recursion: A word is considered elfish if it contains...

    A java program for this question please! Recursion: A word is considered elfish if it contains the letters: e, l, and f in it, in any order. For example, we would say that the following words are elfish: whiteleaf, tasteful, unfriendly, and waffles, because they each contain those letters. Write a recursive method called elfish(), that, given a word, tells us whether or not that word is elfish. The signature of the method should be: public static boolean elfish(String word)...

  • SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what...

    SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what choices does one make when creating a class that is an example of Abstraction? Encapsulation: What is encapsulation? What is information hiding? What does a public interface to a class consist of (not in the sense of actual java interfaces but what the client uses to manipulate objects of the class) What is an object of a class? What is the constructor? How do...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT