CSC 205 Exam 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Elements can be added only to one end of a linked list True or False

False

The following method lacks a base case. public int noBaseCase(int x){ if (x > 0)return noBaseCase(x - 1) + 1; else return noBaseCase(x - 2) + 2; }

False

Queues are ________ in, first out structure.

First

In a generic method, a type parameter is defined ________.

Inside the parentheses, along with the method's parameter variables

The notation < E extends Comparable<E> > ________.

Is used when there is a recursive definition of the generic type E

The concrete classes that implement the Listinterface are ________.

LinkedList, ArrayList, and AbstractList

The ArrayList implements what collections interface?

List

One of the advantages of using generics is ________.

Programs using generics execute faster than programs that do not

which of the following are not a queue operation?

Remove

A recursive method will throw this kind of error if it's missing a base case.

StackOverflowError

A Set holds a unique group of values/objects.

True

A problem can be solved recursively if it can be broken down into successive smaller problems that are identical to the overall problem.

True

An iterator provides a way to retrieve items from a list in a sequential manner

True

In the declaration ArrayList<T>, T is a(n) _________.

generic Type

A stack is a container that allows elements to be stored and removed ________.

in a last-in-first-out fashion

A java collection ____________.

is an object that is used as a container for other objects

A growth function that is O(n) is

linear

A list is a ___________ collection.

linear

The three major categories of java collections are ______.

lists, sets, maps

Linked lists are made up of individual _____________.

nodes

To make the "links" in our linked list class we use _______.

nodes

The stack peek operation _______.

returns the item at the top of the stack, but does not remove it

Going through the entire list starting with the head/front is called _______ the list.

scanning

In an ordered list, list elements are ordered by ________.

some relationship inherent to the objects

The relationship between the size of a problem and the time it takes to solve is

the growth function.

In an array-based implementation of a stack, an operation that needs to add a new element to the stack may not be able to complete because the array is full. In this case, the failed operation should ________.

throw some appropriately defined exception

Big - Oh notation establishes a(n) ____________ on a growth function

upper bound or worst case

A recursive algorithm is superior to an iterative algorithm along which of the following criteria? The recursive algorithm is computationally more efficient. The recursive algorithm requires less memory to execute. The recursive algorithm is easier to debug. The recursive algorithm is more elegant. All of these

All of these

If method A calls method B, which in turn calls method A, it is called indirect recursion

True

It always is possible to replace a recursion by an iteration and vice versa.

True

Some problems are easier to solve recursively than iteratively

True

Unordered lists have no ordering. True or False

True

A HashMap ________. 1. is a subclass of HashSet that implements the Mapinterface 2. is a subclass of Map that implements the HashCodeinterface 3. uses hash codes to store keys 4. None of the above

Uses hash codes to store keys. 3.

What is recursion?

a method that calls itself

Elements can be added to _______ a list.

any location in


Ensembles d'études connexes

Combo with "FCE Use of English Part 4 Practice"

View Set

Aspectos Básicos de la Entrevista

View Set

Week 7 & 8/ Test 2 - Regular Insulin & NPH Insulin & Heparin

View Set

Maternity and Women's Health Nursing - Pregnancy, At Risk

View Set

Lección 1 | Hola, ¿qué tal? 1 - Saludos

View Set

Chapter 12: Drug Therapy for the Treatment of Cancer

View Set

Chapter 6: Business Intelligence Big Data and Analytics

View Set

SEJPME II - Introduction to Joint Fundamentals

View Set