Chapter 10 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

TF

New objects are created by invoking a constructor.

A

True

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

TF

Functions that live in objects are called instance variables.

A

False

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

TF

The first parameter of a Python method definition is called ‘this’.

A

False

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

TF

An object may have only one instance variable

A

False

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

TF

In data processing, a collection of information about a person or thing is called a file.

A

False

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

TF

In python class, the constructor is called __Int__.

A

True

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

TF

A docstring is the same thing as a comment.

A

False

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

TF

Instance variables go away once a method terminates.

A

False

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

TF

Method names should always begin with one or two underscores.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
TF
It is considered bad style to directly access an instance variable outside of a class definition.
A

True

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

What Python reserved word starts a class definition?

A

Class

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

A method definition with four formal parameters is generally called with how many actual parameters?

A

Three

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

A method definition is similar to a(n)…

A

Function Definition

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

Within a method definition, the instance variable x could be accessed via which expression?

A

self.x

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

A Python convention for defining methods that are “private” to a class is to begin the method name with…

A

An underscore ( _ )

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

The term applied to hiding details inside class definitions is…

A

encapsulation

17
Q

A Python string literal can span multiple lines if enclosed with…

A
18
Q

In a Button widget, what is the data type of the instance variable active?

A

Bool

19
Q

Which of the following methods is not part of the Button class in this chapter?

A

setLabel

20
Q

Which of the following methods is part of the DieView class in this chapter?

A

setValue