Exam 10: Introduction to Inheritance
Exam 1: A First Program Using C42 Questions
Exam 2: Using Data42 Questions
Exam 3: Using Gui Objects and the Visual Studio Ide42 Questions
Exam 4: Making Decisions42 Questions
Exam 5: Looping42 Questions
Exam 6: Using Arrays42 Questions
Exam 7: Using Methods42 Questions
Exam 8: Advanced Method Concepts42 Questions
Exam 9: Using Classes and Objects42 Questions
Exam 10: Introduction to Inheritance42 Questions
Exam 11: Exception Handling42 Questions
Exam 12: Using Controls42 Questions
Exam 13: Handling Events41 Questions
Exam 14: Files and Streams42 Questions
Select questions type
Classes that depend on field names from parent classes are said to be ____ because they are prone to errors.
Free
(Multiple Choice)
4.8/5
(39)
Correct Answer:
C
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.
Free
(Essay)
4.9/5
(34)
Correct Answer:
When a derived class contains a method or property that overrides a parent class method or property, you might have occasion to use the parent class version within the subclass. If so, you can use the keyword base to access the parent class method or property. For example:
class CommissionEmployee : Employee
{
new public string GetGreeting(
{
string greeting = base.GetGreeting();
greeting += "\nI work on commission.");
return greeting;
}
}
A(n) ____ class is one from which you cannot create concrete objects, but from which you can inherit.
Free
(Multiple Choice)
4.8/5
(30)
Correct Answer:
A
A base class member that is not hidden by the derived class is ____ in the derived class.
(Multiple Choice)
4.9/5
(24)
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.
(True/False)
4.8/5
(41)
Briefly describe the four public instance methods of the Object class.
(Essay)
4.8/5
(34)
The ability to inherit from more than one class is called ____.
(Multiple Choice)
4.8/5
(30)
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.
(Multiple Choice)
4.8/5
(37)
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?
(Essay)
4.7/5
(35)
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.
(True/False)
4.9/5
(32)
Every class you create in C# derives from a single class named ____.
(Multiple Choice)
4.8/5
(36)
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.
(Multiple Choice)
4.8/5
(34)
The entire list of parent classes from which a child class is derived constitutes the ____________________ of the subclass.
(Short Answer)
4.9/5
(37)
The keyword ____ always refers to the superclass of the class in which you use it.
(Multiple Choice)
4.8/5
(42)
A superclass contains all the fields and methods of its subclasses as well as its own more specific fields and methods.
(True/False)
4.7/5
(41)
When all base class constructors require arguments, you must include a constructor for each derived class you create. Why?
(Essay)
4.8/5
(28)
Inheritance is ____________________, which means a child inherits all the members of all its ancestors.
(Short Answer)
4.9/5
(37)
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?
(Essay)
5.0/5
(40)
Showing 1 - 20 of 42
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)