wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2ND QTR-QUIZ 5-Java Garbage Collection-12-6-2022

Total questions: 20

Worksheet time: 14mins

Name
Class
Date
1.

Means unreferenced objects.

a)

Garbage

b)

Garbage Collection

c)

Unused objects

d)

Java Garbage Collection

2.

A process of reclaiming the runtime unused memory automatically.

a)

Garbage Collection

b)

Garbage

c)

Java Virtual Machine

d)

Unreferenced objects

3.

In other words, it is a way to destroy the unused objects.

a)

Garbage

b)

Java virtual machine

c)

Garbage Collection

d)

Unreferenced objects

4.

The process by which Java programs perform automatic memory management.

a)

Dangling pointer

b)

Java Virtual Machine

c)

Garbage

d)

Java garbage collection

5.

Occur when a piece of memory is freed while there are still pointers to it, and one of those pointers is dereferenced.

a)

Dangling free bugs

b)

Double free bugs

c)

Dangling pointer bugs

d)

Double pointer bugs

6.

Occur when the program tries to free a region of memory that has already been freed and perhaps already been allocated again.

a)

Dangling pointer bugs

b)

Double free bugs

c)

Double pointer bugs

d)

Dangling free bugs

7.

Said to have occurred when unreachable objects in the young generation heap memory are removed.

a)

A minor or incremental garbage collection

b)

A major or full garbage collection

c)

A minor or full garbage collection

d)

A major or incremental garbage collection

8.

Said to have occurred when the objects that survived the minor garbage collection and copied into the old generation

or permanent generation heap memory are removed.

a)

A major or incremental garbage collection

b)

A major or full garbage collection

c)

A minor or incremental garbage collection

d)

A minor or full garbage collection

9.

Can impact the performance of Java application in unpredictable ways.

a)

Excessive garbage collection

b)

CPU load

c)

JVM

d)

Garbage collection

10.

Can occur due to a memory leak in the Java application.

a)

Garbage collection process

b)

Excessive garbage collection activity

c)

Garbage collection

d)

Java Virtual Machine

11.

Advantage of Garbage Collection. (Choose 2 answers)

a)

It makes java memory efficient because garbage collector removes the unreferenced objects from heap memory.

b)

Monitoring Garbage Collection

c)

Insufficient memory allocation to the JVM can also result in increased garbage collection activity.

d)

It is automatically done by the garbage collector (a part of JVM) so we don’t need to make extra efforts.

12.

How can an object be unreferenced? (Choose 2 answers)

a)

By assigning a null to another

b)

By assigning a reference to another

c)

By anonymous reference etc.

d)

By nulling the reference

13.

Employee e1 = new Employee();

Employee e2 = new Employee();

e1 = e2;

The above syntax java code is an example of what unreferenced?

a)

By assigning a reference to another

b)

By nulling the reference

c)

By anonymous object etc.

d)

By assigning a null to another

14.

Invoked each time before the object is garbage collected.

a)

gc() method

b)

finalize() method

c)

Object class

d)

Unreferenced()

15.

This method can be used to perform cleanup processing.

a)

finalize() method

b)

gc() method

c)

Object class()

d)

nulling()

16.

protected void finalize()

{

// codes

}

The above syntax code is an example of what method?

a)

class() method

b)

finalize() method

c)

gc() method

d)

object() method

17.

Used to invoke the garbage collector to perform cleanup processing.

a)

gc() method

b)

finalize() method

c)

object() method

d)

class() method

18.

Found in System and Runtime classes.

a)

class() method

b)

gc() method

c)

finalize() method

d)

object() method

19.

Certain kinds of memory leaks, in which a program fails to free memory occupied by objects that have become unreachable, which can lead to memory exhaustion.

a)

TRUE

b)

FALSE

20.

Garbage collection frees the programmer from automatic dealing with memory allocation.

a)

TRUE

b)

FALSE