Deck 10: Classes and Object-Oriented Programming

Full screen (f)
exit full mode
Question
Object-oriented programming allows us to hide the object's data attributes from code that is outside the object.
Use Space or
up arrow
down arrow
to flip the card.
Question
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
Question
Procedures operate on data items that are separate from the procedures.
Question
The self parameter need not be named self but it is strongly recommended to do so,to conform with standard practice.
Question
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__
Question
Which method is automatically executed when an instance of a class is created in memory?

A) __state__
B) __obj__
C) __str__
D) __init__
Question
All class definitions are stored in the library so that they can be imported into any program.
Question
All instances of a class share the same values of the data attributes in the class.
Question
A class can be thought of as a blueprint that can be used to create an object.
Question
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
Question
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
Question
A mutator method has no control over the way that a class's data attributes are modified.
Question
Which attributes belong to a specific instance of a class?

A) instance
B) self
C) object
D) data
Question
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__
Question
What does the acronym UML stand for?

A) Unified Modeling Language
B) United Modeling Language
C) Unified Model Language
D) Union of Modeling Languages
Question
What type of programming contains class definitions?

A) procedural
B) top-down
C) object-oriented
D) modular
Question
In a UML diagram the first section holds the list of the class's methods.
Question
The procedures that an object performs are called

A) methods
B) actions
C) modules
D) instances
Question
The self parameter is required in every method of a class.
Question
An object is a stand-alone program but is used by programs that need its service.
Question
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
Question
The instance attributes are created by the __________ parameter and they belong to a specific instance of the class.
Question
In object-oriented programming,one of first tasks of the programmer is to

A) list the nouns in the problem
B) list the methods that are needed
C) identify the classes needed
D) identify the objects needed
Question
Mutator methods are also known as

A) setters
B) getters
C) instances
D) attributes
Question
In ___________ programming,the programming is centered on objects that are created from abstract data types that encapsulate data and functions together.
Question
Combining data and code in a single object is known as

A) modularity
B) instantiation
C) encapsulation
D) objectification
Question
A class __________ is a set of statements that defines a class's methods and data attributes.
Question
An object's __________ contains the values of the object's attributes at a given moment.
Question
Each object that is created from a class is called a(n)__________ of the class.
Question
___________ provides a set of standard diagrams for graphically depicting object-oriented systems.
Question
When an object is passed as an argument,__________ is passed into the parameter variable.

A) a copy of the object
B) a reference to the object's state
C) a reference to the object
D) Objects cannot be passed as arguments.
Question
A method that returns a value from a class's attribute but does not change it is known as a(n)__________ method.
Question
___________ programming is a method of writing software that centers on the actions that take place in a program.
Question
A(n)__________ method in a class initializes an object's data attributes.
Question
Which is the first line needed when creating a class named Worker?

A) def__init__(self):
B) class Worker:
C) import random
D) def worker_pay(self):
Question
Accessor methods are also known as

A) setters
B) getters
C) instances
D) attributes
Question
A(n)__________ is code that specifies the data attributes and methods for a particular type of object.
Question
Which of the following will create an object,worker_joey,of the Worker class?

A) def__init__(worker_joey):
B) class worker_joey:
C) worker_joey = Worker()
D) worker_joey.Worker
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/38
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 10: Classes and Object-Oriented Programming
1
Object-oriented programming allows us to hide the object's data attributes from code that is outside the object.
True
2
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
C
3
Procedures operate on data items that are separate from the procedures.
True
4
The self parameter need not be named self but it is strongly recommended to do so,to conform with standard practice.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
5
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__
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
6
Which method is automatically executed when an instance of a class is created in memory?

A) __state__
B) __obj__
C) __str__
D) __init__
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
7
All class definitions are stored in the library so that they can be imported into any program.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
8
All instances of a class share the same values of the data attributes in the class.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
9
A class can be thought of as a blueprint that can be used to create an object.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
10
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
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
11
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
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
12
A mutator method has no control over the way that a class's data attributes are modified.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
13
Which attributes belong to a specific instance of a class?

A) instance
B) self
C) object
D) data
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
14
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__
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
15
What does the acronym UML stand for?

A) Unified Modeling Language
B) United Modeling Language
C) Unified Model Language
D) Union of Modeling Languages
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
16
What type of programming contains class definitions?

A) procedural
B) top-down
C) object-oriented
D) modular
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
17
In a UML diagram the first section holds the list of the class's methods.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
18
The procedures that an object performs are called

A) methods
B) actions
C) modules
D) instances
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
19
The self parameter is required in every method of a class.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
20
An object is a stand-alone program but is used by programs that need its service.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
21
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
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
22
The instance attributes are created by the __________ parameter and they belong to a specific instance of the class.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
23
In object-oriented programming,one of first tasks of the programmer is to

A) list the nouns in the problem
B) list the methods that are needed
C) identify the classes needed
D) identify the objects needed
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
24
Mutator methods are also known as

A) setters
B) getters
C) instances
D) attributes
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
25
In ___________ programming,the programming is centered on objects that are created from abstract data types that encapsulate data and functions together.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
26
Combining data and code in a single object is known as

A) modularity
B) instantiation
C) encapsulation
D) objectification
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
27
A class __________ is a set of statements that defines a class's methods and data attributes.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
28
An object's __________ contains the values of the object's attributes at a given moment.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
29
Each object that is created from a class is called a(n)__________ of the class.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
30
___________ provides a set of standard diagrams for graphically depicting object-oriented systems.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
31
When an object is passed as an argument,__________ is passed into the parameter variable.

A) a copy of the object
B) a reference to the object's state
C) a reference to the object
D) Objects cannot be passed as arguments.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
32
A method that returns a value from a class's attribute but does not change it is known as a(n)__________ method.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
33
___________ programming is a method of writing software that centers on the actions that take place in a program.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
34
A(n)__________ method in a class initializes an object's data attributes.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
35
Which is the first line needed when creating a class named Worker?

A) def__init__(self):
B) class Worker:
C) import random
D) def worker_pay(self):
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
36
Accessor methods are also known as

A) setters
B) getters
C) instances
D) attributes
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
37
A(n)__________ is code that specifies the data attributes and methods for a particular type of object.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the following will create an object,worker_joey,of the Worker class?

A) def__init__(worker_joey):
B) class worker_joey:
C) worker_joey = Worker()
D) worker_joey.Worker
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 38 flashcards in this deck.