logo

Crowdly

البرمجة الكينونية (CS 210) تجميع

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? 

View this question

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? 

View this question

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?

View this question

To overload an operator for example "*" in all classes you need to implement its method in one class only? 

View this question

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? 

View this question

What happens when this code runs?

View this question
What will print(Student.name) output?

View this question

What is the output of this code, if any?

View this question

What is the output of the following code?

View this question

What is the output of the following?

View this question

Want instant access to all verified answers on elearning.yu.edu.jo?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!