31.
What is the purpose of the @staticmethod decorator in Python classes?

32.
Is the following Python code valid?
class B(object):
  def first(self):
    print("First method called")
  def second():
    print("Second method called")
ob = B()
B.first(ob)

34.
What will be the output of the following Python code?
class stud:
   def __init__(self, roll_no, grade):
      self.roll_no = roll_no
      self.grade = grade
   def display (self):
      print("Roll no : ", self.roll_no,  ", Grade: ", self.grade)
stud1 = stud(34, 'S')
stud1.age=7
print(hasattr(stud1, 'age'))

36.
What is a constructor in Python classes?

37.
Which of the following Python code will print True?
a = foo(2)
b = foo(3)
print(a < b)

class foo:
    def __init__(self, x):
        self.x = x
    def __lt__(self, other):
        if self.x < other.x:
            return False
        else:
            return True

class foo:
    def __init__(self, x):
        self.x = x
    def __less__(self, other):
        if self.x > other.x:
            return False
        else:
            return True

class foo:
    def __init__(self, x):
        self.x = x
    def __lt__(self, other):
        if self.x < other.x:
            return True
        else:
            return False

class foo:
    def __init__(self, x):
        self.x = x
    def __less__(self, other):
        if self.x < other.x:
            return False
        else:
            return True

39.
What is the purpose of the @classmethod decorator in Python classes?

40.
What is the output of the following code:
class Parent:
def init(self):
print('Parent constructor')
class Child(Parent):
def init(self):
print('Child constructor')
obj = Child()