Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python help! My book, and Google have not helped so far. 1.) If a super class and a subclass both have a method with the

Python help! My book, and Google have not helped so far.

1.) "If a super class and a subclass both have a method with the same name and number of parameters, _____."

we say the subclass method overrides the superclass method.

we say the methods have the same essence

we say the methods have the same thumbprint

2.) Consider the code below. Which statement is the list comprehension equivalent of the following for-loop.

n = [10, 6, 10, 4]

m = []

for x in n:

m.append(x/2)

m = [x/2 for x in n]

m = [x/2 for m in n]

m = [n/2 for x in m]

3.) "When using the wx.TextCtrl, how would you assign the value typed into the TextCtrl to a variable?

txt = self.txt1.GetValue()

txt = self.txt1.SetValue('xyz')

txt = self.txt1.GetText()

txt = self.txt1.GetText('xyz')

4.) Which of the following creates a status bar at the bottom of a wxPython window?

self.s = self.CreateStatusBar()

self.s = wx.StatusBar()

5.) With inheritance, often you will collect attributes and methods in the super class that are shared by your subclasses.

True

False

6.) When is an object constructor invoked?

When an object is created

When any instance data is modified

When any method is invoked

Only when multiple arguments are required to create an object

7.) If a method in the superclass has the same header as a method in the subclass _____.

we say the methods have the same signature

we say the methods have the same essence

we say superclass method overrides the subclass method

8.) The 'is-a' relationship _____

points only in the direction of super class to child class

points only in the direction of child class to super class

is not part of inheritance

9.) In wxPython, which position argument sets the item 40 pixels from the top of the window and 70 pixels from the left edge of the window?

pos = (70, 40)

pos = (40, 70)

10.) An HourlyEmployee class inherits from an Employee class. From inside the HourlyEmployee class, how would you call the displayPay() method of the parent class in Python 2.7?

super(HourlyEmployee, self).displayPay(self, hours, wage)

super().displayPay(self, hours, wage)

Parent.displayPay(self, hours, wage)

Employee.self.displayPay(self, hours, wage)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

LO5 Describe job analysis and the stages in the process.

Answered: 1 week ago