0% found this document useful (0 votes)
16 views1 page

PLC- Python

The document outlines the Continuous Internal Evaluation (Test-3) for the course 'Introduction to Python Programming' at B.M.S. College of Engineering. It includes instructions, a list of questions covering topics such as constructors, regular expressions, file handling, and class creation in Python, with a total of 40 marks available. The test is designed for the second semester and is common across various branches in physics and PLC cycle.

Uploaded by

RajaRajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views1 page

PLC- Python

The document outlines the Continuous Internal Evaluation (Test-3) for the course 'Introduction to Python Programming' at B.M.S. College of Engineering. It includes instructions, a list of questions covering topics such as constructors, regular expressions, file handling, and class creation in Python, with a total of 40 marks available. The test is designed for the second semester and is common across various branches in physics and PLC cycle.

Uploaded by

RajaRajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

USN 1 BM

B.M.S. COLLEGEOF ENGINEERING, BENGALURU-19


(Autonomous Institute, Affiliated to VTU)
CONTINUOUS INTERNAL EVALUATION (TEST-3)
Course Code: 22CS2PLPYP Course Title: Introduction to Python Programing
Semester: Il Maximum Marks: 40 Date: 13-09-2023
Faculty Handling the Course: Prof. RM, Prof. RK, Dr. GSK, Prof. DK, Dr. CRD,
Dr. RS, Prof. LN
Common paper to all the branches in physics & PLCcycle
Instructions:
1. Q1to Q5 is compulsory and there is a choice between Q6 and Q7.
2
Missing Data may besuitability assumed

Questions Marks COs POs


1.Define the constructor inpython Object Oriented Programming? With the help of an
example, explain the use of the same.
2. Discuss the significance of regular expressions. Ilustrate any four metacharacters used 6 2
to evaluate the search patterns in regular expression.
3. Write a Python program that separate the integers and alphabets from the string given 6
below using regular expressions.
my_string-"We had Rava dosa for breakfast as 9:00 am and Sweets for Lunch
at 12:00 pm, today"
4. Write a python code to read atext file and append the file with the following lines and 6
output the updated file.
Linel: Welcome to Bengaluru' Line2: You are in Hanumanthnagar
Line3: This is Basavanagudi Line4: You are on Bull Temple road
LineS: Can see Big Bull Temple' Line6: Also Dodda Ganapathi Temple'
5. Write a Python program tocreate a class that can accept two numbers via the terminal
and perform addition, subtraction, multiplication, and division operations (basic
mathematicaloperations). The code should raise an exception if there is an error in the
input value.
6. Write a Python program which loops over a list of user data (tuples containing a 10 3 3
username, email and age) and adds each user to a directory if the user is at least 18 years
old. You do not need to store the age. Write a simple exception hierarchy which defines
a different exception for each of these error conditions:
the username is not unique
ii. the age is not a positive integer
iii. the user is under 18
iv. the email address is not valid
OR
7. Create a base class called *Parent" and a derived class called Children". In the
Parent 10 3
class, implement a constructor that takes the age and throws the exception ErrorAge()
when the age of the parent is less than or equal to zero. The difference in age betwee
parent and first child is 20 years. In the Children class, implement a constructor that
checks the age of the Parent and Children, which throws an exception if the age of the
children is greater than or equal to the age of the Parent. If the parents have three
children, the code should able to find the eldest and youngest among them.

You might also like