New ! Computer Science MCQ Practise Tests



Python Classes and Objects Model Question Paper 1

12th Standard

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Science

Time : 01:00:00 Hrs
Total Marks : 50
    5 x 1 = 5
  1. Functions defined inside a class:

    (a)

    Functions

    (b)

    Module

    (c)

    Methods

    (d)

    section

  2. Which of the following is the private class variable?

    (a)

    __num

    (b)

    ##num

    (c)

    $$num

    (d)

    &&num

  3. Which of the following called as instances of a class or class variable?

    (a)

    Methods

    (b)

    Objects

    (c)

    Functions

    (d)

    Datatypes

  4. Which of the operator used to accessing members of the class?

    (a)

    .

    (b)

    ;

    (c)

    ,

  5. Which position of the argument named self in python class method?

    (a)

    First

    (b)

    Second

    (c)

    Third

    (d)

    Last

  6. 5 x 2 = 10
  7. How will you create constructor in Python?

  8. What is the purpose of Destructor?

  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. 5 x 3 = 15
  13. Write a class with two private class variables and print the sum using a method.

  14. How to define constructor and destructor in Python?

  15. Write the output 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)

  16. Why the following program give an error while displaying the value of n2. Give Reason.

  17. Read the following program. Answer the following question. Class sample:
    x, y= 10, 20
    s= sample ()
    print (s. x + s. y)
    1. What does sample denotes?
    2. What does x, y denotes?
    3. What does s denotes?

  18. 4 x 5 = 20
  19. Write a menu driven program to add or delete stationary items. You should use dictionary to store items and the brand.

  20. Write a python program to check and print if the given number is odd or even using class.

  21. Write a menu driven program that keeps record of books available in you school library.

  22. Write a program to accept a string and print the number of uppercase, lowercase, vowels, consonants and spaces in the given string.

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

Reviews & Comments about 12th Computer Science - Python Classes and Objects Model Question Paper 1

Write your Comment