Question
This is homework for my Python class... 1. The default value for the GUI column Grid attribute is ____. 0 False 'left' 'right' 2. Consider
This is homework for my Python class...
1. The default value for the GUI column Grid attribute is ____.
0
False
'left'
'right'
2. Consider the following program. What is displayed when it executes?
class Dinosaur :
def __init__(self, name='dinosaur') : self._name = name def display(self) : print(self._name)
class Triceratops(Dinosaur) :
def __init__(self) : super().__init__('triceratops')
x = Triceratops() x.display()
dinosaur
triceratops
Nothing is displayed
The program crashes with a method not implemented error.
3. In this code segment, root is ____.
ageValue = IntVar() ageValue.set(100) age = Entry(root, width=5, textvariable=ageValue)
The containing element for the widget.
The name of the event-handling function called when the element is clicked.
The name of the variable that represent any data entered in the widget
Is the name of the layout manager used by the widget.
4. Which of the following is true regarding subclasses?
A subclass that inherits methods from its superclass may not override the methods.
A subclass that inherits instance variables from its superclass may not declare additional instance variables.
A subclass may inherit methods or instance variables from its superclass but not both.
A subclass may inherit methods and instance variables from its superclass, and may also implement its own method and declare its own instance variables.
5. A ____ exception is raised when Python attempts to convert a string with a bad format to a number.
ConversionError
ValueError
ParsingError
FormatError
6. A(n) ____ layout allows the GUI programmer to place components in the cells of an invisible grid in the window.
cell
grid
MVC
model/view
7. What is the purpose of using an inheritance hierarchy?
To share common code among the classes
To create objects from concrete classes
To create objects from abstract classes
To create objects using constructors
8.Given the following code, identify the subclass and superclass:
class ChoiceQuestion(Question) : def __init__(self) pass
"the subclass is Question, the superclass is ChoiceQuestion"
"the subclass is ChoiceQuestion, the superclass is Question"
"the subclass is init, the superclass is self"
"the subclass is ChoiceQuestion, the superclass is ChoiceQuestion"
True or False: With tkinter radiobuttons, each button should have the same variable name in order to have the radio buttons be part of a group, but you should assign each button a different value property in order to distinguish which button is checked.
10. "Consider this checkbox code. When checked ____
self._cb1 = BooleanVar() Checkbutton(self, text=tea, variable = _cb1, command = foop) self._cb2 = BooleanVar() Checkbutton(self, text=coffee, variable = _cb2, command = foop)
which button is checked is determined using the variable value _cb1 or cb2.
which button is checked is determined by the text property which is used to distinguish one button from another.
11. A class that represents a more specific entity in an inheritance hierarchy is called a/an _____.
Default class
Superclass
Subclass
Inheritance class
12. Which of the following statements about inheritance is correct?
You can always use a superclass object in place of a subclass object.
You can always use a subclass object in place of a superclass object.
A superclass inherits data and behavior from a subclass.
A superclass inherits only behavior from a subclass.
13. What does the subclass inherit from a superclass?
Data and behavior
Only behavior
Only data
Nothing
14. "You are creating a Motorcycle class that will be a subclass of a Vehicle class. Which statement accomplishes this goal?"
class Motorcycle(Vehicle):
subclass Motorcyle(Vehicle):
class Vehicle(Motorcycle):
subclass Vehicle(Motorcycle):
16. In this code segment transferName is _____.
btn1 = Button(root, text='Move Name', command=transferName) btn1.grid(row=1, column=0, padx=3, pady=9)
The containing element for the widget
The name of the event-handling function called when the element is clicked
The name of the variable that represent any data entered in the widget
Is the name of the layout manager used by the widget
17. What type of method is used to extend or replace the functionality of the superclass method?
Concrete method
Abstract method
Overriding method
Constructor method
18. You can associate a mouse event and an event-handling method with a widget by calling the ____ method.
assign
associate
bind
link
19. What must be included in the subclass constructor as the first statement?
Initialization of all instance variables
A call to the superclass constructor
A call to the accessor and mutator methods
A call to the subclass constructor
20. To activate a button and enable it to respond to mouse clicks, you must set its command attribute to a(n) ____ method.
label
widget
trigger
event-handling
21. Which of the following statements about superclasses and subclasses is true?
A superclass is larger than its subclass.
A superclass inherits from a subclass.
A superclass extends a subclass.
A subclass extends a superclass.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started