0% found this document useful (0 votes)
4 views

22CS2ESPYP

This document outlines the supplementary examination details for the Introduction to Python Programming course at B.M.S. College of Engineering. It includes instructions for answering questions, a breakdown of units with specific tasks related to Python programming concepts, and requirements for coding assignments. The exam covers topics such as string methods, functions, classes, and regular expressions.

Uploaded by

d3v1lsr
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)
4 views

22CS2ESPYP

This document outlines the supplementary examination details for the Introduction to Python Programming course at B.M.S. College of Engineering. It includes instructions for answering questions, a breakdown of units with specific tasks related to Python programming concepts, and requirements for coding assignments. The exam covers topics such as string methods, functions, classes, and regular expressions.

Uploaded by

d3v1lsr
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/ 3

U.S.N.

B.M.S. College of Engineering, Bengaluru-560019


Autonomous Institute Affiliated to VTU

October 2024 Supplementary Examinations

Programme: B.E. Semester: I / II


Branch: Common to all Branches Duration: 3 hrs.
Course Code: 22CS1ESPYP / 22CS2ESPYP Max Marks: 100
Course: Introduction to Python Programming

Instructions: 1. Answer any FIVE full questions, choosing one full question from each unit.
2. Missing data, if any, may be suitably assumed.
3. Write expected output for all programs

UNIT - I CO PO Marks
Important Note: Completing your answers, compulsorily draw diagonal cross lines on the remaining

1 a) Build a python code to demonstrate the working of a simple CO3 PO3 6


calculator with suitable output.
Analyze the below code, trace each iteration of “while” loop with
blank pages. Revealing of identification, appeal to evaluator will be treated as malpractice.

b) CO2 PO2 6
relevant explanation along with the final output.
i=0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
c) Define operator and operand. List all Arithmetic, Comparison and CO1 PO1 8
Logical operators used in Python with example
UNIT – II
2 a) Illustrate the following string methods with a relevant example CO1 PO1 4
i) len() ii)capitalize() iii) upper() iv) strip()
b) Develop a python program that inputs list elements from user and CO3 PO3 6
makes a new list that has only the even elements of this list in it.
c) Develop a Python Program to input a string to check whether it is CO3 PO3 6
a Palindrome string or not.
d) a=[‘hello’, ‘how’, [1,2,3], [[10,20,30]]] CO2 PO2 4
Analyze the above statement and predict the output for following
commands
(i) print( a[ : : ] )
(ii) print(a[-3][0])
(iii) print(a[2][ : -1])
(iv) print(a[0][ : : -1])
UNIT – III
3 a) Summarize functions in python with syntax for function definition CO1 PO1 8
and a relevant example.
b) Develop a python code to count the number of characters in the CO3 PO3 6
string and store them in a dictionary data structure.
c) Illustrate the difference between lists, tuples and dictionaries. CO1 PO1 6
OR
4 a) Elucidate tuple by demonstrating the creation of a single element CO1,3 PO1,3 7
in a tuple and develop a python program to find the common
elements between two tuples.
b) Analyze the below code which demonstrates user defined function CO2 PO2 6
to interchange first and last elements in a list. Complete the code
by filling in the missing values marked as “?” and explain the code
along with the expected output.

# Swap function
? swapList(List1):
size = ?(List1)
# Swapping
temp = List1[?]
List1[?] = List1[?]
List1[?] = temp
return List1
list1=[1,2,3,4,5]
list2=swapList(?)
print(list?)
c) Develop a program that combines two lists into a dictionary CO3 PO3 7
without using builtin function “zip”.
UNIT - IV
5 a) Create a class Employee to have the following: CO3 PO3 10
• Variables: emp_id, designation
• A constructor to initialize these values
• A method salary_calc that accepts basic salary as
parameter, adds 10000 if designation is “clerk” and adds
12000 if designation is “Manager”.

Create 2 objects and call the appropriate method.


b) Demonstrate “try” and “except” which checks for user defined CO1 PO1 10
exception call with suitable example
OR
6 a) Demonstrate the following with supporting code snippets CO1 PO1 9
i) class ii) objects iii) inheritance
b) Develop a python code to demonstrate “ValueError” exception CO3 PO3 5
and “ZeroDivisionError” exception with all possible outputs
c) Summarize the concept of constructor object lifecycle in Python CO1 PO1 6
with relevant example
UNIT - V
7 a) Elucidate regular expressions and list any five Meta-characters or CO1 PO1 10
wild card characters used in regular expressions with supporting
examples.
b) Develop a program to compute the number of characters, words CO3 PO3 10
and lines in a file.

******

You might also like