Siddaganga Institute of Technology, Tumakuru
Python Programming – Previous Year Questions (Unit-wise)
UNIT 5: OOP, Classes, Inheritance & Web/Data Modules
■ April-May 2023 (PLC2)
Q9a When the objects become mutable? Explain this concept with the help of a rectangle class
and suitable methods associated with that class. [10M]
Q9b What are pure functions? Explain in detail with a suitable program. [10M]
— OR —
Q10a Develop a program that uses class Student which prompts the user to enter marks in three
subjects and calculates total marks, percentage and displays the score details. Use
__init__(), getmarks(), display() methods. [10M]
Q10b What are modifiers? Write a suitable code to explain this concept. [10M]
■ July-Aug 2024 (S3CCSI05)
Q9a Explain the functions used to download web pages with appropriate code segment. [6M]
Q9b Explain reading and writing of excel sheets with a supporting code segment. [6M]
Q9c Differentiate between bs4, requests, webbrowser, and selenium modules. [8M]
— OR —
Q10a Explain with suitable code snippet, how to save web page to a file on local hard drive. [6M]
Q10b Develop a python program to read and display CSV file by removing the header (without first
row). Convert the data frame to an array. [6M]
Q10c Describe JSON. Explain the JSON module used in python with an illustrative code segment.
[8M]
■ Aug-Sept 2024 Supplementary (PLC2)
Q9a Define a class and object. Develop a Python program to demonstrate the concept of class
and objects. [8M]
Q9b Write a definition for a class Rectangle with attributes width and height, where corner is a
point object which specifies the lower left corner. [6M]
Q9c What is a Pure function? Illustrate the same with an example in Python programming
language. [6M]
— OR —
Q10a Differentiate between __init__ and __str__ methods along with an example used in Python
programming language. [6M]
Q10b Define polymorphism. Demonstrate polymorphism with function to find histogram that counts
the number of times each letter appears in a word and in sentence. [8M]
Q10c Discuss operator overloading along with Python programming example. [6M]
■ July-Aug 2024 (PLC2 - 2nd Sem)
Q9a With respect to object oriented programming in python, what is a class? Show with suitable
example how class and objects are created. [6M]
Q9b With the help of object diagram justify the concept of shallow copy and deep copy
operations. [6M]
Q9c What are pure functions? Illustrate the concept of pure functions with suitable example. [8M]
— OR —
Q10a Illustrate with suitable example the implication of the following methods with respect to OOP:
i) __init__ ii) __str__. [10M]
Q10b Bring out the importance of polymorphism, and show with an example how polymorphism is
implemented in python. [10M]
■ March 2024 (S3CCSI05)
Q9a Explain Saving Downloaded Files to Hard Drive with an example. [6M]
Q9b Illustrate with steps for Reading Data from a Spreadsheet. [8M]
Q9c Explain how to create and save excel documents in python using openpyxl. [6M]
— OR —
Q10a Briefly describe the differences between the webbrowser, requests, BeautifulSoup and
selenium modules. [8M]
Q10b Illustrate what do you pass to [Link]() and [Link]() to create Reader and Writer
objects? [6M]
Q10c With an example code, explain how to download a web page with the [Link]()
function. [6M]
■ Sept 2023 (PLC2)
Q9a Define a class and object. Develop a Python program to demonstrate the concept of class
and objects. [8M]
Q9b Demonstrate polymorphism with function to find histogram to count the numbers of times
each letters appears in a word and in sentence. [8M]
Q9c Write a function called draw_rect that takes a Turtle object and Rectangle and uses the
Turtle to draw the Rectangle. [4M]
— OR —
Q10a What is pure function? Illustrate the same with an example Python programming language.
[10M]
Q10b Differentiate between init and str methods along with an example used in Python
programming language. [10M]
■ Sept 2024 Supplementary (PLC2 & S3CCSI05)
Q9a Explain the concept of classes and objects with a sample program. [10M]
Q9b Develop a program that uses class Student which prompts the user to enter marks in three
subjects and calculates total marks, percentage and displays the score card details. Use
__init__(), getmarks(), display() methods. [10M]
— OR —
Q10a Differentiate between pure functions and modifier with example for each. [10M]
Q10b Define a class for student having attributes USN, NAME, PHONE. Develop a Python
program to read and display the details of two students. [10M]
■ Sept 2024 Supplementary (S3CCSI05 - CS/AD/CI)
Q9a Develop a Python program to fetch current weather data from the JSON file. [7M]
Q9b Explain briefly the process of reading excel documents in Python. [6M]
Q9c What type of object is returned by [Link]()? How can you access the downloaded
content as string value? [7M]
— OR —
Q10a Demonstrate a Python program to read data from the spread sheet and write the data into
spreadsheet. [7M]
Q10b Briefly explain the difference between the web browser, request, bs4, and selenium
modules. [7M]
Q10c Explain the function that takes a Python data structure and returns a string of JSON data.
[6M]