Looking for البرمجة الكينونية (CS 210) تجميع test answers and solutions? Browse our comprehensive collection of verified answers for البرمجة الكينونية (CS 210) تجميع at elearning.yu.edu.jo.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
The output of the following code:
class ABC:
def __init__(self):
self.x = 2
self.y = 4
def __mul__(self, other):
tmp = ABC()
tmp.x = self.x + other.y
return tmp
a1 = ABC()
a2 = ABC()
a3 = a1 * a2
print(str(a3.x))
is?
The output of the following code:
class ABC:
def __init__(self):
self.x = 2
self.y = 4
def __mul__(self, other):
tmp = ABC()
tmp.x = self.x + other.y
return tmp
a1 = ABC()
a2 = ABC()
a1 = a1 * a2
print(a1.y)
is?
The following code has a logical error:
1) class ABC:
2) def __init__(self):
3) self.x = 2
4) def __truediv__(self, other):
5) tmp = ABC()
6) tmp.x = self.x / other.x
7) return self
8) a1 = ABC()
9) a2 = ABC()
10) a1 = a1 / a2
11) print(a1.x)
Which line has the logical error so that once fixed the overloading will work correctly?
To overload an operator for example "*" in all classes you need to implement its method in one class only?
The following code:
class Rectangle:
# code for this class
def __add__(self , x):
r3 = Rectangle()
r3.l = self.l + x.l
r3.w = self.w + x.w
return r3
Will overload the following operator?What happens when this code runs?
What is the output of this code, if any?
What is the output of the following code?
What is the output of the following?
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!