Ch.11 More Object-Oriented Programming Concepts Review Questions

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

When you instantiate an object, the automatically created method that is called is a(n)_________________ a. creator b. initiator c. architect d. constructor

d. constructor

Employing inheritance reduces errors because_____________ . a. the new classes have access to fewer data fields b. the new classes have access to fewer methods c. you can copy and paste methods that you already created d. many of the methods you need have already been used and tested

d. many of the methods you need have already been used and tested

Which of the following is not another name for a derived class? a. extended class b. superclass c. child class d. subclass

d. subclass

Which of the following is true? a. A derived class inherits all the data and methods of its ancestors. b. A derived class inherits only the public data and methods of its ancestors. c. A derived class inherits only the private data and methods of its ancestors. d. A derived class inherits none of the data and methods of its ancestors.

a. A derived class inherits all the data and methods of its ancestors.

Advantages of creating a class that inherits from another include all of the following except: a. You save time because subclasses are created automatically from those that come built in as part of a programming language. b. You save time because you need not re-create the fields and methods in the original class. c. You reduce the chance of errors because the original class's methods have already been used and tested. d. You make it easier for anyone who has used the original class to understand the new class.

a. You save time because subclasses are created automatically from those

The general principle of exception handling in object-oriented programming is that a method that uses data should__________________ . a. be able to detect errors, but not be required to handle them b. be able to handle errors, but not detect them c. be able to handle and detect errors d. not be able to detect or handle errors

a. be able to detect errors, but not be required to handle them

When you write a constructor that receives a parameter,______________________ a. the parameter must be numeric b. the parameter must be used to set a data field c. the automatically created default constructor no longer exists d. the constructor body must be empty

a. the parameter must be numeric

An environment in which you can develop GUI programs by dragging components to their desired positions is a(n)_____________ . a. visual development environment b. integrated compiler c. text-based editor d. GUI formatter

a. visual development environment

Which of the following is true? a. A base class usually has more fields than its descendent. b. A child class can also be a parent class. c. A class's ancestors consist of its entire list of children. d. To be considered object-oriented, a class must have a child.

b. A child class can also be a parent class

Which of the following is true? a. A class's data fields usually are public. b. A class's methods usually are public. c. both of the above d. none of the above

b. A class's methods usually are public.

Most often, a destructor is called when________________ . a. an object is created b. an object goes out of scope c. you make an explicit call to it d. a value is returned from a class method

b. an object goes out of scope

Every class has_____________________. a. exactly b. at least one constructor c.as least constructors d. a default constructor and a programmer-written constructor

b. at least one constructor

Which of the following is another name for a derived class? a. base class b. child class c. superclass d. parent class

b. child class

A class that is used as a basis for inheritance is called a_____________ . a. derived class b. subclass c. child class d. base class

b. subclass

When you write a constructor that receives no parameters,_____________ . a. the automatically created constructor no longer exists b. it becomes known as the default constructor c. both of the above d. none of the above

c. both of the above

Which of the following can be overloaded? a. constructors b. instance methods c. both of the above d. none of the above

c. both of the above

In object-oriented programs, errors are known as_____________. a. faults b. gaffes c. exceptions d. omissions

c. exceptions

A________________is a collection of predefined, built-in classes that you can use when writing programs. a. vault b. black box c. library d. store

c. library

Every default constructor______________________. a. is automatically created b. sets a default value for every field in a class c. requires no parameters d. is the only constructor that is explicitly written in a class

c. requires no parameters

Which of the following is not a similarity between constructors and destructors? a. Both can be called automatically. b. Both have the same name as the class. c. Both have no return type. d. Both can be overloaded.

d. Both can be overloaded


संबंधित स्टडी सेट्स

Management 3490 Exam 3 (ch. 8,11, 13, 14)

View Set

Chapter 37: Alterations of Musculoskeletal Function Study Questions

View Set

Ch. 23: Respiratory System (Learnsmart Quiz)

View Set