Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
75 Cards in this Set
- Front
- Back
design issues for names
|
are names case sensitive? are special words of the language reserved words or keywords?
|
|
attributes of a variable
|
address, name, value, type, scope, lifetime
|
|
when is binding done?
|
language design time, language implementation time, compile time, run time
|
|
static binding
|
variable is bound to memory before run time and is not changed throughout the program
|
|
dynamic binding
|
variable is bound to memory some time during execution or can be changed during the execution of the program
|
|
explicit declaration
|
in static type binding, statement in a program that lists variable names and specifies that they are a particular type
|
|
implicit declaration
|
in static type binding, associates variable with type through default conventions rather than declaration statements (the first appearance of a variable denotes)
|
|
type inference
|
declaration that is based on context (or use)
|
|
dynamic type binding
|
variable is bound to a type when it is assigned a value in an assignment statement. variables can change any number of times during execution
|
|
static variables
|
those that are bound to memory cells before program execution begins and remain bound to those same memory cells until program execution terminates
|
|
stack-dynamic variables
|
those whose storage bindings are created when their declaration statements are elaborated, but whose types are statically bound. allocated from run time stack
|
|
advantage of stack-dynamic variables
|
some recursive programs require some form of dynamic local storage
|
|
disadvantage of stack-dynamic variables
|
run time overhead of allocation and deallocation, subprograms cannot be history sensitive
|
|
explicit heap-dynamic variables
|
nameless memory cells that are allocated and deallocated by explicit run time instructions written by the programmer. allocated from the heap
|
|
advantage of heap-dynamic variables
|
can grow or shrink during execution (linked lists and trees)
|
|
disadvantages of heap-dynamic variables
|
difficulty of using pointers and references correctly, complexity of the required storage management implementation
|
|
implicit heap-dynamic variables
|
bound to heap storage only when they are assigned values. all attributes of the variable are bound every time they are assigned
|
|
scope of a variable
|
range of statements in which the variable is visible
|
|
a variable is visible if
|
it can be referenced in the statement
|
|
local
|
a variable is this is it declared in the currently active program unit or block
|
|
static scoping
|
method of binding names to nonlocal variables - can be statically determined before execution
|
|
blocks
|
section of code that allows new static scopes to be defined in the midst of executable code, typically uses stack dynamic variables
|
|
problems with static scoping
|
allows more access to variables and subprograms than is necessary
|
|
dynamic scoping
|
scope is determined at run time because it is based on the calling sequence of the subprograms
|
|
referencing environment
|
the collection of all variables that are visible in the statement
|
|
data type
|
a collection of data values and a set of predefined operations on those values
|
|
descriptor
|
the collection of attributes of a variable
|
|
primitive data types
|
numeric and character string
|
|
twos complement
|
take the logical complement and add one
|
|
precision
|
accuracy of the fractional part of the value, measured in bits
|
|
range
|
combination of the range of fraction and more importantly, the range of exponents
|
|
binary coded decimal
|
use binary codes for decimal digits
|
|
boolean
|
simplest data type: either T/F
|
|
design issues for character string types
|
should strings be a special kind of character array or a primitive type? should strings have static or dynamic length?
|
|
static string length
|
string length is static and set when the string is created
|
|
limited dynamic length
|
string length can be varying up to a declared and fixed maximum set by the variable's definition
|
|
dynamic string length
|
strings can have a varying length with no max length
|
|
ordinal type
|
a type in which all the possible values can easily be associated with the set of positive integers
|
|
enumeration type
|
a type in which all of the possible values, which are named constants, are provided, or enumerated, in the definition
|
|
enumeration constants
|
defined and groups collections of named constants
|
|
design issues for enumeration constants
|
is an enumeration constant allowed to appear in more than one type definition, and if so, how is it checked in the program? are enumeration values coerced to integers? are there any other types that are coerced to an enumeration type?
|
|
overloaded literals
|
when an enumeration literal is allowed to appear in more than one declaration in the referencing environment
|
|
array
|
a homogeneous aggregate of data elements in which an individual element is identified by its position relative to the first element
|
|
static array
|
one in which the subscript ranges are statically bound and storage allocation is static
|
|
fixed stack-dynamic array
|
subscript range is static, storage is dynamic, done at declaration elaboration
|
|
stack-dynamic array
|
subscript range and storage allocation are dynamic, done at run time
|
|
fixed heap-dynamic array
|
subscript range and storage fixed at dynamic allocation when requested by user program
|
|
heap dynamic array
|
subscript range and storage fully dynamic and can change any number of times throughout program execution
|
|
advantage of static array
|
efficiency: no dynamic allocation/deallocation is required
|
|
advantage of fixed stack-dynamic array
|
space efficiency because a large array in one subprogram can use the same space as a large array in a different subprogram
|
|
advantage of stack-dynamic array
|
flexibility because the size of the array does not need to be known until the array is about to be used
|
|
advantage of fixed heap-dynamic array
|
flexibility because the array's size always fits the problem
|
|
advantage of heap-dynamic array
|
flexibility because arrays can grow or shrink in size as the need for space changes
|
|
rectangular array
|
a multidimensional array in which all the rows have the same number of elements and all the columns have the same number of elements
|
|
jagged array
|
a multidimensional array in which the rows need not be the same length
|
|
row major order
|
transforms a multidimensional array to a single dimension by mapping the rows first
|
|
column major order
|
transforms a multidimensional array to a single dimension by mapping thecolumns first
|
|
record
|
an aggregate of data elements in which the individual elements are identified by names and accessed through offsets from the beginning of the structure
|
|
fully qualified reference
|
a reference to the record field in which all intermediate record names, from the largest enclosing record to the specific field are named in the reference
|
|
elliptical reference
|
the field is named, but any or all of the enclosing record names can be omitted so long as the resulting reference is unambiguous in the referencing environment
|
|
dangling pointer
|
a pointer that contains the address of a heap-dynamic variable that has been deallocated
|
|
dangling object
|
an object that cannot be referenced or deallocated
|
|
lost heap-dynamic variable
|
an allocated heap-dynamic variable that is no longer accessible to the user program (also called garbage)
|
|
tombstone
|
pointer that points to actual data while it is accessible and is changed to null when memory is deallocated
|
|
lock-and-key
|
pointer and variable must have identical keys in order to reference variable. once memory is deallocated, the variable is given an illegal key
|
|
reference counters
|
eager approach to garbage collection. once counter is at zero, there are no longer any pointers using the variable and the memory can be deleted
|
|
mark-sweep
|
lazy approach to garbage collection. collection only occurs when the list of available space becomes empty
|
|
type checking
|
the activity of ensuring that the operands of an operator are of a compatible type (either legal or can be implicity converted to a compatible type)
|
|
coercion
|
automatic conversion of an operand in type checking
|
|
type error
|
application of an operator to an operand of an inappropriate type
|
|
strong typing
|
a principle that allows no type errors and will check, at run time, for uses of an incorrect type in variables that can store values of more than one type
|
|
side effect
|
occurs when the function changes either one of its parameters or a global variable (3rd param in a for loop)
|
|
referential transparency
|
a program has this property if any two expressions in the program that have the same value can be substituted for one another anywhere in the program without affecting the action of that program
|
|
compound assignment operator
|
shorthand method of specifying a commonly needed form of assignment
|
|
short-circuit evaluation
|
an expression in which the result is determined without evaluating all of the operands and/or statements
|