Preview Questions

10.6. Preview Questions#

Complete these questions before class to prepare for the chapter. Use the dropdowns to check your answers.

10.6.1. True or False#

1. In C#, a class can inherit from multiple classes simultaneously.

Answer

False — C# supports single-class inheritance only; multiple interfaces are allowed.

2. private members of a class are accessible only within that class.

Answer

Trueprivate is the most restrictive access modifier.

3. Method overriding in a derived class requires the override keyword.

Answer

True — The base method must be virtual and the derived method uses override.

4. An abstract class can be instantiated directly with new.

Answer

False — Abstract classes cannot be instantiated; you must use a concrete subclass.

5. Polymorphism allows a derived class object to be used as its base class type.

Answer

True — This is the Liskov Substitution Principle in practice.

10.6.2. Multiple Choice#

1. Which access modifier restricts a member to the declaring class only?

a) public
b) protected
c) private
d) internal

Answer

c) privateprivate members are invisible outside the class.

2. In C#, which syntax indicates that a class inherits from another?

a) implements BaseClass
b) extends BaseClass
c) : BaseClass
d) inherits BaseClass

Answer

c) : BaseClass — C# uses : for both inheritance and interface implementation.

3. Which OOP principle bundles data with methods and restricts direct field access?

a) Abstraction
b) Inheritance
c) Encapsulation
d) Polymorphism

Answer

c) Encapsulation — Encapsulation keeps fields private and exposes behavior through methods.

4. To enable method overriding in the derived class, the base method must be marked:

a) abstract
b) virtual
c) override
d) sealed

Answer

b) virtualvirtual allows a derived class to override the method with override.

5. An interface in C# defines:

a) A complete implementation with code
b) A contract of method and property signatures
c) A singleton class
d) A static utility class

Answer

b) A contract of method and property signatures — Interfaces declare what a class must do, not how it does it.

Footnotes