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
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
A(n) ____________ is a method with no body that appears in a base class, and must be overridden in a (non-abstract) derived class.

A) shadow method
B) base method
C) derived method
D) abstract method
Question
To override a 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 ____________ 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 abstract is sometimes called a(n) ____________.

A) concrete class
B) base class
C) derived class
D) abstract class
Question
A(n) ____________ is a property that appears in a base class, and must be overridden in a (non-abstract) derived class.

A) base property
B) abstract property
C) derived property
D) public property
Question
The ____________ declares that a derived class is allowed to override the current method in the base class.

A) override keyword
B) class keyword
C) virtual keyword
D) static keyword
Question
Which one of the following is a class header indicating that we are defining a class named Amphibian, which is derived from the Animal class?

A) Amphibian : Animal
B) Animal(Amphibian)
C) Animal->Amphibian
D) Amphibian extends Animal
Question
Base classes are sometimes called superclasses, and derived classes are sometimes called ____________.

A) planned classes
B) copy classes
C) derivatives
D) subclasses
Question
In object-oriented programming, the ___________ is more general than classes related to it.

A) container class
B) default design
C) base class
D) derived class
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
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
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
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) "has a" relationship
D) shared interest
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 term ____________ refers to an object's ability to take different forms.

A) adaptation
B) polymorphism
C) portability
D) code reuse
Question
To allow a property to be overridden, you must include the virtual keyword in the property's declaration in the _________ class.

A) constructor
B) derived
C) base
D) virtual
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
A variable declared as a base class type can only be used to reference members declared in the ____________.

A) derived class
B) base class
C) abstract class
D) parameterless constructor
Question
In the real world you can find many objects that are specialized versions of more general objects.
Question
If you want to create an abstract read-only property, leave out the set accessor.
Question
When designing an object-oriented program, the best approach is to define a base class to hold all the general data about a group of similar objects, and then define derived classes for each specific type of object.
Question
You cannot assign a base class reference to a derived class variable.
Question
When program code instatiates a derived class object, the base class constructor executes first, followed by the derived class constructor.
Question
Properties in a base class can be overridden in the same way that methods can be overridden.
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
If a base class does not have a parameterless constructor, its derived class constructor must use the notation: base(parameterList) to call one of the base class's parameterized constructors.
Question
A method that accepts a base class variable as a parameter cannot accept a derived class variable as a parameter.
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 unique.
Question
A statement that tries to use the new operator instantiate an abstract class will not compile.
Question
Only methods in a derived class can directly access the base class's private members.
Question
You can think of a derived class as an extended version of some base class.
Question
If a reference to a base class object calls a method that has been overridden by a derived class, the derived class's version of the method is the one that executes.
Question
Inheritance involves a base class and a relative class.
Question
If a derived class introduces additional methods, properties, or fields, a base class reference variable cannot access them.
Question
New fields, properties, and methods cannot be added to a derived class unless these elements already existed in the base class.
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
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
A
3
A(n) ____________ is a method with no body that appears in a base class, and must be overridden in a (non-abstract) derived class.

A) shadow method
B) base method
C) derived method
D) abstract method
D
4
To override a 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
5
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
6
A class that is not abstract 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
7
A(n) ____________ is a property that appears in a base class, and must be overridden in a (non-abstract) 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
8
The ____________ declares that a derived class is allowed to override the current 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
9
Which one of the following is a class header indicating that we are defining a class named Amphibian, which is derived from the Animal class?

A) Amphibian : Animal
B) Animal(Amphibian)
C) Animal->Amphibian
D) Amphibian extends Animal
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
10
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
11
In object-oriented programming, the ___________ is more general than classes related to it.

A) container class
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
12
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
13
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
14
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
15
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) "has a" relationship
D) shared interest
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
16
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
17
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
18
To allow a property to be overridden, you must include the virtual keyword in the property's declaration in the _________ class.

A) constructor
B) derived
C) base
D) virtual
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
19
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
20
A variable declared as a base class type can only be used to reference members declared in the ____________.

A) derived class
B) base class
C) abstract class
D) parameterless constructor
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
21
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
22
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
23
When designing an object-oriented program, the best approach is to define a base class to hold all the general data about a group of similar objects, and then define 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
24
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
25
When program code instatiates a derived class object, the base class constructor executes first, followed by the derived class constructor.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
26
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
27
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
28
If a base class does not have a parameterless constructor, its 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
29
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
30
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 unique.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
31
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
32
Only methods in a 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
33
You can think of a derived class as an extended version of some base class.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
34
If a reference to a base class object calls a method that has been overridden by a derived class, 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
35
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
36
If a derived class introduces additional methods, properties, or fields, a base class reference variable cannot access them.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
37
New fields, properties, and methods cannot be added to a derived class unless these elements already existed in the base class.
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.