11.) What is the purpose of the “finalize()” method in Java?
A) To explicitly deallocate memory for an object.
B) To reclaim memory for unreachable objects.
C) To prevent objects from being garbage collected.
D) To optimize CPU usage.
12.) Which Java memory area stores method-specific data, including local variables and parameters?
A) Stack memory
B) Heap memory
C) PermGen (Metaspace in Java 8+) memory
D) Garbage collection memory
13.) What is the default memory area for storing string literals in Java?
A) Stack memory
B) Heap memory
C) PermGen (Metaspace in Java 8+) memory
D) Garbage collection memory
14.) What is a memory leak in Java?
A) When an object holds a reference to another object.
B) When an object consumes more memory than it needs.
C) When an object is unintentionally retained in memory and cannot be garbage collected.
D) When an object is not initialized properly.
15.) When is the “finalize()” method called on an object by the Garbage Collector?
A) Immediately after the object is created.
B) When the object is explicitly requested to be finalized by the programmer.
C) Just before the object is garbage collected.
D) When the object is marked as unreachable.
16.) Which Java memory area is responsible for storing thread-specific data, such as thread-local variables?
A) Stack memory
B) Heap memory
C) PermGen (Metaspace in Java 8+) memory
D) Thread-local memory
17.) What is the primary purpose of the “System.gc()” method in Java?
A) To explicitly deallocate memory for a specific object.
B) To request the Garbage Collector to run.
C) To optimize CPU usage.
D) To mark an object as unreachable.
18.) Which memory area is responsible for storing objects with a longer lifespan, such as application-wide caches?
A) Stack memory
B) Heap memory
C) PermGen (Metaspace in Java 8+) memory
D) Tenured memory
19.) What is the primary purpose of the Young Generation in Java’s Garbage Collection process?
A) To store long-lived objects.
B) To store short-lived objects.
C) To store method code and class metadata.
D) To store thread-specific data.
20.) What is the purpose of the “Eden” space in the Java Heap?
A) To store long-lived objects.
B) To store short-lived objects.
C) To store class metadata.
D) To store native method code.