Exam 15: Inheritance

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

When we derive one class from another class, this is known as ____________

Free
(Short Answer)
4.8/5
(31)
Correct Answer:
Verified

inheritance

If a base class has a public member function, and the derived class has a member function with the same name, but with a different parameter list, this function is said to be

Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
Verified

A

Member functions defined as private in the base class are/are not) inherited in the derived class

Free
(Short Answer)
4.8/5
(35)
Correct Answer:
Verified

are not

Polymorphism refers to

(Multiple Choice)
4.8/5
(33)

Given a class A that derives from a class B that derives from a class C, when an object of class A goes out of scope, in which order are the destructors called?

(Multiple Choice)
4.9/5
(35)

A base class may have at most _______ child class derived from it.

(Multiple Choice)
4.8/5
(28)

If a derived class Class2) has redefined a function from the base class Class 1), how can that derived function call the base class function if the function declaration is as follows? Void print );

(Multiple Choice)
4.9/5
(41)

If the member variables of the base class are marked as protected, who can access those variables?

(Essay)
4.8/5
(36)

Given the following classes and code, what is the output of the last statement shown? Class Pet { Public: Virtual void print); String name; Private: }; Class Dog: public Pet { Public: Void print); String breed; }; Void Pet::print) { Cout << "My name is " << name; } Void Dog::print) { Pet::print); Cout << ", and my breed is a "<< breed << endl; } Pet* pPtr; Dog* dPtr=new Dog; DPtr->name= "Rover"; DPtr->breed="Weiner"; PPtr= dPtr; PPtr->print);

(Multiple Choice)
4.9/5
(42)

The ability to associate multiple meanings to one function name using dynamic binding is called _________.

(Short Answer)
4.8/5
(45)

If the member variables in a base class are private, then

(Multiple Choice)
4.8/5
(35)

If you use the keyword virtual in a function declaration, you must also use it in the function definition.

(True/False)
4.9/5
(41)

The base class has everything that is in the derived class and more

(True/False)
4.9/5
(31)

What is another name for a child class?

(Multiple Choice)
4.7/5
(37)

In the derived class definition, you list from the base class

(Multiple Choice)
4.8/5
(45)

A derived class pointer can point to

(Short Answer)
4.9/5
(46)

If you have a copy constructor in the base class, but do not have a copy constructor for the derived class, then

(Multiple Choice)
4.9/5
(33)

Using virtual functions is also known as _______ the functions

(Short Answer)
4.8/5
(37)

Which of the following should be virtual if a base class uses dynamic memory allocation?

(Multiple Choice)
4.9/5
(31)

If a base class has a non-virtual member function named print, and a pointer variable of that class is pointing to a derived object, then the code ptr->print ); calls

(Multiple Choice)
4.8/5
(43)
Showing 1 - 20 of 53
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)