adplus-dvertising

Welcome to the Inheritance MCQs Page

Dive deep into the fascinating world of Inheritance with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Inheritance, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Inheritance, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Inheritance. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Inheritance. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Inheritance MCQs | Page 1 of 8

Q1.
Which of these class is superclass of every class in Java?
Discuss
Answer: (b).Object class
Q2.
Which of these method of Object class can clone an object?
Discuss
Answer: (c).Object clone()
Q3.
Which of these method of Object class is used to obtain class of an object at run time?
Discuss
Answer: (c).Class getclass()
Q4.
Which of these keywords can be used to prevent inheritance of a class?
Discuss
Answer: (d).final
Q5.
Which of these keywords cannot be used for a class which has been declared final?
Discuss
Answer: (a).abstract
Q6.
Which of these class relies upon its subclasses for complete implementation of its methods?
Discuss
Answer: (b).abstract class
Q7.
What is the output of this program?
    abstract class A 
    {
        int i;
        abstract void display();
    }    
    class B extends A 
    {
        int j;
        void display() 
        {
            System.out.println(j);
        }
    }    
    class Abstract_demo 
    {
        public static void main(String args[])
        {
            B obj = new B();
            obj.j=2;
            obj.display();    
        }
    }
Discuss
Answer: (b).2
Q8.
What is the output of this program?
   class A 
   {
 int i;
 int j;
        A() 
        {
            i = 1;
            j = 2;
        }
   }
   class Output 
   {
        public static void main(String args[])
        {
             A obj1 = new A();
             A obj2 = new A();
      System.out.print(obj1.equals(obj2));
        }
   }
Discuss
Answer: (a).false
Q9.
Which of these keywords are used to define an abstract class?
Discuss
Answer: (b).abstract
Q10.
Which of these is not abstract?
Discuss
Answer: (a).Thread
Page 1 of 8

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!