InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
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 typeI have been asked this question during an interview for a job.This is a very interesting question from JDK-JRE-JIT-JVM in division Java Environment & OOPS Concepts of Java |
|
Answer» RIGHT choice is (a) Java source file HEADER 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. |
|
| 2. |
What is the extension of compiled java classes?(a) .class(b) .java(c) .txt(d) .jsThis question was addressed to me by my school principal while I was bunking the class.Question is taken from JDK-JRE-JIT-JVM topic in chapter Java Environment & OOPS Concepts of Java |
|
Answer» CORRECT ANSWER is (a) .class For explanation I would SAY: The COMPILED java files have .class extension. |
|
| 3. |
What is the extension of java code files?(a) .class(b) .java(c) .txt(d) .jsThis question was addressed to me in my homework.Origin of the question is JDK-JRE-JIT-JVM in portion Java Environment & OOPS Concepts of Java |
|
Answer» The correct OPTION is (b) .JAVA |
|
| 4. |
Which of the below is invalid identifier with the main method?(a) public(b) static(c) private(d) finalThe question was posed to me in unit test.Query is from JDK-JRE-JIT-JVM in division Java Environment & OOPS Concepts of Java |
|
Answer» CORRECT option is (C) PRIVATE Easy EXPLANATION: main method cannot be private as it is invoked by external method. Other identifier are valid with main method. |
|
| 5. |
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 languageThis question was posed to me during an online exam.I would like to ask this question from JDK-JRE-JIT-JVM in division Java Environment & OOPS Concepts of Java |
|
Answer» Right answer is (a) PLATFORM INDEPENDENT programming language |
|
| 6. |
Which component is responsible to optimize bytecode to machine code?(a) JVM(b) JDK(c) JIT(d) JREI got this question by my school principal while I was bunking the class.I need to ask this question from JDK-JRE-JIT-JVM in portion Java Environment & OOPS Concepts of Java |
|
Answer» The correct choice is (C) JIT |
|
| 7. |
Which component is responsible to run java program?(a) JVM(b) JDK(c) JIT(d) JREThe question was posed to me during a job interview.I would like to ask this question from JDK-JRE-JIT-JVM in section Java Environment & OOPS Concepts of Java |
|
Answer» Correct choice is (d) JRE |
|
| 8. |
Which component is responsible for converting bytecode into machine specific code?(a) JVM(b) JDK(c) JIT(d) JREThis question was posed to me during a job interview.I want to ask this question from JDK-JRE-JIT-JVM topic in section Java Environment & OOPS Concepts of Java |
|
Answer» Correct OPTION is (a) JVM |
|
| 9. |
Which component is used to compile, debug and execute java program?(a) JVM(b) JDK(c) JIT(d) JREThe question was asked in homework.My doubt stems from JDK-JRE-JIT-JVM topic in portion Java Environment & OOPS Concepts of Java |
|
Answer» Right choice is (b) JDK |
|
| 10. |
What is it called where object has its own lifecycle and child object cannot belong to another parent object?(a) Aggregation(b) Composition(c) Encapsulation(d) AssociationThe question was asked in an online quiz.My question comes from Concepts of OOPs topic in portion Java Environment & OOPS Concepts of Java |
|
Answer» The CORRECT answer is (a) Aggregation |
|
| 11. |
What is it called where child object gets killed if parent object is killed?(a) Aggregation(b) Composition(c) Encapsulation(d) AssociationThe question was asked during an interview.Origin of the question is Concepts of OOPs topic in portion Java Environment & OOPS Concepts of Java |
|
Answer» The correct OPTION is (b) Composition |
|
| 12. |
What is it called if an object has its own lifecycle and there is no owner?(a) Aggregation(b) Composition(c) Encapsulation(d) AssociationThe question was posed to me by my school principal while I was bunking the class.This key question is from Concepts of OOPs topic in division Java Environment & OOPS Concepts of Java |
|
Answer» RIGHT option is (d) Association To ELABORATE: It is a RELATIONSHIP where all objects have their own lifecycle and there is no owner. This OCCURS where MANY to many relationships are available, instead of one to one or one to many. |
|
| 13. |
Which concept of Java is achieved by combining methods and attribute into a class?(a) Encapsulation(b) Inheritance(c) Polymorphism(d) AbstractionThis question was posed to me by my school principal while I was bunking the class.Asked question is from Concepts of OOPs topic in section Java Environment & OOPS Concepts of Java |
|
Answer» Correct option is (a) Encapsulation |
|
| 14. |
Which concept of Java is a way of converting real world objects in terms of class?(a) Polymorphism(b) Encapsulation(c) Abstraction(d) InheritanceThis question was posed to me in a national level competition.My question is taken from Concepts of OOPs in portion Java Environment & OOPS Concepts of Java |
|
Answer» Right option is (c) ABSTRACTION |
|
| 15. |
When Overloading does not occur?(a) More than one method with same name but different method signature and different number or type of parameters(b) More than one method with same name, same signature but different number of signature(c) More than one method with same name, same signature, same number of parameters but different type(d) More than one method with same name, same number of parameters and type but different signatureThis question was addressed to me during an internship interview.Enquiry is from Concepts of OOPs topic in division Java Environment & OOPS Concepts of Java |
|
Answer» Right option is (d) More than ONE METHOD with same name, same number of parameters and type but DIFFERENT signature |
|
| 16. |
Which of the following is not OOPS concept in Java?(a) Inheritance(b) Encapsulation(c) Polymorphism(d) CompilationI have been asked this question during an online interview.My query is from Concepts of OOPs topic in portion Java Environment & OOPS Concepts of Java |
|
Answer» RIGHT choice is (d) Compilation Explanation: There are 4 OOPS CONCEPTS in Java. INHERITANCE, Encapsulation, Polymorphism and Abstraction. |
|
| 17. |
When does method overloading is determined?(a) At run time(b) At compile time(c) At coding time(d) At execution timeI got this question in an online interview.This interesting question is from Concepts of OOPs in section Java Environment & OOPS Concepts of Java |
|
Answer» Right ANSWER is (b) At compile TIME |
|
| 18. |
Which of the following is a type of polymorphism in Java?(a) Compile time polymorphism(b) Execution time polymorphism(c) Multiple polymorphism(d) Multilevel polymorphismI have been asked this question in unit test.The query is from Concepts of OOPs topic in chapter Java Environment & OOPS Concepts of Java |
|
Answer» CORRECT option is (a) Compile TIME polymorphism Explanation: There are TWO types of polymorphism in JAVA. Compile time polymorphism (overloading) and runtime polymorphism (OVERRIDING). |
|