Hybrid 6 ADD Hybrid 5 Flashcards

1
Q

T/F - Programs execute off the hard drive

A

False

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

The stack is reserved space on the RAM, the heap is on the hard drive

A

False. Both are on memory.

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

Stack and heap are related to reference and primitive types

A

False

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

T/F - Stack and heap memory differs only in how the JVM uses them and how the CPU accesses the memory

A

True

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

_______ space is allocated when the program begins execution, ____ space is allocated on the fly by the JVM

A

stack, heap

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

Objects are always loaded where?

A

The heap, think “new” keyword think heap

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

Public, private variables, static methods and variables all reside where?

A

The heap, but static methods/vars only once

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

T/F - The heap contains the executable code that can readily access any program variables

A

True, as it contains the objects and methods

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

T/F - Objects are always called into heap memory

A

True

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

What type of memory is affected when garbage collection occurs?

A

Heap memory

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

T/F - Stack memory will not change size during program execution

A

True

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

When is stack memory reserved?

A

At the start of program execution

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

What can happen if there is not enough memory for the stack/heap?

A

Can lead to vulnerabilities that can be exploited

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

When it comes to addresses in stack memory, explain what the base pointer does, and then what the second pointer does afterwards

A

The base pointer points at the address at the start of stack memory, the second pointer saves each new variable in a block of code at increasingly higher addresses

Like a stack of plates

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

T/F - Addresses can also be removed from the stack

A

True

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

Each time you pass parameters to a method, what happens to the stack? What happens when a method is returned?

A

Bytes are pushed on to the stack when passed, removed from the stack when returned

17
Q

What are the base and second pointers?

A

Special registers inside of the CPU (at least on Intel architecture)