Data Structures Final

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

Protected

A data field(or method) with _____ visibility can be accessed in either the class defining it, in any subclass of that class, or any class in the same package

by inserting an identifier between left and right brackets

A generic class is defined ____ on the class definition line.

Contract

A java interface is a(n) ___ between the integer designer and the programmer who codes a class that implements the interface

Node

A(n) ____ is a data structure that contains a data item and one or more links

Abstraction

A(n) _____ is a model of physical entity or activity

regular data field and method members

Abstract classes can include ____.

Encapsulation

By defining data members as private, you protect the data and enable access only through the object's methods and properties. This describes the ____ feature.

classes

Components are implemented in C# through ____.

dynamic binding

Determining which method to call at runtime based on which object invokes the method describes ____.

Polymorphism

Enabling multiple implementations of the same behaviors so that the appropriate implementation can be executed based on the situation describes ____ as it relates to object oriented development.

Inheritance

Enabling reuse of code through extending the functionality of classes describes ____ as it relates to object oriented development.

O(1)

If an array is used to implement a Queue, insertion at the rear of the array can be done in ____ time

EmptyStackException

If you attempt to pop an empty stack, your program will throw a(n) __________

double-ended

In Java 6.0, the Deque interface represents a _____ queue

add the base class following a colon

In order to inherit from a user-defined base class, you must ____.

A. number of entries/ total size of array

Load Factor - which is the correct formula to calculate? A. number of entries/total size of array B. total size of array / number of entries C. number of entries/total size of array * .70 D. hashVal % tableSize

entrySet()

Method ___ creates a set view of the entries in a Map

ILDASM

One of the developer tools available with Visual Studio that can be used to view an assembly is ____.

casting and unboxing the data type

One way to write reusable code is to use the object data type for instance data members. Doing so then requires ____.

B. All elements are stored in the hash table itself.

Regarding open addressing, which of the following is most correct? A. Linked lists are used to handle collisions B. All elements are stored in the hash table itself. C. Does not use hash functions. D. The hash table does not have to be as big as the number of values stored in it.

overridden method

Replacing a method defined at a higher level creates a(n) ____.

no implementation details are included

The distinguishing characteristic of an abstract method is ____.

List

The easiest approach to implementing a stack in Java would be to give it a(n) ____ component for storing the data

String.indexOf

The method ______ returns the position of the character argument in the string.

avoid fully qualifying references to class members

To add dynamic link library components, add a reference to the components in your program and include a using directive. The reason for adding the using directive is to ____.

interface

To override a method, the base method may include any of the following keywords, EXCEPT ____.

35

What is the value of the following postfix expression 5 6 1 + *

O(1)

When a queue is implemented using a circular array, insertion at the front is _______

O(1)

When a queue is implemented using a circular array, removal from the rear is _____

linked lists

for separate chaining collision resolution, the following is commonly used to address collisions

InputMismatchException

A ________ is thrown when the token returned by a Scanner next.... method does not match the pattern for the expected data type

Checked exception

A(n) _____ is an error that is normally not due to programmer error and is beyond the control of the programmer.

Array

A(n) _____ is an indexed data structure, which means you can select its elements in arbitrary order as determined by the subscript value

Stack

A(n) _______ is a data structure in which objects are inserted into and removed from the same end

polymorphism

Calls to the ToString( ) method emphasize the use of ____.

.dll

Class library files end with a(n) ____ extension.

containment

Classes can have a "has a" relationship. This is a concept called ____ or aggregation.

Hah functions do not guarantee a unique hashCode() for every object

In HashTables, collisions occur because of which factor?

Nested

In the Java API documentation, inner classes are called ___ classes

can hold any type of value

Variables declared as dynamic ____.

List

An alternative to implementing a stack as an extension of vector is to write a class that has a(n) ______ component.

True

Can you use a Deque object to implement a stack?

C. must be traversed to find a value

Chose best answer: Which of the following is a limitation of linked lists? A. size immutability B. fixed length C. must be traversed to find a value D. too complex for the Java programmer

public

Constructors are defined with ____ access modifiers.

Overloading

Having multiple methods with the same name but different signatures in a class is called _________.

sealed

If you do not want subclasses to be able to provide new implementation details, you can add the keyword ____ to methods. Doing so keeps derived classes from being able to override the method.

E get(int index)

In the java.util.ArrayList<E> class, which of the following returns a reference to the element at position index?

interfaces

Multiple inheritance is not possible in C#; ____ provides the closest work around to this because a class can implement multiple ____.

encapsulation

