152). Which component is used to compile, debug and execute java program?
[A] JVM
[B] JDK
[C] JIT
[D] JRE
Show Answer
Correct Answer: JDK
Notes:
Answer: b
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.
2
153). Which component is responsible for converting bytecode into machine specific code?
[A]JVM
[B] JDK
[C]JIT
[D] JRE
Show Answer
Correct Answer: JVM
Notes:
Answer: a
Explanation: JVM is responsible to converting bytecode to the machine specific code. JVM is also platform dependent and provides core java functions like garbage collection, memory management, security etc.
154). Which component is responsible to run java program?
[A]JVM
[B]JDK
[C]JIT
[D] JRE
Show Answer
Correct Answer: JRE
Notes:
Answer: d
Explanation: JRE is the implementation of JVM, it provides platform to execute java programs.
155). Which component is responsible to optimize bytecode to machine code?
[A]JVM
[B]JDK
[C] JIT
[D]JRE
Show Answer
Correct Answer: JIT
Notes:
Answer: c
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.
156). 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
Show Answer
Correct Answer: Platform independent programming language
Notes:
Answer: a
Explanation: Java is called ‘Platform Independent Language’ as it primarily works on the principle of ‘compile once, run everywhere’.
157). Which of the below is invalid identifier with the main method?
[A]public
[B]static
[C]private
[D]final
Show Answer
Correct Answer: private
Notes:
Answer: c
Explanation: main method cannot be private as it is invoked by external method. Other identifier are valid with main method.
158). What is the extension of java code files?
[A].class
[B].java
[C].txt
[D].js
Show Answer
Correct Answer: .java
Notes:
Answer: b
Explanation: Java files have .java extension.
159). What is the extension of compiled java classes?
[A].class
[B].java
[C] .txt
[D].js
Show Answer
Correct Answer: .class
Notes:
Answer: a
Explanation: The compiled java files have .class extension.
160). How can we identify whether a compilation unit is class or interface from a .class file?
[A]Java source file header
[B] Extension of compilation unit
[C] We cannot differentiate between class and interface
[D] The class or interface name should be postfixed with unit type
Show Answer
Correct Answer: Java source file header
Notes:
Answer: a
Explanation: The Java source file contains a header that declares the type of class or interface, its visibility with respect to other classes, its name and any superclass it may extend, or interface it implements.
161). What is use of interpreter?
[A]They convert bytecode to machine language code
[B] They read high level code and execute them
[C]They are intermediated between JIT and JVM
[D] It is a synonym for JIT
Show Answer
Correct Answer: They read high level code and execute them
Notes:
Answer: b
Explanation: Interpreters read high level language (interprets it) and execute the program. Interpreters are normally not passing through byte-code and jit compilation.