Filters
Question type

Study Flashcards

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

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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


A) r
B) rb
C) w
D) wb

E) B) and C)
F) A) and C)

Correct Answer

verifed

verified

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


A) Programming utilizing cooperative subprograms to solve problems.
B) Programming using input and output statements, assignment statements, and control statements for selection and iteration.
C) Programming such that classes can be defined for objects and reused to define similar objects.
D) Programming using a set of cooperating functions rather than relying on assignment.

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

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.

A) True
B) False

Correct Answer

verifed

verified

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


A) IOError
B) EOFError
C) DataError
D) FileError

E) B) and C)
F) None of the above

Correct Answer

verifed

verified

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


A) When its timeout value has expired.
B) When it has been terminated by the destroy method.
C) When it has passed the last statement that uses it.
D) When it can no longer be referred to by the program that created it.

E) C) and D)
F) B) and D)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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


A) __start__
B) __build__
C) __main__
D) __init__

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

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


A) Always, because the comparison for equality is not compatible with classes.
B) Whenever a comparison for equality uses criterion other than object identity.
C) Only when you need to be able to make a comparison based on object identity.
D) Only if you plan to export the class as part of a module.

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

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


A) It preserves objects by storing them in memory.
B) It preserves objects by storing them to a file.
C) It preserves objects by creating a sqlite database.
D) It preserves objects by adding them to the calling Python script file.

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

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


A) state variables
B) substance variables
C) instance variables
D) self variables

E) B) and D)
F) C) and D)

Correct Answer

verifed

verified

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


A) Programming such that classes can be defined for objects and reused to define similar objects.
B) Programming that involves the use of input and output statements, assignment statements, and control statements for selection and iteration.
C) Programming that uses cooperating subprograms to solve problems.
D) Programming that views a program as a set of cooperating functions.

E) B) and C)
F) A) and C)

Correct Answer

verifed

verified

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


A) Programming utilizing cooperative subprograms to solve problems.
B) Programming using input and output statements, assignment statements, and control statements for selection and iteration.
C) Programming such that classes can be defined for objects and reused to define similar objects.
D) Programming using a set of cooperating functions rather than relying on assignment.

E) None of the above
F) A) and D)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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


A) dominator
B) denominator
C) numerator
D) terminator

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

Showing 21 - 40 of 50

Related Exams

Show Answer