New ! Computer Science MCQ Practise Tests



Python Classes and Objects - Two Marks Study Materials

12th Standard

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Science

Time : 00:45:00 Hrs
Total Marks : 24
    12 x 2 = 24
  1. What is class?

  2. What is instantiation?

  3. What is the output of the following program?
    Class Sample:
        __num=10
        def disp(self):
                        print(self.__num)
    S=Sample()
    S.disp()
    print(S.__num)

  4. How will you create constructor in Python?

  5. What is the purpose of Destructor?

  6. Write the general form of declaring class in Python.

  7. Write the syntax for the following
    (i) Creating objects
    (ii) Accessing class members

  8. Differentiate python class function and ordinary function.

  9. Name the function which acts as a constructor and destructor.

  10. Write a program in python that illustrate the use of constructor.

  11. Explain the working of the following program
    class Sample:
    num=0
    def _init_(self) var):
    Sample.num+= 1
    self.var=var
    print("The object value is = ", var)
    print("The count of object created Sample.num) =",
    S1=Sample(15)
    S2=Sample(35)
    S3=Sample(45)

  12. Write a note on public and private data members of python class.

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

Reviews & Comments about 12th Computer Science - Python Classes and Objects - Two Marks Study Materials

Write your Comment