Filters
Question type

Study Flashcards

What is the __str__ method used for?


A) It builds and returns a string representation of an object's state.
B) It is used to determine if a class attribute is a string.
C) It is used to initiate string values during instantiation.
D) It converts a string attribute within a class.

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

Correct Answer

verifed

verified

A

It is not usual to bother subclassing unless the two classes share a substantial amount of abstract behavior.

A) True
B) False

Correct Answer

verifed

verified

The scope of an instance variable is the entire module.

A) True
B) False

Correct Answer

verifed

verified

For data that are owned by individual objects, you must use class variables.

A) True
B) False

Correct Answer

verifed

verified

The function call str(s) is equivalent to the method call s.__str__().

A) True
B) False

Correct Answer

verifed

verified

What concept within object-oriented programming involves the restriction of the manipulation of an object's state by external users to a set of method calls?


A) inheritance
B) polymorphism
C) data encapsulation
D) data modeling

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

Correct Answer

verifed

verified

What can be used to describe and document the analysis and design of complex software systems?


A) Class Diagraming Language
B) Programming Structural Language
C) Direct Modeling Language
D) Unified Modeling Language

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

Correct Answer

verifed

verified

Operator overloading is an example of an abstraction mechanism.

A) True
B) False

Correct Answer

verifed

verified

True

You are utilizing the pickle.load function to load objects into a program from a file. However, your program raises an exception as soon as the end of the file is reached. What must you do?


A) Use an if-else statement to check if the load function is at the end of the file.
B) Use a nested loop to run the pickle.load function line by line.
C) Use a try-except statement to catch the exception and continue with the program.
D) Use the pickle.len() function to determine the size of the file, then pass the size to the pickle.load() function using the size key.

E) None of the above
F) All of the above

Correct Answer

verifed

verified

What effect does using the model/view pattern of design have?


A) It divides the roles and responsibilities of the system between data management and user interface display.
B) It combines the roles and responsibilities of the system between data management and user interface display.
C) It involves the user in the defining of how data will be modeled by a program.
D) It involves the creation of a model GUI environment, and then involves the creation of views for the user to choose from.

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

Correct Answer

verifed

verified

A class variable is visible to all instances of a class and does not vary from instance to instance.

A) True
B) False

Correct Answer

verifed

verified

What is the process in which the Python virtual machine recycles its storage known as?


A) garbage collection
B) trash expunging
C) data dumping
D) tombstoning

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

Correct Answer

verifed

verified

The attributes of an object are represented as instance datum.

A) True
B) False

Correct Answer

verifed

verified

How could you overload the addition operator in the Python language?


A) You create a def statement with an asterisk, then specify math.__add__ as the method name.
B) You create a new class with the same name as the arithmetic class, and define the __add__ method.
C) You declare a new method with the same name, __add__, and define the method.
D) You create a Python script named __add__.py, and then define the new method in that script, then import it.

E) C) and D)
F) All of the above

Correct Answer

verifed

verified

What statement is an accurate description of the concept of polymorphism in object-oriented programming?


A) Polymorphism is the restricting of the manipulation of an object's state by external users to a set of method calls.
B) Polymorphism is allowing a class to automatically reuse and extend the code of a similar but more general class.
C) Polymorphism is the use of code that is capable of making changes to itself during the execution process.
D) Polymorphism is allowing the several different classes to use the same general method names.

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

Correct Answer

verifed

verified

At the top, or root of the class hierarchy is the most abstract class. What is the name of this class?


A) root
B) object
C) parentClass
D) Main

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

Correct Answer

verifed

verified

Most object-oriented languages require the programmer to master the following techniques: data encapsulation, inheritance, and abstraction.

A) True
B) False

Correct Answer

verifed

verified

False

Although Python is considered an object-oriented language, its syntax does not enforce data encapsulation.

A) True
B) False

Correct Answer

verifed

verified

In general, you should use class variables only for symbolic constants or to maintain data held in common by all objects of a class.

A) True
B) False

Correct Answer

verifed

verified

Regarding class variables, what statement is accurate?


A) A class variable is only visible to a single instance of a class.
B) A class variable is visible only to methods inside a class.
C) A class variable is visible to all instances of a class, but can vary from instance to instance.
D) A class variable is visible to all instances of a class, and does not vary from instance to instance.

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

Correct Answer

verifed

verified

Showing 1 - 20 of 50

Related Exams

Show Answer