Explore topic-wise MCQs in Java.

This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.

1.

Garbage Collection can be controlled by a program?

A. True
B. False
Answer» C.
2.

Which of the below is not a memory leak solution?

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

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

A. jmap
B. memorymap
C. memorypath
D. jvmmap
Answer» B. memorymap
4.

Which exception is thrown when java is out of memory?

A. MemoryFullException
B. MemoryOutOfBoundsException
C. OutOfMemoryError
D. MemoryError
Answer» D. MemoryError
5.

What is -Xms and -Xmx while starting jvm?

A. Initial; Maximum memory
B. Maximum; Initial memory
C. Maximum memory
D. Initial memory
Answer» B. Maximum; Initial memory
6.

Which of the following is a garbage collection technique?

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

Where is a new object allocated memory?

A. Young space
B. Old space
C. Young or Old space depending on space availability
D. JVM
Answer» B. Old space
8.

GARBAGE_COLLECTION_CAN_BE_CONTROLLED_BY_A_PROGRAM??$

A. True
B. False
Answer» C.
9.

Which of the below is not a Java Profiler?

A. JVM
B. JConsole
C. JProfiler
D. Eclipse Profiler
Answer» B. JConsole
10.

What happens to the thread when garbage collection kicks off?

A. The thread continues its operation
B. Garbage collection cannot happen until the thread is running
C. The thread is paused while garbage collection runs
D. The thread and garbage collection do not interfere with each other
Answer» D. The thread and garbage collection do not interfere with each other
11.

Which of the following has the highest memory requirement?

A. Heap
B. Stack
C. JVM
D. Class
Answer» D. Class