Object-orientated programming Flashcards

1
Q

____ is a template that defines structure of objects.

Class
Object
Instance
Method

A

Class

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

___ is a container of related information and a set of operations to manipulate that info.

Class
Object
Insantiation
Interface

A

Object

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

___ is a unique object created from a class.

Attribute
Instance
Instance Variable
Instantiation

A

Instance

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

___ is the process of creating an object from a class definition.

Attribute
Instance
Instance Variable
Instantiation

A

Instantiation

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

____ is a variable that holds data about the state of an object.

Attribute
Instance
Instance Variable
Instantiation

A

Attribute

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

____ is another name for attribute.

Attribute
Instance
Instance Variable
Instantiation

A

Instance variable

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

____ is a function that works with object’s internal data and provides services to external code.

Class
Interface
Accessor
Method

A

Method

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

___ is a description of actions an object can do, or services it can provide to clients.

Class
Interface
Accessor
Method

A

Interface

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

____ is a method that returns a private instance variable.

Class
Interface
Accessor
Method

A

Accessor

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

___ is a method that allows controlled modifications to private instance variable.

Instance
Interface
Mutator
Accessor

A

Mutator

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

____ is wrapping the data and code acting on that data, together as a single unit.

Class
Object
Instance
Encapsulation

A

Encapsulation

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

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

TRUE
FALSE

A

TRUE

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

Procedures operate on data items that separate from the procedures.

TRUE
FALSE

A

TRUE

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

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

TRUE
FALSE

A

FALSE

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

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

TRUE
FALSE

A

FALSE

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

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

TRUE
FALSE

A

TRUE

17
Q

Which section in the UML class diagram holds the list of the class’s data attributes?

first section
second section
third section
fourth section

A

second section

18
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?

class
setter
mutator
accessor

A

accessor

19
Q

Which attributes belong to a specific instance of a class?

data
object
self
instance

A

instance

20
Q

Which method is automatically executed when an instance of a class in created in memory?

__obj__
__state__
__str__
__init__

A

__init__

21
Q

Combining data and code in a single object is known as

objectification
modularity
encapsulation
instantiation

A

encapsulation

22
Q

Mutator methods are also known as

getters
instances
attributes
setters

A

setters

23
Q

What an object is passed as an argument. ___ is passed into the parameter variable.

a reference to the object’s state
a reference to the object
Objects cannot be passed as arguments
a copy of the object

A

a reference to the object

24
Q

In object-orientated programming, one of the first tasks of the programmer is to

list the nouns in the problem
list the methods that are needed
identify the objects needed
identify the classes needed

A

identify the classes needed

25
Q

Which is the first line needed when creating a class named Worker?

import random
class Worker:
def worker_pay(self):
def\_\_init\_\_(self)
A

class Worker:

26
Q

Which of the following will create an object, worker_joey, of the Worker class?

class worker_joey:
worker_joey = Worker()
def\_\_init\_\_(worker_joey):
worker_joey:Worker
A

worker_joey = Worker()