Week 10 Flashcards
A mutator method has no control over the way that a class’s data attributes are modified.
False
In a UML diagram the first section holds the list of the class’s methods.
False
Object-oriented programming allows us to hide the object’s data attributes from code that is outside the object.
True
Procedures operate on data items that are separate from the procedures.
True
All instances of a class share the same values of the data attributes in the class.
False
All class definitions are stored in the library so that they can be imported into any program.
False
The self parameter is required in every method of a class.
True
A class can be thought of as a blueprint that can be used to create an object.
An object is a stand-alone program but is used by programs that need its service.
The self parameter need not be named self but it is strongly recommended to do so, to conform with standard practice.
What does the acronym UML stand for?
a. Unified Modeling Language
b. United Modeling Language
c. Unified Model Language
d. Union of Modeling Languages
Unified modeling language
Which section in the UML holds the list of the class’s data attributes?
a. first section
b. second section
c. third section
d. fourth section
second section
Which section in the UML holds the list of the class’s methods?
a. first section
b. second section
c. third section
d. fourth section
third section
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 could allow them to be changed by code outside the method?
a. accessor
b. mutator
c. setter
d. class
accessors
The procedures that an object performs are called
a. methods
b. actions
c. modules
d. instances
methods
Which attributes belong to a specific instance of a class?
a. instance
b. self
c. object
d. data
instance
What is the special name given to the method that returns a string containing an object’s state?
a. __state__
b. __obj__
c. __str__
d. __init__
__str__
Which method is automatically executed when an instance of a class is created in memory?
a. __state__
b. __obj__
c. __str__
d. __init__
__init__
Which method is automatically called when you pass an object as an argument to the print function?
a. __state__
b. __obj__
c. __str__
d. __init__
__str__
What type of programming contains class definitions?
a. procedural
b. top-down
c. object-oriented
d. modular
object-oriented
Which of the following can be thought of as a self-contained unit that consists of data attributes and the methods that operate on the data attributes?
a. a class
b. an object
c. an instance
d. a module
an object
Combining data and code in a single object is known as
a. modularity
b. instantiation
c. encapsulation
d. objectification
encapsulation
Mutator methods are also known as
a. setters
b. getters
c. instances
d. attributes
setters
Accessor methods are also known as
a. setters
b. getters
c. instances
d. attributes
getters