Deck 10: Introduction to Inheritance

ملء الشاشة (f)
exit full mode
سؤال
A superclass contains all the fields and methods of its subclasses as well as its own more specific fields and methods.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
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
سؤال
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.
سؤال
What keyword is an alias for the System.Object class?

A) object
B) base
C) super
D) parent
سؤال
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
سؤال
A class's ToString() method is often a useful debugging aid.
سؤال
What is another name for a base class in C#?

A) derived class
B) parent class
C) extended class
D) child class
سؤال
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
سؤال
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
سؤال
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
سؤال
What term is synonymous with a derived class?

A) parent class
B) superclass
C) base class
D) subclass
سؤال
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.
سؤال
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.
سؤال
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.
سؤال
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
سؤال
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"
سؤال
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
سؤال
The Equals() method compares two objects and returns true if they have the same value.
سؤال
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
سؤال
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.
سؤال
Explain the sequence of constructors that will be called when you create an object that is an instance of a derived class.
سؤال
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
سؤال
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()
سؤال
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()
سؤال
What 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 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?
سؤال
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
سؤال
Briefly describe the four public instance methods of the Object class.
سؤال
When all base class constructors require arguments, you must include a constructor for each derived class you create.Why?
سؤال
Briefly describe the similarities and differences between abstract classes and interfaces.
سؤال
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.
سؤال
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
سؤال
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.
سؤال
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
سؤال
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?
سؤال
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?
سؤال
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
سؤال
What are the requirements for overloading the Object class's Equals() method?
سؤال
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?
سؤال
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 Deck
1/40
auto play flashcards
العب
simple tutorial
ملء الشاشة (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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
6
A class's ToString() method is often a useful debugging aid.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
11
What term is synonymous with a derived class?

A) parent class
B) superclass
C) base class
D) subclass
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
18
The Equals() method compares two objects and returns true if they have the same value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
28
Briefly describe the four public instance methods of the Object class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
29
When all base class constructors require arguments, you must include a constructor for each derived class you create.Why?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
30
Briefly describe the similarities and differences between abstract classes and interfaces.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
38
What are the requirements for overloading the Object class's Equals() method?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.