Deck 10: Inheritance and Polymorphism

Full screen (f)
exit full mode
Question
When you want to make sure a specific constructor from the base class is used, the derived class constructor must explicitly call the base class constructor using the ____________.

A) base keyword
B) const keyword
C) Override method
D) out parameter
Use Space or
up arrow
down arrow
to flip the card.
Question
Which one of the following is a class header indicating that we are defining a class named Amphibian, and it is derived from the Animal class?

A) Amphibian : Animal
B) Animal(Amphibian)
C) Animal->Amphibian
D) Amphibian
Question
A(n) ____________ is a method that appears in a base class but expects to be overridden in a derived class.

A) shadow method
B) base method
C) derived method
D) abstract method
Question
A regular class is sometimes called a(n) ____________.

A) concrete class
B) base class
C) derived class
D) abstract class
Question
The ____________ declares that a method in the derived class overrides a method in the base class.

A) override keyword
B) void keyword
C) new keyword
D) virtual keyword
Question
Base classes are sometimes called superclasses, and derived classes are sometimes called ____________.

A) planned classes
B) copy classes
C) derivatives
D) subclasses
Question
The ____________ inherits fields, properties, and methods from the base class without any of them having to be rewritten.

A) super instance
B) derived class
C) initialized object
D) copy class
Question
A class that is not intended to be instantiated but is to be used only as a base class is called a(n) ____________.

A) abstract class
B) dummy class
C) placeholder
D) entity class
Question
The term ____________ refers to an object's ability to take different forms.

A) adaptation
B) polymorphism
C) portability
D) code reuse
Question
A(n) ____________ is a property that appears in a base class but expects to be overridden in a derived class.

A) base property
B) abstract property
C) derived property
D) public property
Question
When a derived class method has the same name as a base class method, it is often said that the derived class method ____________ the base class method.

A) shadows
B) mimics
C) overrides
D) terminates
Question
To allow a property to be overridden in the ____________ you write the virtual keyword in the property declaration.

A) class header
B) derived class
C) base class
D) class constructor
Question
Which one of the following is a specialized version of a general food substance?

A) pizza
B) chocolate
C) ice cream
D) all of these
Question
To override the property in the ____________ you write the override keyword in the property declaration.

A) parameterized constructor
B) base class
C) field declaration
D) derived class
Question
The ____________ is the general class.

A) starting object
B) default design
C) base class
D) derived class
Question
A base class reference variable knows only about the members that are declared in the ____________.

A) derived class
B) base class
C) method header
D) parameterless constructor
Question
To declare a class as abstract, you use the ____________ in the class header.

A) void keyword
B) new keyword
C) abstract keyword
D) static keyword
Question
In object oriented programming, ____________ is used to create an "is a" relationship among classes.

A) inheritance
B) progression
C) logic
D) elimination
Question
The ____________ declares that a derived class is allowed to override a method in the base class.

A) override keyword
B) class keyword
C) virtual keyword
D) static keyword
Question
When one object is a specialized version of another object, there is a(n) ____________ between them.

A) 1:1 ratio
B) "is a" relationship
C) common bond
D) shared interest
Question
When designing an object-oriented program, the best approach is to write a base class to hold all the general data about an object and then write derived classes for each specific type of object.
Question
Inheritance involves a base class and a relative class.
Question
Properties in a base class can be overridden in the same way that methods can be overridden.
Question
If a base class object is used to call an overridden method, then the derived class's version of the method is the one that executes.
Question
A method that accepts a base class variable as a parameter cannot accept a derived class variable as a parameter.
Question
A class that is not intended to be instantiated but is to be used only as a base class is called a concrete class.
Question
A statement that tries to use the new operator instantiate an abstract class will not compile.
Question
If the derived class introduces additional methods, properties, or fields, as base class reference variable cannot access them.
Question
In the real world you can find many objects that are specialized versions of more general objects.
Question
You cannot assign a base class reference to a derived class variable.
Question
New fields, properties, and methods cannot be added to the derived class.
Question
You can think of the derived class as an extended version of the base class.
Question
When you create a derived class, the base class constructor is executed first, and then the derived class constructor is executed.
Question
Only methods in the derived class can directly access the base class's private members.
Question
If you want to create an abstract read-only property, leave out the set accessor.
Question
When an "is a" relationship exists between objects, it means that the specialized object has all of the characteristics of the general object, plus additional characteristics that make it special.
Question
If the base class does not have a parameterless constructor, the derived class constructor must use the notation: base(parameterList) to call one of the base class's parameterized constructors.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/37
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 10: Inheritance and Polymorphism
1
When you want to make sure a specific constructor from the base class is used, the derived class constructor must explicitly call the base class constructor using the ____________.

