Hybrid 6 ADD Hybrid 5 Flashcards
T/F - Programs execute off the hard drive
False
The stack is reserved space on the RAM, the heap is on the hard drive
False. Both are on memory.
Stack and heap are related to reference and primitive types
False
T/F - Stack and heap memory differs only in how the JVM uses them and how the CPU accesses the memory
True
_______ space is allocated when the program begins execution, ____ space is allocated on the fly by the JVM
stack, heap
Objects are always loaded where?
The heap, think “new” keyword think heap
Public, private variables, static methods and variables all reside where?
The heap, but static methods/vars only once
T/F - The heap contains the executable code that can readily access any program variables
True, as it contains the objects and methods
T/F - Objects are always called into heap memory
True
What type of memory is affected when garbage collection occurs?
Heap memory
T/F - Stack memory will not change size during program execution
True
When is stack memory reserved?
At the start of program execution
What can happen if there is not enough memory for the stack/heap?
Can lead to vulnerabilities that can be exploited
When it comes to addresses in stack memory, explain what the base pointer does, and then what the second pointer does afterwards
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
T/F - Addresses can also be removed from the stack
True