Question
1. Which of the following statements sets x so that it refers to no object at all? Group of answer choices A. x = B.
1. Which of the following statements sets x so that it refers to no object at all?
Group of answer choices
A. x =
B. x = ()
C. x = ""
D. x = None
2. To compute the salary of a manager, the program must first get the salary of the underlying Employee object and then add a bonus.
class Manager(Employee) : . . . def getSalary(self) : _________________________ return base + self._bonus
Which statement correctly completes the code:
Group of answer choices
A. base = super(self.getSalary())
B. base = super().getSalary()
C. base = super().self.getSalary()
D. base = self.getSalary()
3. Given a list aco_students of Student objects and assuming there is a get_classification method that returns the classification ('FR', 'SO', 'JR', 'SR') for that student, which choice correctly creates a list of Student objects that are seniors?
Group of answer choices
A. s for s in aco_students if s.get_classification() == 'SR'
B. [ s if s.get_classification() == 'SR' for s in aco_students ]
C. [ s.get_classification() == 'SR' for s in aco_students ]
D. [ s for s in aco_students if s.get_classification() == 'SR' ]
4. Given a list aco_students of Student objects and assuming there is a get_gpa method that returns the student's gpa, which choice correctly sorts the list so that the student with the highest gpa is in the first position of the list aco_students?
Group of answer choices
A. aco_students.sort(key = lambda s: s.get_gpa(), reverse=True)
B. sorted(aco_students, key = lambda s: s.get_gpa(), reverse=True)
C. sorted(aco_students, key = lambda s: s.get_gpa())
D. aco_students.sort(key = lambda s: s.get_gpa())
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