Question 1 The class that does the inheriting is referred to as parent class or
ID: 3746059 • Letter: Q
Question
Question 1
The class that does the inheriting is referred to as parent class or base class or super class.
True
False
Question 2
Methods inherited from the base/super class can be overridden. This means changing their implementation; the original source code from the base class is ignored and new code takes its place. Abstract methods must be overridden.
True
False
Question 3
When inheriting a class, our constructors must call the base class constructor, so that it can initialize its member variables. If not done explicitly, the compiler will place a call to the parameterless/default base class constructor
True
False
Question 4
Protected defines class members which are not visible to users of the class (those who initialize and use it), but are visible to all inheriting classes (descendants).
True
False
Question 5
An interface can only declare methods, variables and constants.
True
False
Question 6
The class that implements a certain interface must implement all methods in it. The only exception is when the class is abstract.
True
False
Question 7
Polymorphism can bear strong resemblance to abstraction, but it is mostly related to overriding methods in derived classes, in order to change their original behavior inherited from the parent class.
True
False
Question 8
Each class with at least one abstract method must be abstract. However, the opposite is not true. It is possible to define a class as an abstract one, even when there are no abstract methods in it.
True
False
Question 9
Abstract classes and interfaces cannot be instantiated:
True
False
Question 10
A subclass should be created when we expect the class to change/complement / alter some of the parent class' functionality.
True
False
True
False
Explanation / Answer
Answer 1:
False,it is called as sub class
Answer 2:
Yes, we can override the methods in child class
Answer 3:
Yes, if dont write, compiler will place code to call the super class constructors
Answer 4:
True,Protected members will be visible to only child classes
Answer 5:
True, it does not contain any implementaion
Answer 6:
Yes, if dont implement all methods of interface than that class is abstract
Answer 7:
True,
Answer 8:
true, we can define
Answer 9:
true, as these dont have proper implementaion we can't instantiated
Answer 10:
True
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.