Shared Flashcard Set

Details

compsci midterm wash u
kill me
31
Computer Science
Undergraduate 1
10/09/2011

Additional Computer Science Flashcards

 


 

Cards

Term
object
Definition
data + methods that operate that data
Term
Primitive data types
Definition
built into Java (atomic unit in any programming language
Term
primitive operators
Definition
built-in functions for combining values (how to combine data together)
Term
operator overloading
Definition
same name for different functions
Term
expression trees
Definition
how multiple operators can be combined together
Term
type conversion
Definition
how data with different types can be combined
must be the same type [if you're adding x and y, they both need to be the same type like ints or doubles]
Term
variable
Definition
abstraction for a piece of information stored in the computer's memory
can only hold values of proper type
example: x = true will not work!
Term
assignment statement
Definition
copies value of one variable to the other
example: x = y
[not the same thing as a mathematical equation]
Term
naming abstraction
Definition
give a name to a value so we don't have to repeat the computation, remember how to do the computation, or keep thinking about it
data, variables, expressions
Term
procedural abstraction
Definition
methods, algorithms
Term
methods-abstraction relationship
Definition
methods provide abstraction of a computational procedure, allows us to solve a problem once and re-use the solution many times
argument: copied by the client into formal parameter
value returned: copied into variable associated w/ the client
Term
reduction
Definition
use existing method to solve a problem
Term
recursion
Definition
reduction of a problem to a smaller instance instance of the same problem
continues to do this until the instance is so small that it is immediately solvable
Term
stack
Definition
used to store data associated with in-progress methods
region of memory used in a certain way: first in last out
methods are called, variables go to top of stack, when methods return their "Stack space" is released
Term
data flow model
Definition
[recursion] shows how computation breaks down into smaller steps
Term
tail-recursive function
Definition
combining step returns value from recursive call
Term
loops
Definition
implement repetitive segments
initialization-->test for termination condition-->repeated set of actions-->modification to "loop variable"
Term
loop invariant
Definition
correctness of loop is based on this: it is a statement that is true after each loop iteration that can be used to show that the loop produces the desired result
true at start of every iteration, true after initialization, true on exit [obv]
may be temporarily untrue during iteration
Term
while loops
Definition
repeats the statement as long as the condition is true while()
Term
for loops
Definition
for(;;)
Term
recursion vs. iteration
Definition
recursive algorithms are the most straight forward, makes it easy to get program right but can lead to inefficient programs
iterative programs are more efficient: often don't have much re-computation but reasoning of correctness can be more difficult
problems involving search in complex data are best using recursion
Term
object oriented programming
Definition
organized around objects
"class" used to define object types
Term
class
Definition
defines general properties shared by all objects of a given type
defines: data items included in each object, methods that operate on objects, how new objects are created/initialized
Term
instance of a class
Definition
if you have robots that are all the class robot but each have their own location/heading
Term
object references
Definition
access objects in programs
Term
heap
Definition
separate region of memory managed in a different way
as programs create new objects using new operator, space is allocated in the heap region. an object stays in the heap as long as there is an object reference that "points" to it [program variable or instance variable in an object]
Term
garbage
Definition
objects not accessible through any object reference
Term
instance variables
Definition
non static
values are unique to each instance of a class [aka to each object]
Term
class variables
Definition
static fields
there is one copy of this variable in existence no matter how many times the class has been instantiated
Term
local variables
Definition
stores method's temporary state
determined if its local based on its location, no specific code can designate it as local
only visible to methods they declare them, not to the rest of the class
Term
parameter
Definition
classified as variables not fields
Supporting users have an ad free experience!