New ! Computer Science MCQ Practise Tests



12th Standard English Medium Computer Science Subject Python Classes and Objects Book Back 3 Mark Questions with Solution

12th Standard

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Science

Time : 01:00:00 Hrs
Total Marks : 15

    3 Marks

    5 x 3 = 15
  1. What are class members? How do you define it?

  2. Write a class with two private class variables and print the sum using a method.

  3. Find the error in the following program to get the given output?
    class Fruits:
    def __init__(self, f1, f2):
                   self.f1 = f1
                   self.f2 = f2
    def display(self):
                   print("Fruit 1 = %s, Fruit 2 = %s" %(self.f1, self.f2))
    F = Fruits ('Apple', 'Mango')
    del F.display
    F.display()
    Output:
    Fruit 1 = Apple, Fruit 2 = Mango

  4. What is the output of the following program?
    class Greeting:
    def __init__(self, name):
             self.__name = name
    def display(self):
             print("Good Morning ", self.__name)
    obj=Greeting ('Bindu Madhavan')
    obj.display()

  5. How to define constructor and destructor in Python?

*****************************************

Reviews & Comments about 12th Standard English Medium Computer Science Subject Python Classes and Objects Book Back 3 Mark Questions with Solution updated Book back Questions

Write your Comment