Deck 10: Introduction to Inheritance

ملء الشاشة (f)
exit full mode
سؤال
When you declare a property defined in a base class as override in a derived class, this new declaration overrides and ____ its counterpart in the parent class.

A) eliminates
B) removes
C) uses
D) hides
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The Equals() method compares two objects and returns true if they have the same value.
سؤال
A class that inherits from a base class is a ____.

A) base class
B) derived class
C) superclass
D) parent class
سؤال
A class that is used as a basis for inheritance is called a(n) ____.

A) child class
B) extended class
C) base class
D) subclass
سؤال
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 with the phrase ____.

A) "is a"
B) "in a"
C) "of a"
D) "uses a"
سؤال
A ____ is a synonym for a derived class.

A) parent class
B) superclass
C) base class
D) subclass
سؤال
When a derived class contains a method that overrides a parent class method, you can use the keyword ____ to access the parent class method from within the derived class.

A) base
B) super
C) upper
D) parent
سؤال
A(n) ____ data field or method can be used within its own class or in any classes extended from that class, but it cannot be used by "outside" classes.

A) protected
B) public
C) private
D) internal
سؤال
A ____ is a synonym for a derived class.

A) parent class
B) second class
C) base class
D) child class
سؤال
A base class member that is not hidden by the derived class is ____ in the derived class.

A) overridden
B) removed
C) visible
D) eliminated
سؤال
In C#, you can use either new or ____ when defining a derived class member that has the same name as a base class member.

A) cast
B) hide
C) override
D) overload
سؤال
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.
سؤال
A superclass contains all the fields and methods of its subclasses as well as its own more specific fields and methods.
سؤال
You can assign a derived class object to an object of any of its superclass types. When you do, C# makes a(n) ____ conversion from derived class to base class.

A) explicit
B) implicit
C) real
D) strong
سؤال
Every class you create in C# derives from a single class named ____.

A) System.Console
B) System.Object
C) System.Class
D) Object.System
سؤال
The keyword ____ is an alias for the System.Object class.

A) object
B) base
C) super
D) parent
سؤال
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.
سؤال
A class's ToString() method is often a useful debugging aid.
سؤال
A(n) ____ is a synonym for a base class.

A) derived class
B) parent class
C) extended class
D) child class
سؤال
Classes that depend on field names from parent classes are said to be ____ because they are prone to errors.

A) solid
B) fixed
C) fragile
D) sound
سؤال
What are the requirements for overloading the Object class's Equals() method?
سؤال
____________________ are methods that you can write to add to any type, even if you did not create the original class.
سؤال
Explain the sequence of constructors that will be called when you create an object that is an instance of a derived class.
سؤال
Briefly describe the four public instance methods of the Object class.
سؤال
Inheritance is ____________________, which means a child inherits all the members of all its ancestors.
سؤال
The keyword ____ always refers to the superclass of the class in which you use it.

A) super
B) parent
C) upper
D) base
سؤال
The ability to inherit from more than one class is called ____.

A) polymorphism
B) interfacing
C) collaboration
D) multiple inheritance
سؤال
The ____ 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()
سؤال
A(n) ____ method has no method statements; any class derived from a class that contains one must override it by providing a body.

A) concrete
B) overloaded
C) abstract
D) overridden
سؤال
A ____ is sometimes called a "fingerprint" for an object because it uniquely identifies the object.

A) property
B) hash code
C) derived code
D) new property
سؤال
A(n) ____________________ method is one that can be overridden by a method with the same signature in a child class.
سؤال
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.
سؤال
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?
سؤال
A(n) ____ class is one from which you cannot create concrete objects, but from which you can inherit.

