Deck 10: Introduction to Inheritance

Full screen (f)
exit full mode
Question
A superclass contains all the fields and methods of its subclasses as well as its own more specific fields and methods.
Use Space or
up arrow
down arrow
to flip the card.
Question
A class that is used as the basis for inheritance is known as what type of class?

A) child class
B) extended class
C) base class
D) subclass
Question
What kind of a class might be considered to be "fragile"?

A) A built in class that is overloaded.
B) A class that depends on being passed parameters from another method.
C) A class that depends on field names from parent classes.
D) A class that has no destructor method.
Question
What keyword is an alias for the System.Object class?

A) object
B) base
C) super
D) parent
Question
What kind of data field or method can be used within its own class or in any classes extended from that class, but cannot be used by "outside" classes?

A) protected
B) public
C) private
D) internal
Question
A class's ToString() method is often a useful debugging aid.
Question
What is another name for a base class in C#?

A) derived class
B) parent class
C) extended class
D) child class
Question
In C#, any class you create is derived from what single built-in class?

A) System.Console
B) System.Object
C) System.Class
D) Object.System
Question
When using a derived class that contains a method that overrides a parent class method, what keyword can you use to access the parent class method from within the derived class?

A) base
B) super
C) upper
D) parent
Question
When a class inherits from a base class, it is known as what type of class?

A) base class
B) derived class
C) superclass
D) parent class
Question
What term is synonymous with a derived class?

A) parent class
B) superclass
C) base class
D) subclass
Question
What happens to a base class member in a derived class that is not hidden by the derived class?

A) It is overridden by the derived class.
B) It is removed from the derived class.
C) It will be visible to the derived class.
D) It will be eliminated from the derived class.
Question
What happens when you declare a property defined in a base class as override in a derived class?

A) The new declaration is eliminated in favor of the old declaration.
B) The new declaration removes the old declaration at compile time.
C) The new declaration is used when the compiler deems it appropriate.
D) The new declaration overrides and hides its counterpart in the parent class.
Question
When you use information hiding by selecting which properties and methods of a class to make public, you are assured that your data will be altered only by the properties and methods you choose and only in ways that you can control.
Question
Besides the new keyword, what keyword can you use when defining a derived class member that has the same name as a base class member?

A) cast
B) hide
C) override
D) overload
Question
When presented with two classes that have a parent-child relationship, you can tell which class is the base class and which is the derived class by using the two classes in a sentence using what phrase?

A) "is a"
B) "in a"
C) "of a"
D) "uses a"
Question
You can assign a derived class object to an object of any of its superclass types.When you do, what type of conversion occurs from the derived class to base class?

A) explicit
B) implicit
C) real
D) strong
Question
The Equals() method compares two objects and returns true if they have the same value.
Question
What is another name for a derived class in the C# programming language?

A) parent class
B) second class
C) base class
D) child class
Question
If a base class and a derived class have methods with the same names but different parameter lists, the derived class method overrides the base class method.
Question
Explain the sequence of constructors that will be called when you create an object that is an instance of a derived class.
Question
A class that is able to inherit from more than one class utilizes what C# feature?

A) polymorphism
B) interfacing
C) collaboration
D) multiple inheritance
Question
What method can you use to return a unique hash for different objects, so long as you explicitly implement it in a derived class?

A) CalcHash()
B) GetHashGen()
C) ToHash()
D) GetHashCode()
Question
What object class method returns a string that holds the name of the class, just as GetType() does?

A) GetHashCode()
B) Equals()
C) GetName()
D) ToString()
Question
What keyword always refers to the superclass of the class in which you use it?

A) super
B) parent
C) upper
D) base
Question
The ability to inherit from more than one class is called multiple inheritance.C# prohibits multiple inheritance, but it does provide an alternative mechanism.Why is multiple inheritance prohibited, and what is the alternative that is provided?
Question
What type of class is one from which you cannot create concrete objects, but from which you can inherit?

