New ! Computer Science MCQ Practise Tests



Python Classes and Objects Three and Five Marks Questions

12th Standard

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Science

Time : 00:45:00 Hrs
Total Marks : 40
    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()

  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?

  6. 5 x 5 = 25
  7. Write a program to check and print if the given number is negative or positive using class.

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

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

  10. 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.

  11. Write a menu driven program to add or delete stationary items. You should use dictionary to store items and the brand.

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

Reviews & Comments about 12th Standard Computer Science - Python Classes and Objects Three and Five Marks Questions

Write your Comment