Unit 3 Flashcards

(10 cards)

1
Q

A subclass is usually:

A

more specialized than its superclass

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

An object is characterized by the following three:

A

name, properties, activites

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

An alternative name for a data structure calls a stack is:

A

LIFO

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

A variable that exists as a separate being in separate objects is called:

A

an instance variable

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

A function able to check if an object is equipped with a given property is named:

A

hasattr()

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

Is there a way to check if a class is a subclass of another class?

A

yes, there is a function able to do that

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

The function named super() may be used to:

A

access a super class’s attributes and/or methods

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

A user defined exception

A

may be derived from the exception class

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

Which two are true?

A

A. the args property is a tuple designed to gather all arguments passed to the class constructor.

B. The finally branch of the try statement is always executed.

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

What is the output of the following?

import math

try:
print(math.pow(2))
except TypeError:
print(“A”)
else:
print(“B”)

A

A

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