Terminology Flashcards

1
Q

Static memory allocation

A

Memory is allocated at compile time

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

Static typing

A

Type checking is done at compile time. It is not necessary to define an object before it is used but you must have an explicit type declaration e.g. int num; num = 10; (C/C++, Java)

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

Dynamic typing

A

Type checking is done at run time. All variables must be defined before they are used. e.g. num = 10; (Python)

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

Aliasing

A

When two names or expressions refer to the same location e.g. no array bounds checking in C; “shallow” object copies

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

Formal parameters

A

The parameter names used in a function declaration

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

Actual parameters

A

When a function is called expressions called actual parameters are used to compute the parameter values for that call

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

Expressions

A

Syntactic entity that may be evaluated to determine its value

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

Statement

A

Command that alters the state of the machine in some explicit way

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

Declaration

A

Syntactic entity that introduces a new identifier

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

Static scope

A
Identifier refers to the declaration of that name that is declared in the closest enclosing scope of the program text
e.g. 
const int b = 5;
int foo()
{
   int a = b + 5;
   return a;
}
int bar()
{
   int b = 2;
   return foo();
}
int main()
{
   foo(); // returns 10
   bar(); // returns 10
   return 0;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Dynamic scope

A
Global identifier refers to the declaration associated with the most recent environment
e.g. 
const int b = 5;
int foo()
{
   int a = b + 5;
   return a;
}
int bar()
{
   int b = 2;
   return foo();
}
int main()
{
   foo(); // returns 10
   bar(); // returns 7
   return 0;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Abstract/virtual machine

A

An idealised device that can execute a programming language directly

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

Garbage collection

A

The process of detecting garbage (memory locations that are not available to the program) during the execution of a program and making it available

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

Call by value

A

Evaluate the expressions in the actual parameter list and pass the resulting values

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

Call by text

A

Transmit the expression in the actual parameter list as text so that the called function can evaluate them as needed using “eval”

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

L-value

A

Location of a variable

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

R-value

A

Value of a variable

18
Q

Call by reference

A

The L-value (address) of the actual parameter is bound to the formal parameter. The formal parameter becomes a synonym for the location of the actual parameter.

19
Q

Call by value/result or copy-in/copy-out

A

The actuals are copied into the formals and on return the formals are copied back to the actuals

20
Q

Call by name

A

Actual parameters are re-evaluated every time the formal parameter is used (evaluated in the scope of the caller). Similar to beta reduction

21
Q

Dynamic lookup

A

When a method of an object is called, the method body to be executed is selected dynamically at run time according to the implementation of the object that receives the message (e.g. C++ virtual methods)

22
Q

Abstraction

A

Implementation details are hidden inside a program unit with a specific interface e.g. a set of methods that manipulate hidden data

23
Q

Subtyping

A

A relation on types that allows values of one type to be used in place of values of another

24
Q

Substitutivity

A

If A is a subtype of B then any expression of type A may be used without type error in ay context that requires an expression of type B

25
Q

Inheritance

A

The ability to reuse the definition of one kind of object to define another kind of object

26
Q

Type

A

A collection of entities that share some common property

27
Q

Type system

A

Set of rules for associating a type with phrases in the language

28
Q

Strong vs weak type system

A

A strong type system only accepts safe phrases (i.e. phrases that are guaranteed to evaluate without type error)

29
Q

Type safe

A

The extent to which a programming language discourages or prevents type errors

30
Q

Type error

A

A computational entity is used in a manner that is inconsistent with the concept it represents

31
Q

Type checking

A

Used to prevent some/all type errors

32
Q

Structural equality

A

Two type expressions are structurally equal if they are equivalent under the following three rules:

  1. A type name is structurally equal to itself
  2. Two types are structurally equal if they are formed by applying the same type constructor to structurally equal types
  3. After a type declaration, say type n = T, the type name n is structurally equal to T
33
Q

Pure name equality

A

A type name is equal to itself but no constructed type is equal to any other constructed type

34
Q

Transitive name equality

A

A type name is equal to itself and can be declared equal to other type names. e.g. typedef int age;

35
Q

Type-expression equality

A

A type name is equal only to itself. Two types of expressions are equal if they are formed by applying the same constructor to equal expressions. In other words the expressions have to be identical.

36
Q

Transparent type declarations

A

An alternative name is given to a type that can also be expressed without this name

37
Q

Opaque type declarations

A

A new type is introduced into the program that is not equal to any other type

38
Q

Parametric (generic) polymorphism

A

A function may be applied to any arguments whose types match a type expression involving type variables e.g. C++ templates

39
Q

Subtype polymorphism

A

A function expecting a given class may be applied to a subclass instead e.g. Java

40
Q

Ad hoc polymorphism/overloading

A

Two or more implementations with different types are referred to by the same name e.g. addition operator in ML

41
Q

Type inference

A

The process of determining the types of phrases based on the constructs that appear in them