MCQ

Java MCQ – JDK JRE JVM and JIT

This collection of Java Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “JDK JRE JVM and JIT”.
 

1. What component is used to compile, debug, and run a Java program?

A JVM

B JDK

C JIT

D JRE

B
JDK is the main component of the Java environment and it provides all the tools, executables, and binaries required to compile, debug, and run a Java program.

 

 

2. Which component is responsible for converting byte codes to machine specific code?

A JVM

B JDK

C JIT

D JRE

A
The JVM is responsible for converting the byte-codes into machine-specific code. The JVM is also “Platform Dependent” and provides basic Java functions such as “Garbage Collector”, memory management, security, etc.

 

 

3. Which component is responsible for running the Java program?

A JVM

B JDK

C JIT

D JRE

D
JRE is the implementation of JVM, and it provides a platform for running Java programs.

 

 

4. Which component is responsible for optimizing byte-codes?

A JVM

B JDK

C JIT

D JRE

C
JIT optimizes byte-codes to create specific code by compiling similar byte-codes at the same time. This reduces the overall time required to compile the byte-codes to create a specific language.

 

5. Which statement is true about Java?

A It is a platform independent programming language

B It is a platform dependent programming language

C It is a code dependent programming language

D It is a sequence dependent programming language

A
Java is is a platform independent programming language because it works primarily on the principle of “compile once, run everywhere”.

 

 

6. Which of the following is an invalid keyword with the main() method?

A public

B static

C private

D final

C
The main() method cannot be private because it is invoked by an external method. The other keywords are valid with the main method.

 

 

7. What is the file extension of a Java program?

A .class

B .java

C .txt

D .js

B
Java files have the extension .java.

 

 

8. What is the extension of a compiled program?

A .class

B .java

C .txt

D .js

A
Compiled java files have the .class extension.

 

9. How can we identify if a compilation unit is a class or an interface from a .class file?

A Java Source File Header

B Extension of the compilation unit

C We can’t tell the difference between class and interface

D The name of the class or interface must be prefixed with the type of unit

A
The Java source file contains a header that declares the type of class or interface, its visibility to other classes, its name, and any superclass it can extend, or the interface it implements.

 

 

10. What is the use of the interpreter?

A It converts byte code into machine language

B it is the intermediary between JIT and JVM

C They read high level code and run them

D Can replace JIT

C
The interpreter reads the high level language and runs the program. Interpreters do not normally go through the compilation of byte-code and JIT.
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *