Mcq On Java Garbage Collection

1.What allows the programmer to destroy an object x?

A. x.finalize()
B. x.delete()
C. Runtime.getRuntime().gc()
D. Only the garbage collection system can destroy an object.

View Answer

2. Which statement is true?

A. Programs will not run out of memory.
B. Objects that are referred to by other objects will never be garbage collected.
C. Objects that will never again be used are eligible for garbage collection.
D. Objects that can be reached from a live thread will never be garbage collected.

View Answer

3. Which of the below is not a memory leak solution?

A. GC parameter tuning
B. Code changes
C. Process restart
D. JVM parameter tuning

View Answer

4. Which of the below is not a Java Profiler?

B. JProfiler
C. JConsole
D. Eclipse Profiler

View Answer

5. Which statement is true?

A. All objects that are eligible for garbage collection will be garbage collected by the garbage collector.
B. Objects from a class with the finalize() method overridden will never be garbage collected.
C. Objects with at least one reference will never be garbage collected.
D. Objects instantiated within anonymous inner classes are placed in the garbage collectible heap.

View Answer

6. How to get prints of shared object memory maps or heap memory maps for a given process?

A. jmap
B. jvmmap
C. memorymap
D. memorypath

View Answer

7. What is -Xms and -Xmx while starting jvm?

A. Initial; Maximum memory
B. Initial memory
C. Maximum memory
D. Maximum; Initial memory

View Answer

8. Which of the following has the highest memory requirement?

A. Stack
B. Class
D. Heap

View Answer

9. Where is a new object allocated memory?

A. Young space
C. Young or Old space depending on space availability
D. Old space

View Answer

10.Which of the following is a garbage collection technique?

A. Sweep model
B. Mark and sweep model
C. Space management model
D. Cleanup model

View Answer

Also check :


* You must be logged in to add comment.