Java OOPs Concepts Test 5

    Question 1JAVA OOPS - Object Initialization

    Which is true about objects in Java?

    Question 2JAVA OOPS - Constructor in Inheritance

    What will be printed?

    class A { A() { System.out.println("A"); } } class B extends A { B() { System.out.println("B"); } } public class Main { public static void main(String[] args) { B obj = new B(); } }

    Question 3JAVA OOPS - final Keyword with Inheritance

    Which statement is true?

    Question 4JAVA OOPS - Polymorphism with Abstract Class

    Which is true?

    Question 5JAVA OOPS - Abstract Class with Main Method

    Which is correct?

    Question 6JAVA OOPS - Encapsulation Benefits

    Which of the following is not a benefit of encapsulation?

    Question 7JAVA OOPS - Interface Inheritance

    Which of the following is correct?

    Question 8JAVA OOPS - Fully Qualified Name

    How can you access `Test` class without importing package?

    Question 9JAVA OOPS - Final and Inheritance

    Which of the following is true?

    Question 10JAVA OOPS - Object Class clone()

    Which statement is correct about clone() method?

    Question 11JAVA OOPS - this Keyword Usage

    What does the this keyword represent in Java?

    class Test { int x; Test(int x) { this.x = x; } }

    Question 12JAVA OOPS - No-argument Constructor with Parameters

    Will this code compile?

    class Test { Test(int x) {} } public class Main { public static void main(String[] args) { Test t = new Test(); } }

    Question 13JAVA OOPS - Abstract Class and Inheritance

    Which is true about abstract class inheritance?

    Question 14JAVA OOPS - Interface and Polymorphism

    Which is correct regarding interface polymorphism?

    Question 15JAVA OOPS - Purpose of Abstraction

    What is the main purpose of abstraction in Java?

    Question 16JAVA OOPS - Encapsulation in Practice

    Which statement about encapsulation is correct?

    Question 17JAVA OOPS - Purpose of Interface

    What is the main purpose of interfaces in Java?

    Question 18JAVA OOPS - Benefits of Packages

    Which of the following is not a benefit of packages?

    Question 19JAVA OOPS - Purpose of Final

    What is the main purpose of final keyword in Java?

    Question 20JAVA OOPS - Overriding Rules

    Which of the following rules is true for overriding?