A) abstract
B) concrete
C) base
D) derived
سؤال
The entire list of parent classes from which a child class is derived constitutes the ____________________ of the subclass.
سؤال
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?
سؤال
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?
سؤال
C# makes implicit conversions when casting one data type to another. When a derived class object is assigned to its ancestor's data type, the conversion can more specifically be called a(n) ___________________________________.
سؤال
Briefly describe the similarities and differences between abstract classes and interfaces.
سؤال
When all base class constructors require arguments, you must include a constructor for each derived class you create. Why?
سؤال
Match between columns
The ultimate base class for all other types
System.Object
The ultimate base class for all other types
extended class
The ultimate base class for all other types
Equals()
The ultimate base class for all other types
GetType()
The ultimate base class for all other types
reference equality
The ultimate base class for all other types
polymorphism
The ultimate base class for all other types
superclass
The ultimate base class for all other types
sealed class
The ultimate base class for all other types
protected members
Using the same method name to indicate different implementations
System.Object
Using the same method name to indicate different implementations
extended class
Using the same method name to indicate different implementations
Equals()
Using the same method name to indicate different implementations
GetType()
Using the same method name to indicate different implementations
reference equality
Using the same method name to indicate different implementations
polymorphism
Using the same method name to indicate different implementations
superclass
Using the same method name to indicate different implementations
sealed class
Using the same method name to indicate different implementations
protected members
Also known as a derived class
System.Object
Also known as a derived class
extended class
Also known as a derived class
Equals()
Also known as a derived class
GetType()
Also known as a derived class
reference equality
Also known as a derived class
polymorphism
Also known as a derived class
superclass
Also known as a derived class
sealed class
Also known as a derived class
protected members
Returns true if two Object s have the same memory address
System.Object
Returns true if two Object s have the same memory address
extended class
Returns true if two Object s have the same memory address
Equals()
Returns true if two Object s have the same memory address
GetType()
Returns true if two Object s have the same memory address
reference equality
Returns true if two Object s have the same memory address
polymorphism
Returns true if two Object s have the same memory address
superclass
Returns true if two Object s have the same memory address
sealed class
Returns true if two Object s have the same memory address
protected members
A synonym for base class
System.Object
A synonym for base class
extended class
A synonym for base class
Equals()
A synonym for base class
GetType()
A synonym for base class
reference equality
A synonym for base class
polymorphism
A synonym for base class
superclass
A synonym for base class
sealed class
A synonym for base class
protected members
Can be used by a class and its descendants
System.Object
Can be used by a class and its descendants
extended class
Can be used by a class and its descendants
Equals()
Can be used by a class and its descendants
GetType()
Can be used by a class and its descendants
reference equality
Can be used by a class and its descendants
polymorphism
Can be used by a class and its descendants
superclass
Can be used by a class and its descendants
sealed class
Can be used by a class and its descendants
protected members
A class that cannot be extended
System.Object
A class that cannot be extended
extended class
A class that cannot be extended
Equals()
A class that cannot be extended
GetType()
A class that cannot be extended
reference equality
A class that cannot be extended
polymorphism
A class that cannot be extended
superclass
A class that cannot be extended
sealed class
A class that cannot be extended
protected members
Returns a string containing an object's class
System.Object
Returns a string containing an object's class
extended class
Returns a string containing an object's class
Equals()
Returns a string containing an object's class
GetType()
Returns a string containing an object's class
reference equality
Returns a string containing an object's class
polymorphism
Returns a string containing an object's class
superclass
Returns a string containing an object's class
sealed class
Returns a string containing an object's class
protected members
Occurs when two reference type objects refer to the same object
System.Object
Occurs when two reference type objects refer to the same object
extended class
Occurs when two reference type objects refer to the same object
Equals()
Occurs when two reference type objects refer to the same object
GetType()
Occurs when two reference type objects refer to the same object
reference equality
Occurs when two reference type objects refer to the same object
polymorphism
Occurs when two reference type objects refer to the same object
superclass
Occurs when two reference type objects refer to the same object
sealed class
Occurs when two reference type objects refer to the same object
protected members
سؤال
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 Deck
1/42
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 10: Introduction to Inheritance
1
When you declare a property defined in a base class as override in a derived class, this new declaration overrides and ____ its counterpart in the parent class.

A) eliminates
B) removes
C) uses
D) hides
D
2
The Equals() method compares two objects and returns true if they have the same value.
False
3
A class that inherits from a base class is a ____.

A) base class
B) derived class
C) superclass
D) parent class
B
4
A class that is used as a basis for inheritance is called a(n) ____.

A) child class
B) extended class
C) base class
D) subclass
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
5
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 with the phrase ____.

A) "is a"
B) "in a"
C) "of a"
D) "uses a"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
6
A ____ is a synonym for a derived class.

A) parent class
B) superclass
C) base class
D) subclass
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
7
When a derived class contains a method that overrides a parent class method, you can use the keyword ____ to access the parent class method from within the derived class.

A) base
B) super
C) upper
D) parent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
8
A(n) ____ data field or method can be used within its own class or in any classes extended from that class, but it cannot be used by "outside" classes.

A) protected
B) public
C) private
D) internal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
9
A ____ is a synonym for a derived class.

A) parent class
B) second class
C) base class
D) child class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
10
A base class member that is not hidden by the derived class is ____ in the derived class.

A) overridden
B) removed
C) visible
D) eliminated
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
11
In C#, you can use either new or ____ when defining a derived class member that has the same name as a base class member.

A) cast
B) hide
C) override
D) overload
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
12
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
13
A superclass contains all the fields and methods of its subclasses as well as its own more specific fields and methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
14
You can assign a derived class object to an object of any of its superclass types. When you do, C# makes a(n) ____ conversion from derived class to base class.

A) explicit
B) implicit
C) real
D) strong
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
15
Every class you create in C# derives from a single class named ____.

A) System.Console
B) System.Object
C) System.Class
D) Object.System
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
16
The keyword ____ is an alias for the System.Object class.

A) object
B) base
C) super
D) parent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
17
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
18
A class's ToString() method is often a useful debugging aid.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
19
A(n) ____ is a synonym for a base class.

A) derived class
B) parent class
C) extended class
D) child class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
20
Classes that depend on field names from parent classes are said to be ____ because they are prone to errors.

