You are on page 1of 2

School of Computing and Information Technology

IA1 – Even semester – June-- 2021


Course Code: B20CI0101 Course: Introduction to Python Programming
nd
Semester: 2 QP SET: 1

Time: 1.5 Hours Max. Marks: 30

Note: Answer ONE FULL question from each section. Marks CO PO PSO

UNIT – I
1. a) To solve a real-world problem statement, before writing the actual 05 C 1 to 1
program we can write the design part in the form of algorithm. A user O 4
1
with name 'X' has to write the program to find the area of circle, help
him in writing the program by designing the algorithm and flowchart to
find the area of circle.
b) What are I/O devices? List and Explain various I/O devices. 08 C 1 to 1
O 4
1
c) "List1" is a list that contains "n" different SRN of students read using a 07 C 1 to 1
user defined function with the help of input(). SRN of "m" more O 4
1
students are to be appended or inserted into "List1" at the appropriate
place and also return the index of the SRN entered by user.
OR
2. a) User 'A' wants to write the program in python programming language, 04 C 1 to 1
but he doesn’t know the rules which must be followed while using O 4
1
variables. Help the user by listing the various rules to be followed while
using the variables in Python programming language.
b) The Dictionary "Dict1" contains "n" Elements and each element has the 08 C 1 to 1
operator as the key and operands as values. Write a python program O 4
1
where in the User performs the operation on the elements of "Dict1"
based on the operator using a user defined function and displays the
results.
c) Student 'Y' wants to find the sum of natural numbers beginning from 1 04 C 1 to 1
up to some end limit 'n' by reading the end limit form the user. Write a O 4
1
python program which can be used by student 'Y' to find the sum of the
series.
d) Functions are the reusable code which will be written once and can be 04 C 1 to 1
invoked for any number of times. Write a python program to find the O 4
1
sum of 2 integers and 2 floats by defining one user defined function.
UNIT – II
3. a) string containing multiple words is to be read from the user one at a time 04 C 1 to 1
and O 3, 5,
i) convert all the strings to uppercase and 2

Page 1 of 2
ii) split the words of a string using comma as the separation character.
b) Assuming that variable forecast has been assigned string 'It will be a 06 C 1 to 1
sunny day today', write Python statements corresponding to these O 3, 5,
2
assignments:
(i) To variable count, the number of occurrences of string 'day' in string
forecast.
(ii) To variable weather, the index where substring 'sunny' starts.
(iii) To variable change, a copy of forecast in which every occurrence of
substring 'sunny' is replaced by 'cloudy'.
OR
4. a) A substring "Substr" between index1 and index2 is to be extracted from 05 C 1 to 1
the given input string, "Str1", which is read using input() and display the O 3, 5
2
substring "Substr" using a user defined function.
b) To compare two strings, we need to compare each and every character in 05 C 1 to 1
both the strings. Student 'X' has to compare 2 strings and he must be able O 3, 5
2
to conclude whether string1 is equal to string2, string1 is greater than
string2 or string1 is less than string2. Write a python program which can be
used by user 'X' in order to compare two strings.

Page 2 of 2

You might also like