Exam 1 - CSC220

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

3

123*+4- evaluates to what?

Unified Modeling Language (UML)

A language based on object-oriented concepts that provides tools such as diagrams and symbols to graphically model a system.

sequential search

A search algorithm that scans through a list of items, one at a time, until it finds the target or until the list is exhausted. Also known as "linear search".

selection sort

A sort algorithm that repeatedly scans for the smallest item in the list and swaps it with the element at the current index. The index is then incremented, and the process repeats until the last two elements are sorted.

mergesort

A sort that continuously divides the list into two parts, sorts those parts, and then brings the sorted parts back together. requires 2N space

quick sort

A sorting technique that sequences a list by continuously dividing the list into two parts and moving the lower items to one side and the higher items to the other. It starts by picking one item in the entire list to serve as a pivot point.

insertion sort

Each item is taken in turn, compared to the items in a sorted list and placed in the correct position.

queue

FIFO data structure, can be visualized as a circle

stack

FILO data structure, insertion and removal are restricted to the top/end of the list

driver class

In a programming project, this is the class that contains the method where program execution begins, such as the main method in Java.

worst

O(N) notation refers to the _____ case

binary search big O

O(log n) (best case o(1))

sequential search big O

O(n) (best case o(1))

insertion sort big o

O(n^2) (best case O(n))

selection sort big o

O(n^2) (best case O(n^2))

quick sort big o

O(n^2) (best case O(nlogn))

merge sort big o

O(nlogn) (best case O(nlogn))

object class

Superclass of all Java classes.

final

The keyword ____ is used to declare a variable whose value may only be assigned once and is constant

overriding methods

The polymorphic feature of object-oriented programming where methods inherited from parent classes, such as the toString method from the Object class, are redefined and customized to better fit the purpose of the current class

compile time

Which is preferable, compile time or run time errors?

array; linked list

___ has easy random access memory while ___ has sequential access

linked list; array

___ takes O(1) time for insertion/removal while ___ takes O(n) time for insertion/removal

array list

____ is a class that mimics an array and allows dynamic expansion

private

____ keyword is an access modifier that makes instance variable accessible only to methods of class in which it was declared

linked list; array

____ takes O(n) time to access memory while ___ takes O(1) time

constructors

______ are NOT inherited by a subclass, can be invoked; must be the 1st statement in the subclass

linked list

a data structure that stores an ordered list of items in nodes, where each node stores data and has a pointer to the next node

nested

a file can contain multiple classes if they are ____

superclass, subclasses

a java class can have only one ____, and may be extended by many _____

list and queue

a linked list can act as a ______ bc of the interface(s) it implements

input, logic, output

a method is composed of...

binary search

a search algorithm that starts at the middle of a sorted set of numbers and removes half of the data; this process repeats until the desired value is found or all elements have been eliminated.

interface

a type that consists of a set of method declarations, contains only method headers (no bodies); workaround to single inheritance as a class can extend only one superclass, but can implement many interfaces

list only

an arraylist can act as a _______ bc of the interface(s) it implements

=, + -, * / %, unary ops

arithmetic operator precedence from lowest to highest

dynamic array

arraylist internally uses a ______ to store the elements

storing and accessing

arraylist is better for ______ data

polymorphism

automatically determining object's type at run time, using most specific type possible; allows code to produce different behavior depending on type passed as parameter

no penalty of resizing; no wasted extra array space

benefits of using a stack as a linked list are...

C, logN, N, NlogN, N^2, N^3

big o growth rates from smallest to largest

+, -, *, /, %

binary arithmetic operators

class

blueprint for an object

base case

case that can be computed without recursion, which recursive call makes progress towards

is-a

classes that implement an interface form an ____ relationship with that interface

iterator interface

collection interface requires an ____

instantiation

creating an instance of a class or object

priority queue

data structure that returns items in order of priority

data hiding

declaring an instance as private is known as ____

extends

derived class keyword

object

encapsulation of data and behaviors

linked list, array list, priority queue, tree set

examples of collection interfaces

inheritance, polymorphism, encapsulation

features of OOP

reference; wrapper, primitive

generic classes only work with ____ types; must use ____ class for ____ types

declaration, primitive

giving a name to a variable of a certain type; automatically allocates memory for ____ types only

reverse

in a stack, methods return in ___ order they were called

name, parameters, return type

in order to override a method from a superclass, the subclass method must have the same...

derived, extend

inheritance allows ____ class to ____ functionality of a base class

new

instantiation keyword; invokes the object constructor

implements

interface keyword

comparable interface

interface that allows comparison of objects with a class that has a natural ordering; takes one argument and "this" reference

comparator interface

interface that allows comparison of objects without a natural ordering, uses a separate class that determines what is being compared; takes two arguments

widening

java defaults to ____ conversions, prevents loss of data

static

kind of method that can be called without first being declared in an object of the classe

manipulating

linked list is better for _____ data

doubly linked list

linked lists internally use a _______ to store the elements

fast

manipulation (insertion and deletion) is ____ in a linked list (and why)

slow

manipulation (insertion and deletion) is ____ in an arraylist (and why)

giant blocks of bytes; memory addresses

memory in java is _____ with respective _____

.size()

method to find the length of an array list

head

node that is not an object, stores only a reference

node

object containing a reference to the next instance of a LL structure

data, behaviors

objects have attributes (____) and methods (_____)

.equals()

operator to compar strings, objects

iterative

problem solving approach that describes a sequence of actions

recursive

problem solving approach that describes actions repeated using a method that calls itself, breaks problem in to smaller parts

code on scale

programs with hierarchies of related object types

enqueue, dequeue

queues use the methods ___

||, &&, == !=, > < >= <=

relational/logical operators from lowest to highest precedence (all lower than arithmetic operators)

push, pop, peek

stacks use the methods ____

collection interface

storage data structure is called ___

arrays

structures in Java are all ____ with special properties

treat front as the head, treat back as the tail

to make a queue a linked list...

treat the top of the stack as the head; push to add to the beginning of stack; pop to remove from top

to make a stack a linked list...

++, --

unary arithmetic operators

i++

unary operator position with i where the expression will be evaluated first, and then the increment will be applied to the variable i

++i

unary operator position with i where the increment will be applied to the variable i first and then the expression will be evaluated

run time

when machine code is executed

compile time

when source code is turned in to machine code


Ensembles d'études connexes

DPWH Materials Engineer Exam March 2017

View Set

Unit 9: Insurance Company Products

View Set

Test 1: Sissejuhatus anatoomiasse ja füsioloogiasse

View Set

Chapter 9 Review Quiz- UAFS US History I FULL ONLINE Julie Oliver

View Set

Chapter 25: Kidney Clinical Assessment and Diagnostic Procedures

View Set