New ! Computer Science MCQ Practise Tests



12th Standard Computer Science English Medium Python Classes and Objects Reduced Syllabus Important Questions With Answer Key 2021

12th Standard

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Science

Time : 01:00:00 Hrs
Total Marks : 100

      Multiple Choice Questions


    15 x 1 = 15
  1. Which of the following are the key features of an Object Oriented Programming language?

    (a)

    Constructor and Classes

    (b)

    Constructor and Object

    (c)

    Classes and Objects

    (d)

    Constructor and Destructor

  2. Which of the following method is used as destructor?

    (a)

    __init__( )

    (b)

    __dest__( )

    (c)

    __rem__( )

    (d)

    __del__( )

  3. Which of the following class declaration is correct?

    (a)

    class class_name

    (b)

    class class_name<>

    (c)

    class class_name:

    (d)

    class class_name[ ]

  4. Which of the following is the output of the following program?
    class Student:
    def __init__(self, name):
    self.name=name
    print (self.name)
    S=Student(“Tamil”)

    (a)

    Error

    (b)

    Tamil

    (c)

    name

    (d)

    self

  5. Functions of the class are called as

    (a)

    Methods

    (b)

    Members

    (c)

    Variables

    (d)

    Loog

  6. Write the output for the following
    class test
    x, y = 10,5
    s=test ()
    print (s. x + s. y)

    (a)

    10

    (b)

    5

    (c)

    15

    (d)

    105

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

    (a)

    First

    (b)

    Second

    (c)

    Third

    (d)

    Last

  8. Which of the following is automatically executed when an object of a class is created?

    (a)

    constructor

    (b)

    destructor

    (c)

    class

    (d)

    members

  9. Which of the following variables can be accessed only within the class?

    (a)

    Protected

    (b)

    Public

    (c)

    Private

    (d)

    None of these

  10. ______ and_____ are the key features of object oriented programming.

    (a)

    List and tuples

    (b)

    Set and dictionary

    (c)

    Classes and objects

    (d)

    Variables and methods

  11. In Python, a class is defined by using the _______ class.

    (a)

    Operator

    (b)

    Identifier

    (c)

    Object

    (d)

    Keyword

  12. The ____ of the class should be accessed through instance of a class.

    (a)

    Objects

    (b)

    Members

    (c)

    Functions

    (d)

    Tuples

  13. In Python, the class method must name the first argument named as ___________

    (a)

    this

    (b)

    new

    (c)

    self

    (d)

    var

  14. When class variable declared within class, methods must be prefixed by the ________ and _______________

    (a)

    classnam, :

    (b)

    classname,.

    (c)

    :, classname

    (d)

    classname, objectname

  15. A variable prefixed with __________ become private in nature.

    (a)

    double underscore

    (b)

    double colon

    (c)

    double dot

    (d)

    double hyphen

    1. 2 Marks


    10 x 2 = 20
  16. What is class?

  17. 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)

  18. How will you create constructor in Python?

  19. What is the purpose of Destructor?

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

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

  22. Differentiate python class function and ordinary function.

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

  24. 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)

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

    1. 3 Marks


    10 x 3 = 30
  26. What are class members? How do you define it?

  27. 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()

  28. 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()

  29. Write a note on object.

  30. Write a python program to find total and average marks using class.

  31. Explain the working of the following program. class Sample:
    def _init_(self, num):
    print("Constructor of class Sample ...")
    self.num=num
    print("The value is :", num)
    S=Sample(10)

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

  33. Write a python program that illustrate the use of destructor.

  34. Fill up the blanks in the following program to get the output:
    Value of x = 10
    Value of y = 20
    Sum of x and y= 30
    Class sample:
    x, __ = 10, 20 -------------------1
    s = -------------------------2
    print ("value of x =", __ ) ------------3
    print ("value of y =", __ ) -------------4
    print ("sum of x and y =", __ ) --------5

  35. 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?

    1. 5 Marks


    7 x 5 = 35
  36. Write a menu driven program to add or delete stationary items. You should use dictionary to store items and the brand.

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

  38. Write a program to check and print if the given number is negative or positive using class.

  39. Write a program to calculate area and circumference of a circle.

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

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

  42. Write a program to store product and its cost price. Display all the available products and prompt to enter quantity of all the products. Finally generate a bill which displays the total amount to be paid.

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

Reviews & Comments about 12th Standard Computer Science English Medium Python Classes and Objects Reduced Syllabus Important Questions With Answer Key 2021

Write your Comment