JVM Architecture and Lifecycle MCQs: 12 Solved Java Questions with Explanations
Solve 12 published JVM questions, then use the explanations to separate bytecode, loading, execution, memory areas, reachability and runtime type checks.
KnowledgeGate Team
Exam prep & CS education

JVM questions often look like vocabulary checks, but their close options mix three layers: source code and bytecode, JVM components, and runtime memory. Memorising "write once, run anywhere" is not enough if you cannot trace what loads, verifies and executes a .class file. That gap causes confusion among the JDK, JRE, JVM, compiler, interpreter and JIT. A correct trace separates bytecode, class loading, execution, Metaspace, security checks, casting, garbage collection, finalization and JIT compilation. For a continuous Account trace through class loading, memory areas and bytecode, use JVM Architecture in Java: Class Loading, Memory Areas and a Bytecode Trace; for retrieval practice across the same distinctions, solve each question before reading its explanation.
1. JVM architecture and object lifecycle: the map to use before the MCQs

Keep the compilation and execution path clear:
Stage | Component | Result |
|---|---|---|
Compile |
| Converts |
Load and verify | Class loader and bytecode verifier | Bring required class definitions into the JVM and check bytecode structure |
Execute | Execution engine | Interprets bytecode or JIT-compiles selected code into native instructions |
The JDK is the development toolchain, the JRE is the runtime environment, and the JVM executes bytecode.
For Book ref = new Book();, class metadata for Book belongs to Metaspace in Java 8 or later. The object belongs on the heap. Local reference ref belongs in the current method's stack frame.
Now trace reachability. After Node a = new Node(); Node b = a;, one heap object has two live references. After a = null, one reference through b keeps it reachable. After b = null, zero references remain and the object becomes eligible for garbage collection, with no promise about collection time. The Coding and Skill Development Courses catalogue places this map within a broader programming path.
2. Java bytecode, portability and platform independence
Q1. Identify the Java feature behind cross-platform execution
Which Java buzzword indicates Java programs can run on multiple platforms without recompilation?
A. Robust
B. Secure
C. Platform independent
D. Multithreaded
Answer: C. Platform independent. javac compiles Java source into bytecode rather than host-specific native instructions. A compatible JVM on each platform executes the same bytecode, so the source does not need recompilation for each operating system.
Q2. Name the standard intermediate language produced from Java source
UP LT Grade Assistant Teacher 2025, see the solved page.
________ is a standard machine language into which Java source is compiled.
A. Interpreter
B. Object Oriented
C. Bytecode
D. Assembly
Answer: C. Bytecode. The chain is Hello.java -> javac -> Hello.class -> JVM. An interpreter executes, object oriented describes a paradigm, and assembly targets an instruction family.
Q3. Define Java bytecode without confusing it with source or machine code
UP LT Grade Assistant Teacher 2025, see the solved page.
What is bytecode in Java?
A. Machine-dependent code in Java.
B. Source code in Java.
C. Intermediate machine-independent code generated by Java compiler.
D. Machine code specified to a processor.
Answer: C. Intermediate machine-independent code generated by Java compiler. The programmer writes .java, javac emits .class bytecode, and the JVM interprets or compiles it for the CPU. A and D describe native code; B is the input.
Q4. Find the statement that is not a bytecode advantage
UP LT Grade Assistant Teacher 2025, see the solved page.
Which of the following is NOT an advantage of Java bytecode?
A. Portability
B. Security
C. Platform independent
D. Faster execution than machine code
Answer: D. Faster execution than machine code. JVM targeting provides portability, while verification and controlled loading support security. JIT can improve performance, but bytecode is not inherently faster than native code.
3. Class loading, the interpreter and the JVM execution engine
Q5. Select the minimum execution components named in the options
NTA UGC NET Paper 2, see the solved page.
Java Virtual Machine (JVM) is used to execute architectural neutral byte code. Which of the following is needed by the JVM for execution of Java Code?
A. Class loader only
B. Class loader and Java Interpreter
C. Class loader, Java Interpreter and API
D. Java Interpreter only
Answer: B. Class loader and Java Interpreter. The loader supplies class bytecode and the interpreter executes its instructions. Either alone is incomplete. API libraries provide services, but are not part of the minimum pair requested.
Q6. Identify what turns bytecode into host-specific instructions
UP LT Grade Assistant Teacher 2025, see the solved page.
Which component of Java platform is responsible for converting bytecode into machine-specific code?
A. Java Runtime Environment (JRE)
B. Java Development Kit (JDK)
C. Java Compiler
D. Java Virtual Machine (JVM)
Answer: D. Java Virtual Machine (JVM).javac produces portable .class bytecode. The target JVM's interpreter and JIT pathways execute it. JDK and JRE are broader packages, not the requested component.
4. JVM runtime memory and type checks
Q7. Locate class metadata in Java 8 or later
IBPS SO IT Mains, see the solved page.
In Java 8 or later, which memory area stores class metadata at runtime?
A. Stack
B. Heap
C. Metaspace
D. PermGen
E. None of the above
Answer: C. Metaspace. In Book ref = new Book();, Book metadata belongs to Metaspace, the instance to the heap, and method-local ref to its stack frame. Java 8 replaced PermGen for class metadata storage.
Q8. Trace a downcast that fails only at runtime
RSSB Senior Computer Instructor, see the solved page.
What will happen if an invalid downcast is attempted in Java at runtime?
A. The object will be automatically converted.
B. Java will ignore the cast and continue.
C. The compiler will throw a syntax error.
D. The code will compile but throw ClassCastException at runtime.
Answer: D. The code will compile but throw ClassCastException at runtime.Animal x = new Dog(); Dog d = (Dog) x; succeeds. Animal y = new Cat(); Dog d = (Dog) y; compiles but fails because the object is a Cat. Casting changes the viewed reference type, not the runtime class.
5. JVM security components and the servlet distractor
Q9. Remove the component that does not belong to built-in JVM security
UP LT Grade Assistant Teacher 2025, see the solved page.
Which of the following is not a part of the built-in security of the JVM?
A. Class loaders
B. Servlets
C. Byte code verifier
D. Security manager
Answer: B. Servlets. Class loading and bytecode verification are JVM mechanisms. The security manager is the historical runtime-control option. A servlet is a web component hosted by a servlet container, not built-in JVM security.
6. Object reachability, garbage collection and finalize()
Q10. State when heap memory becomes reclaimable

