Stacks and Functions Flashcards

1
Q

A type of data structure where items are ADDED AND THEN REMOVED IN REVERSE ORDER.

A

Stack

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

Often referred to as Last-In, First-Out (LIFO)

A

Stack

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

Heavily used in programming for the storage of information during PROCEDURE OR FUNCTION CALLS.

A

Stack

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

Adding an item to a stack is referred to as a?

A

Push Operattion

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

Removing an item from a stack is referred to as a?

A

Pop Operation

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

The stack is implemented in reverse in memory, stack is implemented growing ___________ in memory.

A

Growing downward.

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

Register used to point to the current top of stack in memory.

A

RSP register.

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

When using stack operations (push and pop), the stack pointer register is _________ during their operation.

A

Adjusted

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

The RSP register is ___________ by _ during push operation.

A

8

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

During the push operation, the operand is _________ to the stack at [RSP]

A

copied.

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

The RSP register is ______ by _ during the pop operation.

A

increased by 8

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

Functions must be _________ before it can be used.

A

Written (located in the code segment)

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

A function may be defined _________.

A

only once

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

True or False: There is a specific order required for how functions are defined.

A

False. There is no specific order

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

True or False: Functions cannot be nested.

A

True

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

Function calls involve two main actions:

A

Linkage
Argument Transmission

17
Q

This action is when the function must be able to return to the correct place in which it was originally called.

18
Q

This action is when the function must be able to access parameters to operate on or to return results.

A

Argument Transmission

19
Q

To instructions that handle the linkage:

A

call <funcName>
ret</funcName>

20
Q

In functions, the call operation works by saving the ______ of where to return to when the function completes (ret).

21
Q

The call operation is accomplished by placing contents of the RIP register on ___________.

22
Q

The RIP register points to the _________________ to be executed.

A

next instruction

23
Q

The ret instruction pops the _____________________________ into the _______________ (thus the appropriate return address is restored).

A

current top of the stack (RSP), RIP register

24
Q

Refers to sending information to a function and obtaining a result as appropriate for the specific function.

A

Argument Transmission

25
Transmitting values to a function is referred to as _____________.
Call-by-value
26
Transmitting addresses to a function is referred to as __________.
call-by-reference
27
A combination of _______ and _______ is used to pass parameters to and/or from a function.
registers and stack
28
The first six integer arguments are passed in ________.
registers.
29
The seventh and any additional arguments are passed on the _____.
stack
30
When the function is completed, the ______ ________ is responsible for clearing the arguments from the stack.
calling routine
31
For functions with return value, the result is placed in the _________ based on the size of the value being returned.
A register
32
The items on the stack as part of a function call that is also referred to as an activation record.
Call frame
33
Possible items in the call frame include? (4)
Return address (required): RIP Preserved registers (if any): RBP Passed arguments (if any) Stack dynamic local variables (if any)
34
If there are any local variables needed within a function, the frame pointer register, ___________________ and then set pointing to itself.
RBP should be pushed.
35
True or False: As additional pushes and pops are performed, the RBP register will change.
False, it will remain unchanged.
36
Used as a reference to access stack dynamic local variables.
RBP