Week 10 Flashcards

1
Q

A mutator method has no control over the way that a class’s data attributes are modified.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In a UML diagram the first section holds the list of the class’s methods.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Procedures operate on data items that are separate from the procedures.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

All instances of a class share the same values of the data attributes in the class.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

All class definitions are stored in the library so that they can be imported into any program.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The self parameter is required in every method of a class.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A class can be thought of as a blueprint that can be used to create an object.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

An object is a stand-alone program but is used by programs that need its service.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The self parameter need not be named self but it is strongly recommended to do so, to conform with standard practice.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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

A

Unified modeling language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A

second section

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

third section

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

A

accessors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The procedures that an object performs are called
a. methods
b. actions
c. modules
d. instances

A

methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which attributes belong to a specific instance of a class?
a. instance
b. self
c. object
d. data

A

instance

17
Q

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__

A

__str__

18
Q

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

A

__init__

19
Q

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__

A

__str__

20
Q

What type of programming contains class definitions?
a. procedural
b. top-down
c. object-oriented
d. modular

A

object-oriented

21
Q

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

A

an object

22
Q

Combining data and code in a single object is known as
a. modularity
b. instantiation
c. encapsulation
d. objectification

A

encapsulation

23
Q

Mutator methods are also known as
a. setters
b. getters
c. instances
d. attributes

A

setters

24
Q

Accessor methods are also known as
a. setters
b. getters
c. instances
d. attributes

A

getters

25
Q

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.

A
26
Q

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

A
27
Q

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):

A
28
Q

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

A
29
Q

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

A

class

30
Q

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

A

instance

31
Q

A class __________ is a set of statements that defines a class’s methods and data attributes.

A

definition

32
Q

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

A

initializer

33
Q

An object’s __________ contains the values of the object’s attributes at a given moment.

A

state

34
Q

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

A

instance

35
Q

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

A

accessor

36
Q

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

A

object-oriented

37
Q

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

A

procedural

38
Q

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

A

UML

39
Q

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

A