• Home
  • Textbooks
  • Microsoft Visual C# 2017: An Introduction to Object-Oriented Programming
  • Introduction to Inheritance

Microsoft Visual C# 2017: An Introduction to Object-Oriented Programming

Joyce Farrell

Chapter 10

Introduction to Inheritance - all with Video Answers

Educators


Chapter Questions

00:44

Problem 1

Specific types of objects assume features of more general classes through ___________
a. polymorphism
c. encapsulation
b. inheritance
d. structure

Aditya Sood
Aditya Sood
Numerade Educator

Problem 2

Which of the following is not a benefit of using inheritance when creating a new class?
a. You save computer memory because when you create objects of the new class, storage is not required for parent class fields.
b. You reduce the chance of errors, because the parent class methods have already been used and tested.
c. You make it easier for anyone who has used the parent class to understand the new class because the programmer can concentrate on the new features.
d. You save time, because you need not create fields and methods that already exist in a parent class.

Check back soon!

Problem 3

A child class is also called a(n) ___________ .
a. extended class
c. superclass
b. base class
d. delineated class

Check back soon!

Problem 4

Assuming that the following classes are well named, which of the following is a parent class of House?
a. Apartment
c. Building
b. VictorianHouse
d. myHouse

Check back soon!

Problem 5

A derived class usually contains ___________ than its parent.
a. more fields and methods
b. the same number of fields but fewer methods
c. fewer fields but more methods
d. fewer fields and methods

Check back soon!

Problem 6

When you create a class that is an extension or child of another class, you use a(n) ___________ between the derived class name and its base class name.
a. ampersand
c. dot
b. hyphen
d. colon

Check back soon!

Problem 7

A base class named Garden contains a private field width and a property public int Width that contains get and set accessors. A child class named VegetableGarden does not contain a Width property. When you write a class in which you declare an object as follows, what statement can you use to access the VegetableGarden's width?
a. VegetableGarden myGarden = new VegetableGarden();
b. myGarden.Width
c. myGarden.base.Width
d. VegetableGarden. Width
e. You cannot use Width with a VegetableGarden object.

Check back soon!
01:38

Problem 8

When a parent class contains a private data field, the field is ___________ the child class.
a. hidden in
c. directly accessible in
b. not a member of
d. public in

Aditya Sood
Aditya Sood
Numerade Educator

Problem 9

When a base class and a derived class contain a method with the same name and parameter list, and you call the method using a derived class object, ___________
a. you receive an error message
b. the base class version overrides the derived class version
c. the derived class version overrides the base class version
d. both method versions execute

Check back soon!
01:38

Problem 10

Which of the following is an English-language form of polymorphism?
a. seeing a therapist and seeing the point
b. moving friends with a compelling story and moving friends to a new apartment
c. both of these
d. neither of these

Alexa Moschella
Alexa Moschella
Numerade Educator

Problem 11

When base and derived classes contain a method with the same name and parameter list, you can use the base class method within the derived class by using the keyword ___________ before the method name.
a. new
c. base
b. override
d. super

Check back soon!

Problem 12

In a program that declares a derived class object, you $\qquad$ assign it to an object of its base class type.
a. can
c. must
b. cannot
d. should not

Check back soon!
00:50

Problem 13

The root base class for all other class types is ___________ .
a. Base
c. Parent
b. Super
d. Object

Aditya Sood
Aditya Sood
Numerade Educator

Problem 14

All of the following are Object class methods except ___________ .
a. ToString()
c. Print()
b. Equals()
d. GetHashCode()

Check back soon!

Problem 15

When you create any derived class object, ___________ .
a. the base class and derived class constructors execute simultaneously
b. the base class constructor must execute first, and then the derived class constructor executes
c. the derived class constructor must execute first, and then the base class constructor executes
d. neither the base class constructor nor the derived class constructor executes

Check back soon!

Problem 16

When a base class constructor requires arguments, then each derived class ___________
a. must include a constructor
b. must include a constructor that requires arguments
c. must include two or more constructors
d. must not include a constructor

Check back soon!

Problem 17

When you create an abstract class, ___________ .
a. you can inherit from it
b. you can create concrete objects from it
c. Both of these are true.
d. None of these is true.

Check back soon!

Problem 18

When you create an abstract method, you provide ___________ -
a. the keyword abstract
c. method statements
b. curly braces
d. all of these

Check back soon!
01:52

Problem 19

Within an interface, ___________
a. no methods can be abstract
b. some methods might be abstract
c. some, but not all, methods must be abstract
d. all methods must be abstract

Manik Pulyani
Manik Pulyani
Numerade Educator
01:52

Problem 20

Abstract classes and interfaces are similar in that ___________ .
a. you can instantiate concrete objects from both
b. you cannot instantiate concrete objects from either one
c. all methods in both must be abstract
d. neither can contain nonabstract methods

Manik Pulyani
Manik Pulyani
Numerade Educator