You are on page 1of 2

Code No.

: 20CSC03
CHAITANYA BHARATHI INSTITUTE OF TECHNOLOGY (Autonomous)
B.E. II Sem (Main & Backlog) Examination September – October 2022
Object Oriented Programming
(Common to CSE, CSE-AI&ML, CSE-IoT&CS Including BCT, AI&ML)
Time: 3 Hours Max Marks: 60
Note: Answer ALL questions from Part-A & Part –B (Internal Choice) at one place in the
same order
Part - A
(5Q X 3M = 15 Marks)
M CO BT
1 Write a python program to circulate the values of n variables. (3) 1 3
2 What are different ways to pass arguments in a python program? (3) 2 1
3 Compare constructors and destructors. Give an example of overloaded (3) 3 2
constructor.
4 Write a program to perform reading and writing from a file. (3) 4 3
5 Draw hierarchy of stream classes for file operations. (3) 5 2

Part – B
(5Q X 9M = 45 Marks)
M CO BT
6 (a) Compare and contrast the structured programming and object oriented (5) 1 2
programming techniques.
(b) Explain with example When do we overload the functions and when (4) 1 1
do we override.
(OR)
7 (a) Discuss about keyword arguments and default arguments in python (4) 1 2
with example.
(b) Build a Python program using function to find a sum of first N even (5) 1 3
numbers and print the result.

8 (a) Explain with an example – while loop, break statement and continue (4) 2 2
statement in Python.
(b) Write a Python program to count the number of vowels in a string (5) 2 3
provided by the user.
(OR)
9 (a) Distinguish call by value and call by reference, supported with (4) 2 2
example.
(b) Examine a Python program to generate first ‘N’ Fibonacci numbers. (5) 2 3
Note: The Fibonacci numbers are 0,1,1,2,3,5,8….. where each number
is the sum of preceding two.

10 (a) Define a class. What is the relation between an object and a class? (5) 3 2
Write a program to define a class, to access its member functions and
to create and access objects in Python.
(b) Why does the object-oriented philosophy need functions to be defined (4) 3 1
inside the classes? What could be the advantage?
(OR)
Page 1 of 2
Code No.: 20CSC03
11 (a) Define nested class. List out its advantages. Support your answer with (4) 3 2
proper examples.
(b) Create a class called Time that has separate int member data for hours, (5) 3 3
minutes and seconds. One constructor should initialize this data to 0.
And another should initialize it to fixed values. A member function
should display it, in 11:59:59 format. Write a program to add time of
two objects by overloading '+' operator.

12 (a) Build a program to demonstrate overloading of ‘+’ operator inside a (5) 4 3


class student that has attributes name and marks.
(b) Demonstrate Multiple Inheritance through Method Overriding with an (4) 4 3
example written in python.
(OR)
13 (a) With an example, explain how member functions can be overridden. (5) 4 2
What is the scope resolution of these functions?
(b) List and explain in brief the various functions required for random (4) 4 1
access file operations.

14 (a) What is exception handling? Explain types of exception handling with (5) 5 2
suitable example.
(b) While reading a file how would you check whether you have reached (4) 5 2
the end of the file? Explain with example program.
(OR)
15 (a) Evaluate a try block that is likely to generate three types of exception (5) 5 2
and then incorporate necessary catch blocks and handle them
appropriately.
(b) Define Widget. Construct a Tkinter window having any three widgets. (4) 6 3

******

Page 2 of 2

You might also like