Object-orientated programming Flashcards
____ is a template that defines structure of objects.
Class
Object
Instance
Method
Class
___ is a container of related information and a set of operations to manipulate that info.
Class
Object
Insantiation
Interface
Object
___ is a unique object created from a class.
Attribute
Instance
Instance Variable
Instantiation
Instance
___ is the process of creating an object from a class definition.
Attribute
Instance
Instance Variable
Instantiation
Instantiation
____ is a variable that holds data about the state of an object.
Attribute
Instance
Instance Variable
Instantiation
Attribute
____ is another name for attribute.
Attribute
Instance
Instance Variable
Instantiation
Instance variable
____ is a function that works with object’s internal data and provides services to external code.
Class
Interface
Accessor
Method
Method
___ is a description of actions an object can do, or services it can provide to clients.
Class
Interface
Accessor
Method
Interface
____ is a method that returns a private instance variable.
Class
Interface
Accessor
Method
Accessor
___ is a method that allows controlled modifications to private instance variable.
Instance
Interface
Mutator
Accessor
Mutator
____ is wrapping the data and code acting on that data, together as a single unit.
Class
Object
Instance
Encapsulation
Encapsulation
Object-orientated programming allows us to hide the object’s data attributes from code that is outside the object.
TRUE
FALSE
TRUE
Procedures operate on data items that separate from the procedures.
TRUE
FALSE
TRUE
An object is a stand-alone program but is used by programs that need its service.
TRUE
FALSE
FALSE
All instances of a class share the same values of the data attributes in the class.
TRUE
FALSE
FALSE
The self parameter need not be named self but it is strongly recommended to do so, to conform with standard practice.
TRUE
FALSE
TRUE
Which section in the UML class diagram holds the list of the class’s data attributes?
first section
second section
third section
fourth section
second 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?
class
setter
mutator
accessor
accessor
Which attributes belong to a specific instance of a class?
data
object
self
instance
instance
Which method is automatically executed when an instance of a class in created in memory?
__obj__
__state__
__str__
__init__
__init__
Combining data and code in a single object is known as
objectification
modularity
encapsulation
instantiation
encapsulation
Mutator methods are also known as
getters
instances
attributes
setters
setters
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 reference to the object
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
identify the classes needed
Which is the first line needed when creating a class named Worker?
import random class Worker: def worker_pay(self): def\_\_init\_\_(self)
class Worker:
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
worker_joey = Worker()