CSC-202_NOVA

¡Supera tus tareas y exámenes ahora con Quizwiz!

Suppose the map M holds <Character, String> pairs and is currently empty. What is output by the following statement? System.out.println(M.put('C', "cow"));

"null"

Assume you are using the text's array-based queue and have just instantiated a queue of capacity 10. You enqueue 5 elements, dequeue 5 elements, and then enqueue 1 more element. Which index of the internal array elements holds the value of that last element you enqueued?

5

Our map iterators provide an iteration through:

<key, value> pairs

A depth-first traversal of a tree is also known as a level-order traversal.

False

A java interface can inherit from at most one other interface.

False

A private variable cannot be accessed from anywhere. True or False?

False

A standard linked list provides a good implementation of a "Deque".

False

Clustering is a side effect of quadratic probing.

False

Even though our collections will be generic, our CollectionInterface is not generic.

False

Even though our lists will be generic, our ListInterface is not generic.

False

Even though our queues will be generic, our QueueInterface is not generic. True or False?

False

Even though our stacks will be generic, our StackInterface is not generic. True or False?

False

If N represents the number of elements in the list, then the index-based add method of the ABList class is O(1).

False

If N represents the number of elements in the list, then the index-based remove method of the ABList class is O(1).

False

If N represents the number of elements in the list, then the index-based set method of the ABList class is O(N).

False

If N represents the number of elements in the queue, then the size method of the ArrayBoundedQueue class is O(N). True or False?

False

If N represents the number of elements on the stack, then the isFull method of the ArrayBoundedStack class is O(N). True or False?

False

If you enqueue 5 elements into an empty queue, and then perform the isEmpty operation 5 times, the queue will be empty again.

False

In a map, a key can be null.

False

In a non-empty list, the item that has been in the list the longest will be returned by the get operation.

False

O(N) is the order of growth execution time of the size operation when using the SortedArrayCollection class, assuming a collection size of N.

False

Our CollectionInterface defines a single constructor.

False

Our LBList class inherits from the ABList class.

False

Our LinkedQueue class extends the QueueInterface interface. True or False?

False

Our ListInterface defines two constructors.

False

Our MapInterface extends our CollectionInterface.

False

Polymorphism means many objects can be instantiated from a single class definition. True or False?

False

Recursive methods are always shorter and clearer than the equivalent nonrecursive methods. True or False?

False

The ListInterface is simply a repeat of the CollectionInterface.

False

The abstract level of an ADT provides a specific representation of the structure to hold the data and the implementation of the operations. True or False?

False

The add method of our Collection ADT might throw the CollectionOverflowException.

False

The contains method of our binary search tree examines every node in the tree before returning a result of false, if target is not found.

False

The dequeue operation allows an application to peek at the front of a queue.

False

The dequeue operation is classified as a "transformer," since it removes and returns the element at the rear of the queue

False

The efficiency of the Quick Sort is always O(Nlog2N), where N is the size of the list being sorted.

False

The efficiency of the Selection Sort is O(Nlog2N), where N is the size of the list being sorted.

False

The following code results in garbage being created: Circle c1 = new Circle(8); Circle c2; True or False?

False

The isEmpty operation as defined for the text's Queue ADT throws the QueueUnderflowException on an empty queue. True or False?

False

The isFull operation as defined for the text's Queue ADT throws the QueueOverflowException on a full queue. True or False?

False

The number of different binary trees that can be made from two nodes that contain the key values 41 and 92 is 2.

False

The values stored in a map must be unique.

False

Using our Bubble Sort algorithm, after one pass of the Bubble Sort, the largest element is in its correct place in the array.

False

Using our Selection Sort algorithm, after one pass of the Selection Sort the largest element is in its correct place in the array.

False

When a binary search tree is balanced, it provides O(N2) search, addition, and removal.

False

When maintaining a sorted list using a binary search tree, the search operation computing time is O(1), whereas the insertion operation takes O(log2N) time.

False

(N + 1)(3N3 + 5N2 + 27N +17) is O(N4). True or False?

True

A node and all of its descendants form a subtree rooted at the node.

True

A precondition is an assumption that must be true on entry into a method for it to work correctly. True or False?

True

A queue is a first in, first out structure. True or False?

True

A recursive solution usually has more "overhead" than a non-recursive solution because of the number of method calls. True or False?

True

A tree node's unique predecessor is its parent node.

True

An abstract data type is a data type whose properties (domain and operations) are specified independently of any particular implementation. True or False?

True

By redefining the equals method inherited from the Object class, we can create a means to compare the contents of objects.

True

Computer systems must often provide a "holding area" for messages between two processes, two programs, or even two systems. This holding area is usually called a "buffer" and is often implemented as a queue. True or False?

True

Dynamic memory management is the allocation and deallocation of storage space as needed while an application is executing. True or False?

True

If N represents the number of elements in the collection, then the add method of the SortedArrayCollection class is O(N).

True

If N represents the number of elements in the collection, then the contains method of the ArrayCollection class is O(N).

True