A) abstract
B) concrete
C) base
D) derived
Question
Briefly describe the four public instance methods of the Object class.
Question
When all base class constructors require arguments, you must include a constructor for each derived class you create.Why?
Question
Briefly describe the similarities and differences between abstract classes and interfaces.
Question
What statement regarding the use of the Object class and classes in general is accurate?

A) When you create any child class, no inheritance occurs automatically.
B) All classes inherit the Object class methods.
C) The object class contains a constructor, destructor, and two public instance methods.
D) Although every class descends from Object, not all objects are Objects.
Question
What type of method has no method statements, and requires the use of an override statement for any class derived from a class that contains it?

A) concrete
B) overloaded
C) abstract
D) overridden
Question
System.Console is an example of a class that can't be extended.What is the reason for this?

A) The class has a private access modifier.
B) The class has an internal access modifier.
C) The class has a static access modifier.
D) The class has a protected access modifier.
Question
In the event that a method that should be overridden in a child class has its own implementation, what should you declare the base class method to be?

A) abstract
B) virtual
C) valid
D) static
Question
Show an example of a class definition that creates a subclass of an existing Employee class, and adds a private double field called commissionRate.What is the total set of fields that an instance of the new class contains?
Question
On some occasions, you might want to access parent class data from a child class.Declaring the parent class field as public would violate the principle of information hiding, but declaring it private would make it inaccessible.How can the proper level of security be achieved?
Question
What can be used as a type of "fingerprint" for an object, due to the fact that it is unique?

A) property
B) hash code
C) derived code
D) new property
Question
What are the requirements for overloading the Object class's Equals() method?
Question
Reusing existing classes and interfaces makes the job of programming easier.What are some of the future advantages that come from writing extendable base classes?
Question
When a derived class contains a method or property that overrides a parent class method or property, how can you use the parent class version from within the subclass? Show an example of a derived class that overrides a parent class method, but then uses the parent class method.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 10: Introduction to Inheritance
1
A superclass contains all the fields and methods of its subclasses as well as its own more specific fields and methods.
False
2
A class that is used as the basis for inheritance is known as what type of class?

A) child class
B) extended class
C) base class
D) subclass
C
3
What kind of a class might be considered to be "fragile"?

A) A built in class that is overloaded.
B) A class that depends on being passed parameters from another method.
C) A class that depends on field names from parent classes.
D) A class that has no destructor method.
C
4
What keyword is an alias for the System.Object class?

A) object
B) base
C) super
D) parent
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
What kind of data field or method can be used within its own class or in any classes extended from that class, but cannot be used by "outside" classes?

A) protected
B) public
C) private
D) internal
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
6
A class's ToString() method is often a useful debugging aid.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
7
What is another name for a base class in C#?

A) derived class
B) parent class
C) extended class
D) child class
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
8
In C#, any class you create is derived from what single built-in class?

A) System.Console
B) System.Object
C) System.Class
D) Object.System
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
9
When using a derived class that contains a method that overrides a parent class method, what keyword can you use to access the parent class method from within the derived class?

A) base
B) super
C) upper
D) parent
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
10
When a class inherits from a base class, it is known as what type of class?

A) base class
B) derived class
C) superclass
D) parent class
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
11
What term is synonymous with a derived class?

A) parent class
B) superclass
C) base class
D) subclass
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
12
What happens to a base class member in a derived class that is not hidden by the derived class?

A) It is overridden by the derived class.
B) It is removed from the derived class.
C) It will be visible to the derived class.
D) It will be eliminated from the derived class.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
13
What happens when you declare a property defined in a base class as override in a derived class?

A) The new declaration is eliminated in favor of the old declaration.
B) The new declaration removes the old declaration at compile time.
C) The new declaration is used when the compiler deems it appropriate.
D) The new declaration overrides and hides its counterpart in the parent class.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
14
When you use information hiding by selecting which properties and methods of a class to make public, you are assured that your data will be altered only by the properties and methods you choose and only in ways that you can control.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
15
Besides the new keyword, what keyword can you use when defining a derived class member that has the same name as a base class member?

