Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Which of the following is not true about the emissions() method of the Electric

ID: 3867823 • Letter: W

Question

Which of the following is not true about the emissions() method of the Electric class? a. It overloads Car's emissions() method. b. It uses one or more of the class's attributes. c. It overloads Diesel's emissions() method. d. All of the above are true. e. None of the above is true. What is the value of Car(20, 20) Diesel(40, 40)? a. True b. False c. This would cause an error. d. It depends on the memory addresses of the instances created. e. None of the above. Which of the following does Electric not inherit from Car? a. Car's constructor. b. Car's initialization function. c. Car's attributes. d. a and b e. b and c For questions 33-35, refer to the following code: 1. def mystery6(alist): 2. c = 0 3. ret = [] 4. for item in a list: 5. if item not in ret: ret.append(item) 7. else: 8. c += 1 9. return ret What does this mystery6() function do? a. Counts the number of occurrences of each item in a list. b. Sorts a list in ascending order. c. Selects all entries in a list that are positive ints. d. Removes all duplicate items from a list. e. None of the above. What would print(mystery6([1, 3, 2, 'a', 1, 3, 5, 'b']) display? a. 2 b. [1, 3, 2, 'a', 1, 3, 5, 'b'] c. [1, 3] d. [1, 3, 2, 'a', 5, 'b'] e. None of the above. Which of the following would most likely achieve the same result as the a. Calling enumerate(alist). b. Calling list(set(alist). c.Calling sorted(alist). d. Calling list(alist). e. None of the above.

Explanation / Answer

33. e. None of the above because it would error out because in the for loop inside it says a list instead of alist. Considering it a typo still it is none of the above as all the function does is find out all the elements that appeared atleast once in the list c is just a variable that counts the occurence of repititions of all the elements.

34. d. [1,3,2,'a',5,'b'] because as I mentioned all the function does was remove the duplicates so 1 and 3 are removed from the list

35. b. Calling list(set(alist)) This will remove all the duplicates as set contains non duplicate items only and it will then be converted to list type

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote