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 4 of 8

Q31.
Does Java support multiple level inheritance?
Discuss
Answer: (a).True
Q32.
Which of this keyword can be used in a subclass to call the constructor of superclass?
Discuss
Answer: (a).super
Q33.
What is the process of defining a method in a subclass having same name & type signature as a method in its superclass?
Discuss
Answer: (b).Method overriding
Q34.
Which of these keywords can be used to prevent Method overriding?
Discuss
Answer: (d).final
Q35.
Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?
Discuss
Answer: (d).super();
Q36.
At line number 2 below, choose 3 valid data-type attributes/qualifiers among “final, static, native, public, private, abstract, protected”
public interface Status
   {
        /* insert qualifier here */ int MY_VALUE = 10;
   }
Discuss
Answer: (d).final, static, public
Q37.
Which of these is supported by method overriding in Java?
Discuss
Answer: (c).Polymorphism
Q38.
What is the output of this program?
 class Alligator 
 {
  public static void main(String[] args) 
   {
   int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}};
   int [][]y = x;
   System.out.println(y[2][1]);
   }
 }
Discuss
Answer: (c).7
Q39.
What is the output of this program?
   final class A 
    {
         int i;
    }    
    class B extends A 
    {
        int j;
        System.out.println(j + " " + i);  
    }    
    class inheritance 
    {
        public static void main(String args[])
        {
            B obj = new B();
            obj.display();     
        }
   }
Discuss
Answer: (d).Compilation Error
Q40.
What is the output of this program?
  class Abc
  {
      public static void main(String[]args)
      {
          String[] elements = { "for", "tea", "too" };
          String first = (elements.length > 0) ? elements[0]: null;
      }
  }
Discuss
Answer: (d).The variable first is set to elements[0].
Page 4 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!