C# Quiz 11
Every class in C#, except __________, extends an existing class.
object
A method must be declared __________ for it to be overridden by derived classes.
virtual
A "copy and paste" approach is a simple and efficient way from a software engineering perspective of providing functionality that exists in other classes.
False
A base class may have only one derived class.
False
A base class's constructors are inherited into its derived classes.
False
A derived class is often larger and more general than its base class.
False
An object of one class cannot be an object of another class.
False
To enhance performance and reduce errors, it's a good idea to make derived classes larger than they need to be.
False
Which of the following is not a base/derived class relationship?
Sailboat/Tugboat
A class that inherits from another class is referred to as the derived class.
True
A derived class can effect state changes in base class private members only through public, protected, internal methods provided in the base class and inherited into the derived class.
True
Constructors are not inherited.
True
Inheritance preserves the integrity of a base class.
True
The process of abstraction allows you to focus on the commonalities among objects in the system.
True
When a base class method is overridden in a derived class, it is common to have the derived class version call the base class version and do some additional work.
True
When a program creates a derivedclass object, the object constructor is the last constructor called and the first whose body finishes executing.
True
When creating derived classes, you must use discretion in choosing the proper base class. Ideally, the base class will not contain excessive capabilities or information.
True
private fields of a base class can be accessed in a derived class
by calling public or protected methods declared in the base class
Which of the following pairs demonstrates the has a relationship between the first and the second terms?
house, window
A class inherited from two or more levels up in the hierarchy is known as a _________.
indirect base class
To avoid duplicating code (and possibly errors), use ________, rather than ________.
inheritance, the "copy and paste" approach.
A derived class cannot access the _________ members of its base class.
private
Base class methods with this level of access cannot be called from derived classes.
private
Which base class members are inherited by all derived classes of that base class?
protected instance variables and methods
When a derived class constructor calls its base class constructor, what happens if the base class's constructor does not assign a value to an instance variable?
the program compiles and runs correctly because the instance variables are initialized to their default values