1. Which component is responsible to optimize bytecode to machine code?
a) JVM
b) JRE
c) JIT
d) JDK
Discussion
Explanation: JIT optimizes bytecode to machine specific language code by compiling similar bytecodes at the same time. This reduces overall time taken for compilation of bytecode to machine specific language.
2. What is the extension of java code files?
a) .class
b) .txt
c) .js
d) .java
Discussion
Explanation: Java files have .java extension
3. What is use of interpreter?
a) They are intermediated between JIT and JVM
b) They read high level code and execute them
c) They convert bytecode to machine language code
d) It is a synonym for JIT
Discussion
Explanation: Interpreters read high level language (interprets it) and execute the program.
4. What is the extension of compiled java classes?
a) .txt
b) .class
c) .java
d) .js
Discussion
Explanation: The compiled java files have .class extension
5. Which component is used to compile, debug and execute java program?
a) JDK
b) JRE
c) JIT
d) JVM
Discussion
Explanation: JDK is a core component of Java Environment and provides all the tools, executables and binaries required to compile, debug and execute a Java Program.
6. Which statement is true about java?
a) Platform independent programming language
b) Platform dependent programming language
c) Code dependent programming language
d) Sequence dependent programming language
Discussion
Explanation: Java is called platform independent language as it primarily works on the principle of ‘compile once, run everywhere’.
7. Which concept of Java is achieved by combining methods and attribute into a class?
a) Abstraction
b) Inheritance
c) Encapsulation
d) Polymorphism
Discussion
Explanation: Encapsulation is implemented by combining methods and attribute into a class. The class acts like a container of encapsulating properties.
8. Which component is responsible to run java program?
a) JVM
b) JIT
c) JDK
d) JRE
Discussion
Explanation: JRE is the implementation of JVM, it provides platform to execute java programs.
9. Which of the below is invalid identifier with the main method?
a) public
b) final
c) private
d) static
Discussion
Explanation: main method cannot be private as it is invoked by external method. Other identifier are valid with main method.
10. Which component is responsible for converting bytecode into machine specific code?
a) JDK
b) JVM
c) JRE
d) JIT
Discussion
Explanation: JVM is responsible to converting bytecode to the machine specific code.