Packaging data attributes and behaviors into a single unit so that implementation details can be hidden describes ____ as it relates to object oriented development.

12

Th value of the following expression is ______ 5 7 * 3 10 + + 4 /

C. public class Stack<E> extends Vector<E>

The Java API includes a Stack class as part of the package java.util. The class is as follows. A. public class Stack<E> implements Vector<E> B. public class Stack<E> extends List<E> C. public class Stack<E> extends Vector<E> D. public class Stack<E>

Double-linked list

The LinkedList<E> class implements the list <E> interface using a(n)

Reallocate

The ___ method, of the ArrayList<E> class, creates a new array that is twice the size of the current array and then copies the contents of the current array into the new one

partial

The ____ keyword can be used to spread the definition of your classes over multiple files.

adding base( ): between the constructor heading and the opening curly brace

The base default constructor is called by ____.

this()

The call to ____ invokes the constructor for the current class whose parameter list matches the argument list

push(), pop(), peek(), empty()

The methods that make up the StackInt interface are ______

FIFO (first in, first out)

The queue is an abstract data type with a _____ structure

ArrayList<E>

The simplest class that implements the List<E> interface is the ____ class

LIFO (last in, first out)

The storage policy used by a stack is

Simulation

Through _____ , the designers of a new system can estimate the expected performance of the system before they actually build it

abstract

Use the ____ keyword to mark a class so that it can be used only as the base class from which other classes can be derived.

tags the method as capable of being overridden.

When you add the virtual keyword to a method heading, it ____.

protected

Which access modifier should be used to give derived classes direct access to change the parent member data. This access modifier does not allow classes that instantiate objects of the class to have access to change member data?

var

Which keyword instructs the compiler to infer the type of the variable from the expression on the right side of the initialization statement?

A. deletion of value

Which o the following is NOT used for collision handling? A. deletion of value B. open addressing C. chaining D. Either open addressing or chaining.

A. Traverse the list structure without having to manage a subscript

Which of the following can be done with an array object? A. Traverse the list structure without having to manage a subscript B. Increase or decrease its length, which is fixed. C. Add an element at a specified position without shifting the other elements to make room. D. Remove an element at a specified position without shifting the other elements to fill in the resulting gap.

C. Is easy to explain

Which of the following is NOT a property of a hash function? A. Produce repeatable results in one running of program B. Is efficient to calculate C. Is easy to explain D. Must be an int

D. sort()

Which of the following methods from Objects is NOT commonly overridden? A. toString() B. equals() C. hashCode() D. sort()

A. boolean equals(Object obj)

Which of the following methods of java.lang.Object compares an object to its argument? A. boolean equals(Object obj) B. int hashCode() C. Object clone() D. String toString()

B. Abstract classes can define constants

Which of the following statements is correct? A. is-a and has-a relationships cannot be combined B. abstract classes can define constants C. Interfaces can extend another class D. Instances of abstract classes can be created

D. for (int i = 0; i <= x.length; i++) x[i] = i * i;

Which of the following would cause an ArrayIndexOutOfBounds error? A. public boolean setElementOfX(int index, int val) { if(index >= 0 && index < x.length) { x[index] = val; return true; } else { return false; }} B. public static void main(String[] args) { String inputFileName; if (args.length > 0) inputFileName = args[0]; else inputFileName = "Phone.dat";} C. for (int i = 0; i <x.length; i++) x[i] = i + i; D. for (int i = 0; i <= x.length; i++) x[i] = i * i;

tail.next = head

You could create a circular list from a single-linked list by executing the statement ________

Abstract, Sealed

____ classes cannot be instantiated. ____ classes cannot be inherited.

Interfaces

____ contain no implementation details for any of their methods. Instead all their members are considered abstract.

Unit

____ testing refers to testing the smallest testable piece of software

Collisions

_____ occurs(s) because you can only store one key-value pair in a given array element.

Depth-first

_______ traversal implies that you will follow one path to the end before embarking on a new path

Breadth-first

________ traversal implies that the nodes visited spread out from the starting point

Palindrome

a(n) ____ is a string that reads the same in either direction: left to right or right to left.


Conjuntos de estudio relacionados

Ch.3 - How to retrieve data from a single table, Ch.4 - How to retrieve data from two or more tables

View Set

Chapter 7: Calculating Rate of Return

View Set

Physics Final: Ch. 2 Newton's Laws of Motion

View Set

Developmental Psychology Open-Ended Questions

View Set

My Sciences- branch2- Natty Sciences

View Set

Mid Term Terms - Business and Corporate Strategy

View Set