Exam 9: Design With Classes

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Python has a built-in type for rational numbers called rational.

(True/False)
4.8/5
(34)

The str method is a good example of a polymorphic method that appears throughout Python's system of classes.

(True/False)
4.9/5
(36)

In the context of Python objects, what does the pickling process do?

(Multiple Choice)
4.8/5
(40)

The attributes of an object are represented as what type of variables?

(Multiple Choice)
4.9/5
(37)

What are the two parts of a rational number? (Choose two.)

(Multiple Choice)
4.9/5
(36)

As a rule of thumb, when should you include an __eq__ method in a class?

(Multiple Choice)
4.8/5
(35)

Inheritance allows a class to automatically reuse and extend the code of similar but more general classes.

(True/False)
4.8/5
(38)

In Python, when does an object reach the end of its life?

(Multiple Choice)
4.8/5
(33)

The Python interpreter picks out equality from the other comparisons by looking for an __equals__ method when it encounters the == and != operators.

(True/False)
5.0/5
(36)

A method automatically returns the value None when it includes no return statement.

(True/False)
5.0/5
(39)

What type of programming is defined by the term "imperative programming"?

(Multiple Choice)
4.9/5
(35)

When the pickle.load function reaches the end of a file, what type of exception is raised?

(Multiple Choice)
4.8/5
(29)

Any object can be pickled before it is saved to a file, and then unpickled as it is loaded from a file into a program.

(True/False)
4.7/5
(39)

Python programmers typically capitalize their own class names to distinguish them from variable names.

(True/False)
4.9/5
(45)

What method is known as a class's constructor, because it is run automatically when a user instantiates the class?

(Multiple Choice)
4.8/5
(33)

What are the two access modes that are used when opening a file for input and output when pickling? (Choose two.)

(Multiple Choice)
4.8/5
(42)

Unlike other object-oriented languages, Python does not support polymorphic methods.

(True/False)
5.0/5
(35)

What type of programming is defined by the term "procedural programming"?

(Multiple Choice)
4.8/5
(41)

What type of programming is defined by the term "functional programming"?

(Multiple Choice)
4.9/5
(40)

If the parenthesized parent class name is omitted from the class definition, the new class is automatically made a subclass of self.

(True/False)
4.8/5
(33)
Showing 21 - 40 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)