1.) Which of the following is NOT a difference between methods and functions? A
ID: 3885856 • Letter: 1
Question
1.) Which of the following is NOT a difference between methods and functions?
A function is defined as part of a class definition
A method is defined as part of a class definition
The first parameter variable of a method is called self
A method can access the instance variables of an object
2.) How might you read the True or False value of a wx.CheckBox?
v = self.chk1.GetValue()
v = self.chk1.SetValue()
v = self.chk1.GetBool()
v = self.chk1.Checked()
.) In wxPython individual GUI controls are called ______.
widgets
icons
charms
gadgets
.) "An HourlyEmployee class inherits from an Employee class and you instantiate the HourlyEmployee class like this,
hrEmp2 = HourlyEmployee(id, name, wage) .
How would you call the getName() method of the parent class from code outside of either class?"
hrEmp2.getName()
super.getName()
hrEmp2.Employee.getName()
.) The relationship between a superclass an its subclass is ____ relationship.
an 'is-a'
a 'will-be'
a 'was-a'
a 'has-a'
.) In wxPython setting a control location using pos=(x, y) is called _____.
absolute positioning
base positioning
grid positioning
relative positioning
.) Consider the following class. Which method(s) are mutators?
class Counter :
def getValue(self) :
return self.value
def click(self) :
self.value = self.value + 1
def unClick(self) :
self.value = self.value - 1
def reset(self) :
self.value = 0
click, unClick and reset
Only reset
Only click and unClick
All four methods are mutators
.) If you want one class to acquire properties or methods from another class, an alternative to inheritance is called _____.
composition
accumulation
superposition
.) In almost all cases we add wxPython user controls like textboxes, buttons, etc to a _____.
panel
rect
brick
box
Explanation / Answer
1)
Ans: A method is defined as part of a class definition
2.)
v = self.chk1.GetBool()
True or false values are represented by boolean value.
3)
Ans:widgets
4) Asn: hrEmp2.getName()
5)The relationship between a superclass an its subclass is ____ relationship.
Ans: an 'is-a'
5) In wxPython setting a control location using pos=(x, y) is called _____.
Ans: relative positioning
6)Consider the following class. Which method(s) are mutators?
Ans:click, unClick and reset
7)If you want one class to acquire properties or methods from another class, an alternative to inheritance is called _____.
Ans: superposition
8) In almost all cases we add wxPython user controls like textboxes, buttons, etc to a
Ans: rect.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.