Chapter 11 – Exam Questions | Inheritance, Polymorphism, And - Test Bank | Visual C# 5e by Tony Gaddis. DOCX document preview.

Chapter 11 – Exam Questions | Inheritance, Polymorphism, And

Starting Out with Visual C#, 5e (Tony Gaddis)

Chapter 11 Inheritance, Polymorphism, and Interfaces

TRUE/FALSE

1. When an "is a" relationship exists between objects, it means that the specialized object has all of the characteristics of the general object plus additional characteristics that make it unique.

2. Inheritance involves a base class and a relative class.

3. You can think of a derived class as an extended version of some base class.

4. New fields, properties, and methods cannot be added to a derived class unless these elements already exist in the base class.

5. When designing an object-oriented program, the best approach is to define a base class to hold all the general data about a group of similar objects and then define derived classes for each specific type of object.

6. Only methods in a derived class can directly access the base class's private members.

7. When program code instantiates a derived class object, the base class constructor executes first, followed by the derived class constructor.

8. If a base class does not have a parameterless constructor, its derived class constructor must use the notation base(parameterList) to call one of the base class's constructors.

9. If a reference to a base class object calls a method that has been overridden by a derived class, the derived class's version of the method is the one that executes.

10. Properties in a base class can be overridden in the same way that methods can be overridden.

11. If a derived class introduces additional methods, properties, or fields, a base class reference variable cannot access them.

12. You cannot assign a base class reference to a derived class variable.

13. A method that accepts a base class variable as a parameter cannot accept a derived class variable as a parameter.

14. A class that is not intended to be instantiated but is to be used only as a base class is called a concrete class.

15. A statement that tries to use the new operator to instantiate an abstract class will not compile.

16. If you want to create an abstract read-only property, leave out the set accessor.

17. An extension method is a static method that extends an existing class or data type.

18. An extension method can only have one parameter.

19. All the parameters in an extension method must be preceded by the this keyword.

20. Extension methods can be applied to classes, structs, and interfaces.

21. An interface specifies behavior for a class.

22. An interface cannot be instantiated but rather is implemented by other classes.

23. An interface specifies methods and properties that a class must have and also specifies how that class must implement those methods and properties.

24. When declaring a class that inherits from a base class and implements an interface, the name of the base class must appear first after the colon in the derived class header.

MULTIPLE CHOICE

1. Which of the following is a specialized version of a generalized food substance?

a.

pizza

c.

ice cream

b.

chocolate

d.

all of these

2. When one object is a specialized version of another object, there is a(n) __________.

a.

1:1 ratio

c.

"has a" relationship

b.

"is a" relationship

d.

shared interest

3. In object-oriented programming, __________ is used to create an "is a" relationship among classes.

a.

inheritance

b.

progression

c.

logic

d.

elimination

4. In object-oriented programming, the __________ is more general than classes related to it.

a.

container class

b.

default design

c.

base class

d.

derived class

5. The __________ inherits fields, properties, and methods from the base class without any of them having to be rewritten.

a.

super instance

c.

initialized object

b.

derived class

d.

copy class

6. Base classes are sometimes called superclasses and derived classes are sometimes called __________.

a.

planned classes

c.

derivatives

b.

copy classes

d.

subclasses

7. Which of the following is a class header that indicates a class named Amphibian is being defined and it is derived from the Animal class?

a.

Amphibian : Animal

c.

Animal -> Amphibian

b.

Animal(Amphibian)

d.

Amphibian extends Animal

8. When you want to make sure a specific constructor from the base class is used, the derived class constructor must explicitly call the base class constructor using the __________.

a.

base keyword

c.

override method

b.

const keyword

d.

out parameter

9. The __________ keyword declares that a derived class is allowed to override the current method in the base class.

a.

override

b.

class

c.

virtual

d.

static

10. The __________ keyword declares that a method in the derived class overrides a method in the base class.

a.

override

b.

void

c.

new

d.

virtual

11. The term __________ refers to an object's ability to take different forms.

a.

adaptation

c.

portability

b.

polymorphism

d.

code reuse

12. When a derived class method has the same name as a base class method, it is often said that the derived class method __________ the base class method.

a.

shadows

b.

mimics

c.

overrides

d.

terminates

13. To allow a property to be overridden, you must include the virtual keyword in the property's declaration in the __________ class.

a.

constructor

b.

derived

c.

base

d.

virtual

14. To override a property in the __________ you write the override keyword in the property declaration.

a.

parameterized constructor

c.

field declaration

b.

base class

d.

derived class

15. A variable declared as a base class type can only be used to reference members declared in the __________.

a.

derived class

c.

abstract class

b.

base class

d.

parameterless constructor

16. A class that is not intended to be instantiated but is to be used only as a base class is called a(n) __________.

a.

abstract class

b.

dummy class

c.

placeholder

d.

entity class

17. To declare a class as abstract, you use the __________ keyword in the class header.

a.

void

b.

new

c.

abstract

d.

static

18. A class that is not abstract is sometimes called a(n) __________ class.

a.

concrete

b.

base

c.

derived

d.

abstract

19. A(n) __________ method is a method with no body that appears in a base class and must be overridden in a non-abstract derived class.

a.

shadow

b.

base

c.

derived

d.

abstract

20. A(n) __________ property is a property that appears in a base class and must be overridden in a non-abstract derived class.

a.

base

b.

derived

c.

public

d.

abstract

21. Extension methods can not be applied to __________.

a.

structs

b.

ints

c.

classes

d.

Extension methods can be applied to all of these.

22. Which of the following statements is not true about extension methods?

a.

An extension method is a static method.

b.

An extension method always has at least one parameter.

c.

You can one write one extension method in a single static class.

d.

All of these are true about extension methods.

23. The first parameter in an extension method must be preceded by the __________ keyword.

a.

new

b.

static

c.

this

d.

virtual

24. To write the code for a new interface in Visual Studio, first click __________ on the Visual Studio menu bar and then select Add New Item... .

a.

Project

b.

File

c.

Tools

d.

Window

25. An extension method can be added onto a class without __________ the class or inheriting from it.

a.

modifying

c.

renaming

b.

instantiating

d.

using

26. It is recommended to put an extension method's class in its own __________.

a.

space

b.

namespace

c.

source

d.

folder

27. An interface specifies __________ a class.

a.

behavior for

c.

an instance of

b.

a namespace for

d.

the fields of

28. To declare an interface, use the __________ keyword.

a.

public

b.

static

c.

abstract

d.

interface

29. When a class implements an interface, it __________.

a.

agrees to provide all the methods and/or properties specified by the interface

b.

agrees to provide all the methods but not the properties specified by the interface

c.

agrees to provide all the properties but not the methods specified by the interface

d.

None of these statements are true.

Document Information

Document Type:
DOCX
Chapter Number:
11
Created Date:
Aug 21, 2025
Chapter Name:
Chapter 11 Inheritance, Polymorphism, And Interfaces
Author:
Tony Gaddis

Connected Book

Test Bank | Visual C# 5e

By Tony Gaddis

Test Bank General
View Product →

$24.99

100% satisfaction guarantee

Buy Full Test Bank

Benefits

Immediately available after payment
Answers are available after payment
ZIP file includes all related files
Files are in Word format (DOCX)
Check the description to see the contents of each ZIP file
We do not share your information with any third party