UP LT Grade Assistant Teacher 2025, see the solved page.
What is garbage collection in the context of Java?
A. The Java Virtual Machine (JVM) checks the output of any Java program and deletes anything that does not make sense at all.
B. The Operating System periodically deletes all of the Java files available on the system.
C. Any Java package imported in a program and not being used, is automatically deleted.
D. When all references to an object are gone, then the memory used by the object is automatically reclaimed.
Answer: D. When all references to an object are gone, then the memory used by the object is automatically reclaimed. After a = null, one reference through b remains. After b = null, the count reaches zero. The object is then eligible, but the assignments do not reveal when collection will occur.
Q11. Interpret the intended role of finalize() carefully
ISRO, see the solved page.
What happens when finalize() is called on an object?
A. The object is immediately garbage collected.
B. The garbage collector calls it before collecting the object.
C. The object gets permanently deleted from memory.
D. It prevents an object from being collected.
Answer: B. The garbage collector calls it before collecting the object. This is the legacy rule tested here. Timing is not deterministic, so finalize() cannot handle essential cleanup. It neither guarantees immediate reclamation nor permanently prevents collection.
7. Just-In-Time compilation versus invented terminology
Q12. Name compilation immediately before execution
UP LT Grade Assistant Teacher 2025, see the solved page.
The process of compiling Intermediate Language programs to the actual machine language on the target platform prior to execution is known as ______. I. Just-In-Time compiling II. First-In-Time compiling
A. Only I
B. Only II
C. Both I and II
D. Neither I nor II
Answer: A. Only I. JIT converts intermediate instructions into native instructions at runtime. "First-In-Time compiling" is not a recognised model. Ahead-of-time compilation produces native code before runtime.
8. How these JVM MCQs test the lifecycle, and the next revision step
The key JVM checks are to identify portable .class bytecode, separate loading, verification and execution, place runtime data correctly, trace reachability and type checks, and distinguish interpretation, JIT and native execution.
Use this retrieval checklist without looking back:
javacproduces bytecode.The JVM loads and executes that bytecode.
Metaspace holds class metadata in Java 8 or later.
Heap objects become eligible for garbage collection only when unreachable.
JIT means runtime compilation to native code.
Recall two values: Book metadata is in Metaspace while new Book() is on the heap. Casting a Cat object to Dog throws ClassCastException.
For the full language sequence, continue with Java Course: Concepts, MCQs and Coding Questions. Use String Handling in Java: Pool, Immutability, Interview Questions as your next concept check. When you are ready to move from Java fundamentals into structured problem solving, DSA Using Java: Placement Preparation Course is the next path.
Keep learning
JVM Architecture in Java: Class Loading, Memory Areas and a Bytecode Trace
Trace a runnable Java program from source to class files, class initialization, run-time memory areas and selected bytecode instructions.
Process State and Lifecycle MCQs: 12 Solved OS Questions with Explanations
Attempt 12 process-state MCQs, then use concise explanations to trace CPU scheduling events, termination cases, Unix lifecycle traps, and CPU limits.
Kotlin vs Java for JVM Applications: A Clear Trade-off Guide
Choose between Kotlin and Java using the same Ticket #42 service example, a migration checklist, and a scorecard whose winner changes when team priorities change.
Java Interview Questions for Freshers: Collections, Exceptions and JVM Traces
Practise Java interviews by predicting exact outputs, tracing object and collection state, following exception paths, and explaining JVM memory without slogans.





