11.) Which of the following is NOT true about instance methods for a class? The
ID: 3885861 • Letter: 1
Question
11.) Which of the following is NOT true about instance methods for a class?
The accessor and mutator methods are automatically called when an object is created
The object on which a method is applied is automatically passed to the self parameter variable of the method
"In a method, you access instance variables through the self parameter variable"
"A class variable belongs to the class, not to any instance of the class"
12.) "To import wxPython you used this statement, _____."
import wx
import wxapp
import wxP
import wxPython
13.) When using the wx.TextCtrl, how would you assign a value to a TextCtrl?
self.txt1.SetValue('xyz')
self.txt1.GetValue('xyz')
self.txt1.GetText('xyz')
self.txt1.SetText('xyz')
14.) A major advantage of inheritance is ____.
code reuse
simplicity
15.) You instantiate a wx.Button object with the variable self.btn3. How do you connect the button to an event handler method named showResults()?
"self.btn3.Bind(wx.EVT_BUTTON, self.showResults)"
"self.btn3(wx.EVT_BUTTON, self.showResults)"
"self.btn3.Bind(wx.EVT_BUTTON, wx.showResults)"
16.) What is k after this runs.
j = ['red', 'purple', 'magenta', 'blue']
k = [c for c in j if len(c) < 5]
['red', 'blue']
['red', 'purple', 'magenta', 'blue']
['red', 'purple', 'blue']
['red']
17.) Assume a class exists named Fruit. Which of the follow statements creates an object of the Fruit class?
x = Fruit()
def Fruit()
class Fruit()
x = Fruit.create()
18.) What is the purpose of the self-parameter?
Refers to the object on which the method was invoked
Enables changes in the implementation without affecting users of a class
To create variables with public visibility
Store the data for all objects created by the same class
Explanation / Answer
11. A class variable belongs to the class, not to any instance of the class
12. import wx
13. self.txt1.GetValue('xyz')
14. code reuse
15. self.btn3.Bind(wx.EVT_BUTTON, self.showResults)
16.['red', 'purple', 'blue']
17. x = Fruti();
18. Refers to the object on which the method was invoked
Rate an upvote.....Thankyou
Hope this helps.....
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.