Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Inheritance is a means of allowing ________ reusability in OOP. repeating code.

ID: 3629553 • Letter: I

Question


Inheritance is a means of allowing ________


reusability in OOP.
repeating code.
identifying classes.
All of the above

Select the false statement regarding inheritance.
Base classes are always designed to be more specific than derived classes.
A derived class can be larger than its base class.
A derived class can be a base class as well.
A derived cannot have multiple base classes.
The new classes that we create from existing classes are called the ____ classes.
base
derived
parent
none of the above

Which of the following is a valid definition of the derived class bClass?
class aClass: public bClass
{
//...
}
class aClass::bClass
{
//...
};
class bClass::aClass
{
//...
}
public class bClass:aClass
{
//...
}

5. (TCO 4) Consider the following class definition.
public class dClass:pClass
{
//class members list
}

The class dClass is derived from the class pClass using the ____ type of inheritance.
private
protected
static
public

____ is the ability to use the same method to denote different behavior.
Inheritance
Encapsulation
Polymorphism
Composition

Consider the following class declaration (implementation details have been omitted):

public class Point
{
public Point(int a, int b)
{ }
}
public class Circle : Point
{
public Circle(double r, int a, int b) : base(a, b)
{ }
}

Circle constructor _________________


invokes the Point constructor with values a and b.
causes a compiler error.
is unnecessary because the Point constructor is called automatically.
indicates polymorphism.

When a class serves as a base class to other classes, all of its members are included when you create an object from a derived class. However, the members of the base class that are ____ are not directly accessible from within the child class functions.
public
protected
private
static


When you instantiate a class object that has been derived from another class, ____.
only the constructor for the base class is called
only the constructor for the derived class is called
the constructor for the derived class is called first, followed by the base class constructor
the constructor for the base class is called first, followed by the derived class constructor

Allowing a base class to have a member function with the same name as a derived class member function demonstrates the concept of ____.
Overloading
inheritance
abstraction
polymorphism

Explanation / Answer

Inheritance is a means of allowing ________


reusability in OOP.


Select the false statement regarding inheritance.
Base classes are always designed to be more specific than derived classes.
A derived class can be a base class as well.
The new classes that we create from existing classes are called the ____ classes.

derived

Which of the following is a valid definition of the derived class bClass?
public class bClass:aClass
{
//...
}

5. (TCO 4) Consider the following class definition.
public class dClass:pClass
{
//class members list
}

The class dClass is derived from the class pClass using the ____ type of inheritance.
private


____ is the ability to use the same method to denote different behavior.


Polymorphism


Consider the following class declaration (implementation details have been omitted):

public class Point
{
public Point(int a, int b)
{ }
}
public class Circle : Point
{
public Circle(double r, int a, int b) : base(a, b)
{ }
}

Circle constructor ___circle(double r, int a, int b) _____________


invokes the Point constructor with values a and b.

When a class serves as a base class to other classes, all of its members are included when you create an object from a derived class. However, the members of the base class that are ____ are not directly accessible from within the child class functions.

private



When you instantiate a class object that has been derived from another class, ____.

the constructor for the base class is called first, followed by the derived class constructor

Allowing a base class to have a member function with the same name as a derived class member function demonstrates the concept of ____.

Overloading