Question
Section 1: 1. In Python, a class is a(n) ___ of an object. a. Constructor b. Inheritance c. Instance d. Blueprint e. Example Section 2:
Section 1:
1. In Python, a class is a(n) ___ of an object.
a. Constructor
b. Inheritance
c. Instance
d. Blueprint
e. Example
Section 2:
The following 3 questions are based on the following code snippet:
Class Clothing: def __init(size, color)__: self.size = size self.color = color def get_color(self): return self.color def change_color(self, color_to_change="green"): #def pick_small(self, is_extra_small): #tshirt = YOUR CODE HERE
1. Enter one English word in lower-case per blank:
a. Clothing is a(n) __________
b. tshirt is a(n) __________
c. color is a(n) __________
d. change_color is a(n) _________
2. Which code is the correct way to finish creating tshirt in the last line of the code snippet?
a. Clothing.create("small", "yellow")
b. Clothing()
c. Clothing("small", "yellow")
d. Clothing.__init__("small", "yellow")
3. Select all that apply:
Which of the following would be methods that would "make most sense" and be accurate (i.e. no error when used)?
Hint: Read the code snippet and the answer choices carefully.
a. tshirt.pick_small(True)
b. tshirt.color
c. tshirt.change_color("yellow")
d. tshirt.get_color()
e. tshirt.change_color()
f. tshirt.pick_small()
Section 3:
1. Suppose you want to create a child class, Suit, using Clothing as its parent. Complete the following Python code:
class ( ): # Details omitted
2. Regarding the previous question: The feature or functionality to create the class Suit from Clothing is called
a. Polymorphism
b. Generics
c. Inhibition
d. Instantiation
e. Exemplification
f. Inheritance
3. Select all that apply:
Which of the following input : output pair(s) return(s) True?
a. isinstance(tshirt, Suit)
b. isinstance(Suit, Clothing)
c. isinstance(tuxedo, Clothing)
d. isinstance(tshirt, Clothing)
e. isinstance(tuxedo, Suit)
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