A) solid
B) fixed
C) fragile
D) sound
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
21
What are the requirements for overloading the Object class's Equals() method?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
22
____________________ are methods that you can write to add to any type, even if you did not create the original class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
23
Explain the sequence of constructors that will be called when you create an object that is an instance of a derived class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
24
Briefly describe the four public instance methods of the Object class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
25
Inheritance is ____________________, which means a child inherits all the members of all its ancestors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
26
The keyword ____ always refers to the superclass of the class in which you use it.

A) super
B) parent
C) upper
D) base
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
27
The ability to inherit from more than one class is called ____.

A) polymorphism
B) interfacing
C) collaboration
D) multiple inheritance
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
28
The ____ 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()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
29
A(n) ____ method has no method statements; any class derived from a class that contains one must override it by providing a body.

A) concrete
B) overloaded
C) abstract
D) overridden
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
30
A ____ is sometimes called a "fingerprint" for an object because it uniquely identifies the object.

A) property
B) hash code
C) derived code
D) new property
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
31
A(n) ____________________ method is one that can be overridden by a method with the same signature in a child class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
32
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
33
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
34
A(n) ____ class is one from which you cannot create concrete objects, but from which you can inherit.

A) abstract
B) concrete
C) base
D) derived
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
35
The entire list of parent classes from which a child class is derived constitutes the ____________________ of the subclass.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
36
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
37
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
38
C# makes implicit conversions when casting one data type to another. When a derived class object is assigned to its ancestor's data type, the conversion can more specifically be called a(n) ___________________________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
39
Briefly describe the similarities and differences between abstract classes and interfaces.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
40
When all base class constructors require arguments, you must include a constructor for each derived class you create. Why?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
41
Match between columns
The ultimate base class for all other types
System.Object
The ultimate base class for all other types
extended class
The ultimate base class for all other types
Equals()
The ultimate base class for all other types
GetType()
The ultimate base class for all other types
reference equality
The ultimate base class for all other types
polymorphism
The ultimate base class for all other types
superclass
The ultimate base class for all other types
sealed class
The ultimate base class for all other types
protected members
Using the same method name to indicate different implementations
System.Object
Using the same method name to indicate different implementations
extended class
Using the same method name to indicate different implementations
Equals()
Using the same method name to indicate different implementations
GetType()
Using the same method name to indicate different implementations
reference equality
Using the same method name to indicate different implementations
polymorphism
Using the same method name to indicate different implementations
superclass
Using the same method name to indicate different implementations
sealed class
Using the same method name to indicate different implementations
protected members
Also known as a derived class
System.Object
Also known as a derived class
extended class
Also known as a derived class
Equals()
Also known as a derived class
GetType()
Also known as a derived class
reference equality
Also known as a derived class
polymorphism
Also known as a derived class
superclass
Also known as a derived class
sealed class
Also known as a derived class
protected members
Returns true if two Object s have the same memory address
System.Object
Returns true if two Object s have the same memory address
extended class
Returns true if two Object s have the same memory address
Equals()
Returns true if two Object s have the same memory address
GetType()
Returns true if two Object s have the same memory address
reference equality
Returns true if two Object s have the same memory address
polymorphism
Returns true if two Object s have the same memory address
superclass
Returns true if two Object s have the same memory address
sealed class
Returns true if two Object s have the same memory address
protected members
A synonym for base class
System.Object
A synonym for base class
extended class
A synonym for base class
Equals()
A synonym for base class
GetType()
A synonym for base class
reference equality
A synonym for base class
polymorphism
A synonym for base class
superclass
A synonym for base class
sealed class
A synonym for base class
protected members
Can be used by a class and its descendants
System.Object
Can be used by a class and its descendants
extended class
Can be used by a class and its descendants
Equals()
Can be used by a class and its descendants
GetType()
Can be used by a class and its descendants
reference equality
Can be used by a class and its descendants
polymorphism
Can be used by a class and its descendants
superclass
Can be used by a class and its descendants
sealed class
Can be used by a class and its descendants
protected members
A class that cannot be extended
System.Object
A class that cannot be extended
extended class
A class that cannot be extended
Equals()
A class that cannot be extended
GetType()
A class that cannot be extended
reference equality
A class that cannot be extended
polymorphism
A class that cannot be extended
superclass
A class that cannot be extended
sealed class
A class that cannot be extended
protected members
Returns a string containing an object's class
System.Object
Returns a string containing an object's class
extended class
Returns a string containing an object's class
Equals()
Returns a string containing an object's class
GetType()
Returns a string containing an object's class
reference equality
Returns a string containing an object's class
polymorphism
Returns a string containing an object's class
superclass
Returns a string containing an object's class
sealed class
Returns a string containing an object's class
protected members
Occurs when two reference type objects refer to the same object
System.Object
Occurs when two reference type objects refer to the same object
extended class
Occurs when two reference type objects refer to the same object
Equals()
Occurs when two reference type objects refer to the same object
GetType()
Occurs when two reference type objects refer to the same object
reference equality
Occurs when two reference type objects refer to the same object
polymorphism
Occurs when two reference type objects refer to the same object
superclass
Occurs when two reference type objects refer to the same object
sealed class
Occurs when two reference type objects refer to the same object
protected members
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
42
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.