Chapter 5 Flashcards

Names, Bindings & Scopes

1
Q

___ ___ in programming languages are used to make programs more readable by naming actions to be performed.

A

Special words

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A ___ ___ is a special word of a programming language that cannot be used as a name.

A

Reserved word

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A program ___ is an abstraction of a computer memory cell or collection of cells.

A

variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A variable is characterized by 6 attributes. What are they?

A
Name
Address
Value
Type
Lifetime
Scope
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The address of a variable is the ___ ___ address with which it is associated.

A

machine memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When more than one variable name can be used to access the same memory location, the variables are called ___.

A

Aliases

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The ___ of a variable determines the range of values the variable can store and the set of operations that are defined for values of the that ___.

A

Type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The ___ of a variable is the contents of the memory cell or cells associated with the variable

A

value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

a variable’s value is sometimes called its ___ because it is what is required when the name of the variable appears in the right side of an assignment statement.

A

r-value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A ___ is an association between an attribute and an entity, such as between a variable and its type or value, or between an operation and a symbol.

A

binding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The time in which the associations with a variable are made are called its ___ time.

A

binding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

IN: count = count + 5;

The type of count is bound at ___ time.

A

compile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

IN: count = count + 5;

The set of possible values of count is bound at ___ ___ time.

A

compiler design

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

IN: count = count + 5;

The meaning of the operator symbol + is bound at ___ time, when the types of its operands have been determined.

A

compile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

IN: count = count + 5;

The internal representation of the literal 5 is bound at ___ ___ time

A

compiler design

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

IN: count = count + 5;

The value of count is bound at ___ time with this statement.

A

execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

A binding is ___ if it first occurs before run time begins and remains unchanged through program execution.

A

static

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

If the binding first occurs during run time or can change in the course of program execution, it is called ___

A

dynamic

19
Q

An ___ ___ is a statement in a program that lists variable names and specifies that they are a particular type.

A

explicit declaration

20
Q

An ___ ___ is a means of associating variables with types through default conventions, rather than declaration statements.

A

implicit declaration

21
Q

The memory cell to which a variable is bound somehow must be taken from a pool of available memory; this process is called ___

A

allocation

22
Q

___ is the process of placing a memory cell that has been unbound from a variable back into the pool of available memory.

A

Deallocation

23
Q

The ___ of a variable is the time during which the variable is bound to a specific memory location.

A

lifetime

24
Q

A ___ ___ is one that is bound to a memory cell before program execution begins and remains bound to that same memory cell until program execution terminates.

A

static variable

25
Q

___-___ variables are those whose storage binding are created when their declaration statements are elaborated, but whose types are statically bound.

A

stack-dynamic

26
Q

___ refers to the storage allocation and binding process indicated by the variable’s declaration, which takes place when execution reaches the code to which the declaration is attached.

A

Elaboration

27
Q

An advantage of __ variables is efficiency; addressing can be direct and no run-time overhead is incurred for allocation and deallocation.

A

static

28
Q

A disadvantage of ___ binding is reduced flexibility; a language that has only static variables cannot support recursive subprograms.

A

static binding

29
Q

An advantage of ___-___ variables is it allows for recursive subprograms by creating dynamic local storage for each active copy of the local variable.

A

stack-dynamic

30
Q

A disadvantage of ___-___ is the overhead required for allocation and deallocation.

A

stack-dynamic

31
Q

___ ___-___ variables are nameless (abstract) memory cells that are allocated and deallocated by explicit run-time instructions written by the programmer.

A

explicit heap-dynamic

32
Q

The ___ is a collection of storage cells whose organization is highly disorganized due to the unpredictability of its use.

A

heap

33
Q

___ ___-___ variables are often used to construct dynamic structures, such as linked lists and tress, that need to grow and/or shrink during execution.

A

Explicit heap-dynamic

34
Q

The disadvantages of ___ ___-___ variables are the difficulty of using pointer and reference variables correctly, the cost of references to the variables and the complexity of the required storage management implementation.

A

explicit heap-dynamic

35
Q

___ ___-___ variables are bound to heap storage only when they are assigned values.

A

Implicit heap-dynamic

36
Q

The advantage of ___ ___-___ variables is that they have the highest degree of flexibility, allowing highly generic code to be written.

A

Implicit heap-dynamic

37
Q

One disadvantage of ___ ___-___ variables is the run-time overhead of maintaining all the dynamic attributes, which could include array subscript types and ranges among others

A

Implicit heap-dynamic

38
Q

The ___ of a variable is the range of statements in which the variable is visible.

A

scope

39
Q

A variable is ___ in a statement if it can be referenced or assigned in that statement.

A

visible

40
Q

___ scoping is when the scope of a variable can be determined prior to execution.

A

static

41
Q

___ scoping is based on the calling sequence of subprograms, not on their spatial relationship to each other and can only be determined at run time.

A

Dynamic

42
Q

The ___ ___ of a statement is the collection of all variables that are visible in the statement.

A

referencing environment

43
Q

A ___ ___ is a variable that is bound to a value only once.

A

named constant

44
Q

A binding of a variable to a value at the time it is bound to storage is called ___.

A

initialization