1
Q

What are the components of an objects?

A
  • State

- Method

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

Where is the state stored?

A

The state of an object is stored in instance variables

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

What is a state of an object?

A

These are the attributes that define an object.

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

What are the methods of an objects?

A

These are the actions that an object can perform.

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

How do you define a class with name X?

A
class X:
    """ X class for representing X states and has X methods"""
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What method should every class have?

A

__init__

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

What is the initializer method/constructor? Wjhat is its role?

A

A method that is automactically called when a new instance of a given class is called.

It allows programmers to set up attributes within the new instance by giving them initial values.

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

What is the syntax for the constructor?

A
def \_\_init\_\_(self):
    self.X = x

NOTE:
X = name of attribute
x = initial value of attribute

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

What is the convention when referring to the object in the initializer?

A

The self parameter is the convention.

NOTE: Technically can be anything though

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

What is the name of a function that creates a new object instance?

A

A constructor

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

What is the name of the combined process of initializing a new object and setting its initial values?

A

Instantiation

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

What are magic methods?

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

What does self. refer to?

A

Refers to the object being instantiated

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