New ! Computer Science MCQ Practise Tests



12th Standard Computer Science English Medium Python Classes and Objects Reduced Syllabus Important Questions 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. Functions of the class are called as

    (a)

    Methods

    (b)

    Members

    (c)

    Variables

    (d)

    Loog

  3. In Python, every class name followed by

    (a)

    ;

    (b)

    : :

    (c)

    .

  4. Which of the following can be accessed by using object with dot (.) operator?

    (a)

    List

    (b)

    Tuples

    (c)

    Dictionary

    (d)

    None of these

  5. Which of the following is valid syntax of accessing class members

    (a)

    objectname = classmember ()

    (b)

    objectname. classmember ()

    (c)

    objectname. classmember

    (d)

    objectname. classmember

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

    (a)

    First

    (b)

    Second

    (c)

    Third

    (d)

    Last

  7. Which argument doesn't need a value when we call the method?

    (a)

    this

    (b)

    self

    (c)

    var

    (d)

    first

  8. How many argument can be taken by Python method even when a method is defined with one argument?

    (a)

    1

    (b)

    3

    (c)

    2

    (d)

    4

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

    (a)

    constructor

    (b)

    destructor

    (c)

    class

    (d)

    members

  10. In Python, which function will act as a constructor?

    (a)

    int

    (b)

    inti

    (c)

    classname

    (d)

    init

  11. Which of the following gets executed automatically when an object exit from the scope?

    (a)

    Destructor

    (b)

    Constructor

    (c)

    Class

    (d)

    Object

  12. ________ is the main building block in python.

    (a)

    Objects

    (b)

    Methods

    (c)

    Constructors

    (d)

    Class

  13. Class is a template for the __________

    (a)

    Method

    (b)

    Members

    (c)

    Object

    (d)

    Destructor

  14. Class variable and methods are together known as _______ of the class

    (a)

    Objects

    (b)

    Functions

    (c)

    Statements

    (d)

    Members

  15. The process of creating object is called as ___________

    (a)

    Class definition

    (b)

    Class declaration

    (c)

    Class instantiation

    (d)

    Class objects

    1. 2 Marks


    10 x 2 = 20
  16. What is class?

  17. What is instantiation?

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

  19. How will you create constructor in Python?

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

  21. Differentiate python class function and ordinary function.

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

  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()
    Output:
    Fruit 1 = Apple, Fruit 2 = Mango

  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 note on self argument used in python class function.

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

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

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

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

  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 2021

Write your Comment