Memory Management Flashcards

1
Q

What 2 methods are used in ArrayList class?

A

add() and remove()

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

A class defined to represent each list item is known as a…

A

list node

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

True or false.
Can a node be inserted between 2 other nodes?

A

True

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

What are the 4 memory regions that a program uses?

A

Code, Static Memory, The Stack, and The heap

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

What is the region code?

A

The region where the program instructions are stored

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

What is the region Static memory?

A

The region where static fields are allocated

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

Does static variables change? Do their addresses change too?

A

Static variables do not change and their address do not change either.

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

What is the Stack Region?

A

The region where a methods local variables are allocated during a method call.

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

What can a stack region also be called?

A

It can also be called a automatic memor.

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

What does a method call do?

A

It adds local variables to the stack and return removes them from the stack.

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

What is the region The heap.

A

The region where the “new” operator allocates memory for objects.

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

The heap can also be referred to as…

A

Free Store

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

What is garbage collection?

A

Wherein a programs automatic behavior that finds certain areas unreachables i.e(unused)

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

What is a reference count?

A

Java virtual machine keeps a count of all reference variables that are currently referring to an object

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

What makes an object unreachable?

A

If there is no reference count than the object is unreachable.

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

Execution stack means

A

the memory space used to store the information needed by a method, while the method is being executed

17
Q

What is a dynamic heap in Activation records?

A

When a new object is created

18
Q

What happens when a method returns?

A

On the execution stack: the activation method is popped off when the memory returns so the memory is deallocated

19
Q

What does an activation method contain?

A
  1. Address to return to after the method ends
  2. Methods parameters
  3. Methods local variables
  4. Return value (if any)
20
Q

What does a static heap contain?

A

Code and static objects