9.2 Structured Programming Flashcards

1
Q

When running a program what items are stored in memory (segments of memory)

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

What is the purpose of the stack

A
  • Subroutine state and local variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a stack overflow and its implications

A

Stack expands and can overwrite program etc.

Note: Stack grows downwards

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

What steps are required to implement subroutine calls using the stack

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

In HEX-8, what instructions are used to implement subroutine calls using the stack

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

What is the stack frame (subroutine)

A

Current ‘state’ frame of the subroutine. Params, return address, local variables etc.

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

Do real computers use the stack for program counter and return addresses

A

Not usually. Most have special Stack Pointer and link registers.

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

What is an exception

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

How can the logic regarding subroutines on the stack be translated to dealing with exceptions

A

Branches to exception handlers similar to subroutine branches with return addresses.

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