PLC Flashcards

1
Q

What does the process of allocation to a variable do?

A

To allocate a variable is to bind an address to it

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

What does it mean if the process of allocation is done dynamically

A

If allocation is done dynamically then it is done during the runtime

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

What does it mean if the process of allocation is done statically

A

If allocation is done statically then it is done during initialisation time

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

What are the 6 attributes of variables

A

Name
Address (aka L-Value)
Value (aka R-Value)
Type
Extent
Scope

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

What are the two types of binding

What do they each mean

A

Static and Dynamic

Static binding means that variables are bound during compile time and do not change during execution

Dynamic binding means they either: are bound for the first time at runtime or a binding changes during runtime

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

What is the extent of a variable

A

The extent is the time between allocation and deallocation

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

What are the four kinds of variables

A

Static Variables
Stack dynamic variables
Explicit heap dynamic variables
Implicit heap dynamic variables

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

Explain what Static Variables are

A

Also known as global variables these are bound to a memory at initialisation time. An example of these are static class variables in Java

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

Explain what Stack Dynamic Variables are

A

Also known as local variables the memory for these is allocated from the runtime stack when some declaration, i.e. a method, is executed. These are deallocated when that procedural block they are used in returns. An example of a stack dynamic variable is the local variables in a method declaration

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

Explain what Explicit heap dynamic Variables are

A

These are nameless, abstract memory locations which can be allocated and deallocated by the programmer using explicit command such as malloc in C or new in Java

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

Explain what Implicit Heap Dynamic Variables are

A

These are an error prone and inefficient form of variable which memory is allocated to when the variables are assigned to values, it is deallocated and reallocated when the variable is redefined

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

What are the two types of type binding?

A

Static type and dynamic type binding

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

What are the two types of static type binding

A

Type declaration and type inference

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

What is static type, type declaration, binding

A

Then name when variables are introduced with an explicit type (and possibly value)

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

What is static type, type inference, binding

A

Then name for when variables types are worked out from usage of the variable or by following a fixed naming scheme

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

What is dynamic type binding

A

The name given when variable are assigned a type at runtime the variables type’s is allowed to change during execution should it be assigned a variable of another type.

17
Q

What is the Extent of static variables

A

The whole program

18
Q

What is the Extent of Static Dynamic Variables

A

A particular stack frame or procedure call

19
Q

What is the extent of explicit heap dynamic variables

A

Explicit allocation to explicit deallocation

20
Q

What is the extent of Implicit heap dynamic variables

A

Implicit allocation to implicit deallocation

21
Q
A