Question
Question 11 pts A UML class diagram describes the functions of one or more modules shows the state of one of more classes describes the
Question 11 pts
A UML class diagram
describes the functions of one or more modules |
shows the state of one of more classes |
describes the attributes and methods of one or more classes |
shows the relationship between the identity of an object and its state |
Flag this Question
Question 21 pts
Consider the following code: class Multiplier: def __init__(self): self.num1 = 0 self.num2 = 0 def getProduct(self): return self.num1 * self.num2 def main(): m = Multiplier() m.num1 = 7 m.num2 = 3 print(m.num1, "X", m.num2, "=", m.getProduct()) if __name__ == "__main__": main() What is (are) the methods of the class?
num1, num2 |
m |
getProduct() |
__init__() |
Flag this Question
Question 31 pts
Consider the following code: class Rectangle: def __init__(self, height, width): self.height = height self.width = width def getPerimeter(self): perimeter = self.height * 2 + self.width * 2 return perimeter def getArea(self): area = self.height * self.width return area def getStr(self): return str(self.height) + " by " + str(self.width) How many public attributes does this class define?
1 |
2 |
3 |
4 |
Flag this Question
Question 41 pts
Consider the following code: class Rectangle: def __init__(self, height, width): self.height = height self.width = width def getPerimeter(self): perimeter = self.height * 2 + self.width * 2 return perimeter def getArea(self): area = self.height * self.width return area def getStr(self): return str(self.height) + " by " + str(self.width) How many public methods does this class define?
1 |
2 |
3 |
4 |
Flag this Question
Question 51 pts
Consider the following code: class Die: def __init__(self): self.__value = 1 def getValue(self): return self.__value def roll(self): self.__value = random.randrange(1, 7) Given a Die object named die, which of the following will print the value of the __value attribute to the console?
print(die.getValue()) |
print(die.roll()) |
print(die.value) |
print(die.__value) |
Flag this Question
Question 61 pts
Consider the following code: class Multiplier: def __init__(self): self.num1 = 0 self.num2 = 0 def getProduct(self): return self.num1 * self.num2 def main(): m = Multiplier() m.num1 = 7 m.num2 = 3 print(m.num1, "X", m.num2, "=", m.getProduct()) if __name__ == "__main__": main() What is (are) the attributes of the class?
num1, num2 |
m |
getProduct() |
__init__() |
Flag this Question
Question 71 pts
Given a class named Customer, which of the following creates a Customer object and assigns it to the variable named cust1:
cust1 = new Customer() |
cust1 = Customer() |
cust1 = Customer.init() |
cust1 = Customer.create() |
Flag this Question
Question 81 pts
Given a variable named p that refers to a Product object, which of the following statements accesses the price attribute of the Product object?
Product.price |
p.price |
Product.price() |
p.price() |
Flag this Question
Question 91 pts
In a method, the first parameter, which is usually named self, refers to the current
object |
class |
method |
parameter |
Flag this Question
Question 101 pts
The methods contained in an object that has been created from a class is its __________.
identity |
state |
behavior |
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