Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Gaddis Python 2e Chapter 11


 

Download  file with the answers

If you are not a member register here to download this file 


 

Chapter Eleven

MULTIPLE CHOICE

1. A(n) _____ is a set of real-world objects, parties, and major events related to the problem.
a. class
b. problem domain
c. object
d. instance

ANS: B

2. What does the acronym UML stand for?
a. Unified Modeling Language
b. United Modeling Language
c. Unified Model Language
d. United Model Language

ANS: A

3. Which section in the UML holds the list of the class’s data attributes?
a. First
b. Second
c. Third
d. Fourth

ANS: B

4. Which section in the UML holds the list of the class’s methods?
a. First
b. Second
c. Third
d. Fourth

ANS: C

5. What type of method provides a safe way for code outside a class to retrieve the values of attributes, without exposing the attributes in a way that they could be changed by the code outside the method?
a. Accessor
b. Mutator
c. Setter
d. Class

ANS: A

6. What attributes belong to a specific instance of the class?
a. Instance
b. Self
c. Object
d. Data

ANS: A

7. What is the special name given to the method that returns a string containing the object’s state?
a. __state__
b. __obj__
c. __str__
d. __init__

ANS: C

8. Which method is automatically executed when an instance of the class is created in memory?
a. __state__
b. __obj__
c. __str__
d. __init__

ANS: D

9. When a method is called, what does Python make to reference the specific object on which the method is supposed to operate?
a. state variable
b. self parameter
c. object data
d. init procedure

ANS: B

10. What type of programming contains class definitions?
a. Procedural
b. Object
c. Object-oriented
d. Modular

ANS: C

11. What is, conceptually, a self-contained unit that consists of data attributes and methods that operate on the data attributes?
a. Class
b. Object
c. Instance
d. Module

ANS: B

12. What are the procedures that an object performs called?
a. Methods
b. Actions
c. Modules
d. Instances

ANS: A

13. What is the combining of data and code in a single object known as?
a. Modularity
b. Instantiation
c. Encapsulation
d. Objectification

ANS: C

14. What is another name for the mutator methods?
a. Setters
b. Getters
c. Instances
d. Attributes

ANS: A

15. What is another name for the accessor methods?
a. Setters
b. Getters
c. Instances
d. Attributes

ANS: B

TRUE/FALSE

1. True/False: A mutator method has no control over the way that a class’s data attributes are modified.

ANS: F

2. True/False: In a UML diagram, the middle section holds the list of the class’s methods.

ANS: F

3. True/False: Procedures operate on data items that are separate from the procedures.

ANS: T

4. True/False: Object-oriented programming allows us to hide the object’s data attributes from code that is outside the object.

ANS: T

5. True/False: The instances of a class share the data attributes in the class.

ANS: F

6. True/False: A class definition is stored in the library so that it can be imported into any program.

ANS: F

7. True/False: The self parameter need not be named self, but it is strongly recommended to conform with standard practice.

ANS: T

8. True/False: The self parameter is required in every method of a class.

ANS: T

9. True/False: A class might be thought of as a ‘blueprint’ that an object may be created from.

ANS: T

10. True/False: An object is a stand-alone program but is used by programs that need its service.

ANS: F

FILL IN THE BLANK

1. A(n) _______________ is code that specifies the data attributes and methods for a particular type of object.

ANS: class

2. Each object that is created from a class is called a(n) _______________ of the class.

ANS: instance

3. A class _______________ is a set of statements that define a class’s methods and data attributes.

ANS: definition

4. A(n) _______________ method in a class initializes an object’s data attributes.

ANS: initializer

5. An object’s _______________ is simply the values of the object’s attributes at any given moment.

ANS: state

6. The _______________ attributes are created by the self parameter and they belong to a specific instance of the class.

ANS: instance

7. A method that returns a value from a class’s attribute but does not change it is known as a(n) _______________ method.

ANS: accessor

8. _______________ provides a set of standard diagrams for graphically depicting object-oriented systems.

ANS: UML

9. In _______________ programming, the programming is centered on objects that are created from abstract data types that encapsulate data and functions together.

ANS: object-oriented

10. _______________ programming is a method of writing software that centers on the actions that take place in a program.

ANS: Procedural

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!