If the base case does not exist or is not reached, then there is infinite recursion. True or False?

True

In Java, the Object class is the root of the inheritance tree. True or False?

True

Java programmers define their own exceptions by extending the library's Exception class. True or False?

True

Java supports single inheritance only, i.e., a class can only directly inherit from a single superclass. True or False?

True

O(N) is the order of growth execution time of the remove operation when using the LinkedCollection class, assuming a collection size of N.

True

O(n) is called linear time. True or False?

True

Our ArrayListMap is unbounded.

True

Our BSTNode class is a self-referential class.

True

Recursive methods must always contain a path that does not contain a recursive call. True or False?

True

Sorting algorithms can be compared based on the number of comparison statements they make.

True

Stacks are often used by compilers and operating systems for storing "postponed obligations." True or False?

True

The Java library's Comparable interface defines functionality related to determining whether one object is greater than, less than, or equal to another object.

True

The QueueInterface interface represents a contract between the implementer of a Queue ADT and the programmer who uses the ADT. True or False?

True

The add method of the LinkedCollection class places the new element at the beginning of the underlying linked list.

True

The dynamic storage allocation approach creates space for a method when the method is invoked. True or False?

True

The efficiency of the Insertion Sort is O(N2) where N is the size of the list being sorted.

True

The efficiency of the Merge Sort is O(Nlog2N), where N is the size of the list being sorted.

True

The enqueue operation should be classified as a "transformer." True or False?

True

The following expression is balanced: ( ( xx [ {{ ** }} ] XX ) ) True or False?

True

The number of different binary search trees that can be made from two nodes that contain the key values 1 and 2 is 2.

True

The number of nodes in a non-empty tree is equal to the number of nodes in its left subtree plus the number of nodes in its right subtree plus 1.

True

The order in which we add information to a list has no effect on when we can retrieve it.

True

The text's array-based list implementation stores elements in the lowest possible indices of the array.

True

To measure the complexity of an algorithm, rather than count all operations, select a fundamental operation, an operation that is performed "the most", and count it. True or False?

True

UML diagrams are a form of abstraction since they hide details and allow us to concentrate just on the major design components. True or False?

True

Using a balanced binary search tree to implement a map would allow an O(log2N) get operation (where N is the number of elements in the map).

True

Using our Selection Sort algorithm, after one pass of the Selection Sort, the smallest element is in its correct place in the array.

True

We use a call to the join method to indicate that the main thread should wait until another thread has completed executing before continuing.

True

When implementing a queue with a linked list, the front of the queue is also the front of the linked list. True or False?

True

When using a double-ended queue, it is possible to add and remove data at both ends of the queue.

True

When using the text's ArrayUnboundedQueue class, the isFull method is not the same as the isFull method in the text's ArrayBoundedQueue class, but the dequeue and isEmpty methods are the same in both classes.

True

While processing the following expression, the highest number of elements on our stack at any one time is 4. ( ( ) ( ) { { { } [ ] } } ) True or False?

True

While the Balanced class uses the ArrayBoundedStack class, the ArrayBoundedStack class implements the StackInterfaceinterface. True or False?

True

What are the argument constraints for the following code? int factorial(int n){ if (n == 0) return 1; else return (n * factorial(n - 1)); }

argument must be greater than or equal to 0

The collision resolution approach called "linear probing" sometimes suffers from a problem called:

clustering

We use the required number of _______________ operations as the basis for our calculation of the efficiency of a sorting algorithm.

element comparison

The most costly method in our HMap class in terms of execution time is the _______________ method.

enlarge

If we cannot remove recursion because tail recursion does not exist, we can always remove it by using:

our own explicitly declared stack.

Given that values is of type LLNode<Integer> and references a linked list (non-empty) of Integer objects, what does the following code do if invoked as mystery(values)? void mystery(LLNode<Integer> list) { if (list != null) { System.out.println(list.getInfo()); mystery(list.getLink()); } }

prints the list from start to end

Given that values is of type LLNode<Integer> and references a linked list (non-empty) of Integer objects, what does the following code do if invoked as mystery(values)? void mystery(LLNode<Integer> list) { if (list != null) { mystery(list.getLink()); System.out.println(list.getInfo()); } }

prints the list in reverse order

The text's approach to creating an array-based queue implementation is:

the floating-front approach.

After one pass of the Quick Sort we know that:

the splitVal is in its correct location.

Recursion is implemented by the system:

using run time storage allocation.


Conjuntos de estudio relacionados

Social Media: Our Connected World Unit 10 Social Media and the Work Force Part 2

View Set

Mastering A&P practice questions exam 3

View Set

850. David Goggins # Kids Explain What Is Love

View Set

Connect: Ch 12 HW (CENTRAL NERVOUS SYSTEM)

View Set

Y5SEM2 - Dental Research Theory ( Rany + Vuthy) MCQs 2018-2019

View Set

Diversity In the American Experience Ch 1

View Set

Language Arts 11 B Unit Test Review

View Set

STATES RIGHTS: Tenth Amendment (limited by DCC & Supremacy Clause)

View Set