A) base keyword
B) const keyword
C) Override method
D) out parameter
A
2
Which one of the following is a class header indicating that we are defining a class named Amphibian, and it is derived from the Animal class?

A) Amphibian : Animal
B) Animal(Amphibian)
C) Animal->Amphibian
D) Amphibian
A
3
A(n) ____________ is a method that appears in a base class but expects to be overridden in a derived class.

A) shadow method
B) base method
C) derived method
D) abstract method
D
4
A regular class is sometimes called a(n) ____________.

A) concrete class
B) base class
C) derived class
D) abstract class
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
5
The ____________ declares that a method in the derived class overrides a method in the base class.

A) override keyword
B) void keyword
C) new keyword
D) virtual keyword
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
6
Base classes are sometimes called superclasses, and derived classes are sometimes called ____________.

A) planned classes
B) copy classes
C) derivatives
D) subclasses
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
7
The ____________ inherits fields, properties, and methods from the base class without any of them having to be rewritten.

A) super instance
B) derived class
C) initialized object
D) copy class
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
8
A class that is not intended to be instantiated but is to be used only as a base class is called a(n) ____________.

A) abstract class
B) dummy class
C) placeholder
D) entity class
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
9
The term ____________ refers to an object's ability to take different forms.

A) adaptation
B) polymorphism
C) portability
D) code reuse
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
10
A(n) ____________ is a property that appears in a base class but expects to be overridden in a derived class.

A) base property
B) abstract property
C) derived property
D) public property
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
11
When a derived class method has the same name as a base class method, it is often said that the derived class method ____________ the base class method.

A) shadows
B) mimics
C) overrides
D) terminates
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
12
To allow a property to be overridden in the ____________ you write the virtual keyword in the property declaration.

A) class header
B) derived class
C) base class
D) class constructor
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
13
Which one of the following is a specialized version of a general food substance?

A) pizza
B) chocolate
C) ice cream
D) all of these
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
14
To override the property in the ____________ you write the override keyword in the property declaration.

A) parameterized constructor
B) base class
C) field declaration
D) derived class
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
15
The ____________ is the general class.

A) starting object
B) default design
C) base class
D) derived class
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
16
A base class reference variable knows only about the members that are declared in the ____________.

A) derived class
B) base class
C) method header
D) parameterless constructor
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
17
To declare a class as abstract, you use the ____________ in the class header.

A) void keyword
B) new keyword
C) abstract keyword
D) static keyword
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
18
In object oriented programming, ____________ is used to create an "is a" relationship among classes.

A) inheritance
B) progression
C) logic
D) elimination
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
19
The ____________ declares that a derived class is allowed to override a method in the base class.

A) override keyword
B) class keyword
C) virtual keyword
D) static keyword
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
20
When one object is a specialized version of another object, there is a(n) ____________ between them.

A) 1:1 ratio
B) "is a" relationship
C) common bond
D) shared interest
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
21
When designing an object-oriented program, the best approach is to write a base class to hold all the general data about an object and then write derived classes for each specific type of object.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
22
Inheritance involves a base class and a relative class.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
23
Properties in a base class can be overridden in the same way that methods can be overridden.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
24
If a base class object is used to call an overridden method, then the derived class's version of the method is the one that executes.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
25
A method that accepts a base class variable as a parameter cannot accept a derived class variable as a parameter.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
26
A class that is not intended to be instantiated but is to be used only as a base class is called a concrete class.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
27
A statement that tries to use the new operator instantiate an abstract class will not compile.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
28
If the derived class introduces additional methods, properties, or fields, as base class reference variable cannot access them.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
29
In the real world you can find many objects that are specialized versions of more general objects.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
30
You cannot assign a base class reference to a derived class variable.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
31
New fields, properties, and methods cannot be added to the derived class.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
32
You can think of the derived class as an extended version of the base class.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
33
When you create a derived class, the base class constructor is executed first, and then the derived class constructor is executed.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
34
Only methods in the derived class can directly access the base class's private members.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
35
If you want to create an abstract read-only property, leave out the set accessor.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
36
When an "is a" relationship exists between objects, it means that the specialized object has all of the characteristics of the general object, plus additional characteristics that make it special.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
37
If the base class does not have a parameterless constructor, the derived class constructor must use the notation: base(parameterList) to call one of the base class's parameterized constructors.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 37 flashcards in this deck.