Python Classes and Recursion Flashcards

1
Q

object

A

In programming, an object is a grouping of data (variables) and operations that can be performed on that data (functions or methods).

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

encapsulation

A

aka Abstraction / information hiding

when a user interacts with an object at a high level, allowing lower-level internal details to remain hidden (aka information hiding or encapsulation).

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

abstract data type / ADT

A

An abstract data type (ADT) is a data type whose creation and update are constrained to specific well-defined operations.

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

built-in

A

objects that Python automatically creates for a programmer to use and include the basic data types like integers and strings.

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

class

A

used to create a user-defined type of object containing groups of related variables and functions.

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

attributes

A

determines the data and behavior of the class for objects.

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

instantiation

A

Defining a new class variable by ‘calling’ the class, using parentheses like a function call as in my_time = Time().

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

instance

A

an individual object of the given class.

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

method

A

A method is a function defined within a class.

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

constructor

A

__init__
responsible for setting up the initial state of the new instance.

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

attribute reference operator /
member operator /
dot notation

A

Attributes can be accessed using the attribute reference operator ‘.’ (sometimes called the member operator or dot notation).

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

instance method

A

A function defined within a class is known as an instance method.

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

special method name

A

A special method name, indicating that the method implements some special behavior of the class, identified with the double underscore
__init__ - initializer/constructor

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

class object

A

A class object acts as a factory that creates instance objects.

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

instance object

A

When created by the class object, an instance object is initialized via the __init__ method.

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

class attribute

A

A class attribute is shared among all instances of that class.

17
Q

instance attribute

A

An instance attribute can be unique to each instance.

18
Q

class interface

A

A class interface consists of the methods that a programmer calls to create, modify, or access a class instance.

19
Q

abstract data type (ADT)

A

A class can be used to implement the computing concept known as an abstract data type (ADT), whose creation and update are constrained to specific, well-defined operations (the class interface).

20
Q

Class customization

A

Class customization is the process of defining how an instance of a class should behave for some common operations. Such operations might include printing, accessing attributes, or how instances of that class are compared to each other.

21
Q

special method names

A

To customize a class, a programmer implements instance methods with special method names that the Python interpreter recognizes.

22
Q

operator overloading

A

Class customization can redefine the functionality of built-in operators like <, >=, +, -, and * when used with class instances, a technique known as operator overloading.

23
Q

rich comparison methods

A

Methods like __lt__ above are known as rich comparison methods.

24
Q

isinstance()

A

To handle subtraction of arbitrary object types, the built-in isinstance() function can be used.

25
memory allocation
The process of an application requesting and being granted memory is known as memory allocation.
26
Memory deallocation
Memory deallocation is the act of freeing the memory that stores variables or objects in a program.
27
reference count
A reference count is an integer counter that represents how many variables reference an object.
28
recursive function
A function that calls itself is known as a recursive function.
29
base case
The recursive function has an if-else statement, where the if branch is the end of the recursion, known as the base case. The else part has the recursive calls.
30
depth
The depth of recursion is a measure of how many recursive calls of a function have been made, but have not yet returned.