A) cast
B) hide
C) override
D) overload
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
When presented with two classes that have a parent-child relationship, you can tell which class is the base class and which is the derived class by using the two classes in a sentence using what phrase?

A) "is a"
B) "in a"
C) "of a"
D) "uses a"
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
17
You can assign a derived class object to an object of any of its superclass types.When you do, what type of conversion occurs from the derived class to base class?

A) explicit
B) implicit
C) real
D) strong
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
18
The Equals() method compares two objects and returns true if they have the same value.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
19
What is another name for a derived class in the C# programming language?

A) parent class
B) second class
C) base class
D) child class
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
20
If a base class and a derived class have methods with the same names but different parameter lists, the derived class method overrides the base class method.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
21
Explain the sequence of constructors that will be called when you create an object that is an instance of a derived class.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
22
A class that is able to inherit from more than one class utilizes what C# feature?

A) polymorphism
B) interfacing
C) collaboration
D) multiple inheritance
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
23
What method can you use to return a unique hash for different objects, so long as you explicitly implement it in a derived class?

A) CalcHash()
B) GetHashGen()
C) ToHash()
D) GetHashCode()
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
24
What object class method returns a string that holds the name of the class, just as GetType() does?

A) GetHashCode()
B) Equals()
C) GetName()
D) ToString()
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
25
What keyword always refers to the superclass of the class in which you use it?

A) super
B) parent
C) upper
D) base
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
26
The ability to inherit from more than one class is called multiple inheritance.C# prohibits multiple inheritance, but it does provide an alternative mechanism.Why is multiple inheritance prohibited, and what is the alternative that is provided?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
27
What type of class is one from which you cannot create concrete objects, but from which you can inherit?

A) abstract
B) concrete
C) base
D) derived
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
28
Briefly describe the four public instance methods of the Object class.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
29
When all base class constructors require arguments, you must include a constructor for each derived class you create.Why?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
30
Briefly describe the similarities and differences between abstract classes and interfaces.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
31
What statement regarding the use of the Object class and classes in general is accurate?

A) When you create any child class, no inheritance occurs automatically.
B) All classes inherit the Object class methods.
C) The object class contains a constructor, destructor, and two public instance methods.
D) Although every class descends from Object, not all objects are Objects.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
32
What type of method has no method statements, and requires the use of an override statement for any class derived from a class that contains it?

A) concrete
B) overloaded
C) abstract
D) overridden
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
33
System.Console is an example of a class that can't be extended.What is the reason for this?

A) The class has a private access modifier.
B) The class has an internal access modifier.
C) The class has a static access modifier.
D) The class has a protected access modifier.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
34
In the event that a method that should be overridden in a child class has its own implementation, what should you declare the base class method to be?

A) abstract
B) virtual
C) valid
D) static
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
35
Show an example of a class definition that creates a subclass of an existing Employee class, and adds a private double field called commissionRate.What is the total set of fields that an instance of the new class contains?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
36
On some occasions, you might want to access parent class data from a child class.Declaring the parent class field as public would violate the principle of information hiding, but declaring it private would make it inaccessible.How can the proper level of security be achieved?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
37
What can be used as a type of "fingerprint" for an object, due to the fact that it is unique?

A) property
B) hash code
C) derived code
D) new property
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
38
What are the requirements for overloading the Object class's Equals() method?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
39
Reusing existing classes and interfaces makes the job of programming easier.What are some of the future advantages that come from writing extendable base classes?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
40
When a derived class contains a method or property that overrides a parent class method or property, how can you use the parent class version from within the subclass? Show an example of a derived class that overrides a parent class method, but then uses the parent class method.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 40 flashcards in this deck.