Home
Flashcards
Preview
Python Unit 11
Home
Get App
Take Quiz
Create
When you instantiate an object, the automatically created method that i called is a(n) _________.
A. creator
B. constructor
C. initiator
D. architect
B. constructor
Every class has ______.
A. a default constructor and a programmer-written constructor
B. at least one constructor
C. at least two constructors
D. exactly one constructor
B. at least one constructor
Which of the following can be overloaded?
A. constructors
B. instance methods
C. both of the above
D. none of the above
C. both of the above
Every default constructor ______.
A. sets a default value for every field in a class
B. is the only constructor that is explicitly written in a class
C. is created automatically
D. requires no parameter
D. requires no parameter
When you write a constructor that receives a parameter, ______.
A. the automatically-created default constructor no longer exists
B. it becomes the default constructor
C. the constructor body must be empty
D. the parameter must be used to set a data field
B. it becomes the default constructor
When you write a constructor that receives no parameters, ________.
A. the automatically-created default constructor no longer exists
B. it becomes known as the default constructor
C. both of the above
D. none of the above
C. both of the above
Most often, a destructor is called when _______.
A. an object is instantiated
B. an object goes out of scope
C. an explicit call is made to it
D. a value is returned from a class method
B. an object goes out of scope
Which of the following is
not
a similarity between constructors and destructors?
A. Both can be called automatically.
B. Both have the same name as their class.
C. Both have no return type.
D. Both can be overloaded.
D. Both can be overloaded.
Which of the following is
not
an advantage of creating a class that inherits from another class?
A. You save time because subclasses are created automatically from those that come built in as part of a programming language.
B. You reduce the chance of errors because the original class's methods have already been used and tested.
C. You make it easier for anyone who has used the original class to understand the new class.
D. You save time because you need not re-create the fields and methods in the original class.
A. You save time because subclasses are created automatically from those that come built in as part of a programming language.
Employing inheritance reduces errors because _______.
A. you can copy and paste methods that you already created
B. the new classes have access to fewer data fields
C. the new classes have access to fewer methods
D. many of the methods you need have already been used and tested
D. many of the methods you need have already been used and tested
A class that is used as a basis for inheritance is called a ____.
A. child class
B. base class
C. derived class
D. subclass
D. subclass
Which of the following is another name for a derived class?
A. parent class
B. base class
C. superclass
D. child class
D. child class
Which of the following is
not
another name for a derived class?
A. extended class
B. subclass
C. superclass
D. child class
B. subclass
Which of the following is true?
A. A child class can also be a parent class.
B. A class's ancestors consist of its entire list of children.
C. To be considered object oriented, a class must have a child.
D. A base class usually has more fields than its descendent.
A. A child class can also be a parent class.
A derived class inherits ________ data and methods of its ancestors.
A. only the public
B. no
C. only the private
D. all
D. all
Which of the following is true?
A. A class's methods usually are public.
B. A class's data fields usually are public.
C. both of the above
D. none of the above
A. A class's methods usually are public.
A _________ is a collection of predefined, built-in classes that you can use when writing programs.
A. vault
B. library
C. black box
D. store
B. library
An environment in which you can develop GUI programs by dragging components to their desired positions is a(n) _______.
A. integrated compiler
B. GUI formatter
C. text-based editor
D. visual development environment
D. visual development environment
In object-oriented programs, errors are known as _____.
A. gaffes
B. faults
C. exceptions
D. omissions
C. exceptions
The general principle of exception handling in object-oriented programming is that a method that uses data should ______.
A. be able to handle errors, but not detect them
B. be able to detect errors, but not required to handle them
C. not be able to detect or handle errors
D. be able to handle and detect errors
B. be able to detect errors, but not required to handle them
Author
jdavis123
ID
358628
Card Set
Python Unit 11
Description
Updated
6/13/2022, 4:04:15 AM
Show Answers
Home
Flashcards
Preview