Python Assign1 2024-25 f
Python Assign1 2024-25 f
SL QUESTIONS MARKS
NO
MODULE 1
1 What is Arithmetic expression, what is the output of this statement ‘hello 7
world’+100+’how are you’ explain the reason if the statement produce an error.
2 (a). What is flow control statement? Discuss if and if else statement with flow chart. 8
(b). Explain looping control statement in python with syntax and example to each.
3 With Python programming example to each, explain the syntax and control flow diagram 6
of break & continue statement.
4 Explain two ways of importing modules into application in python with syntax and suitable 7
programming example.
5 What is function? How to define function in Python? Explain with suitable example. 7
6 Explain local & global scope of a variable in python with example? 6
Explain four scope rules of variable in python.
7 What is exception handling? How exception are handled in python. WAPP with exception 7
handling code to solve divide by zero.
8 a) Explain the math operators in python from highest to lowest precedence with example 7
for each. Show steps to evaluate (5-1)*(7+1)(3-1) in python.
b) List and define comparison operators in python. Write the output for the following
expression in python
i) 2**3 ii) 20%6 iii) 20/6
9 Give one example for each of the operation below in python language 8
a) String concatenation & replication
b) Read input & display
10 Explain 7
i) def statement with parameters.
ii) return value & return statement with example.
MODULE 2
13 Explain append (), index (), copy.copy() & copy.deep copy() function with respect to lists in 7
python.
14 What is a list? Explain the concept of list slicing with example. 8
i) print(a[::])
ii) print(a[-3][0])
18 (a) Develop a program to read the student details like Name, USN, and Marks in three 5+5
subjects. Display the student details, total marks and percentage with suitable messages.
(b) Develop a program to read the name and year of birth of a person. Display whether the
person is a senior citizen or not.
19 Read a multidigit number from console. Develop a program to print the frequency of each digit 6
with a suitable message.
20 Explain different steps involved in clipboard function of Wiki markup, with a suitable python 8
program.
21 Compare list and dictionary data structure with respect to python language. 6
22 Explain the following with an example. 12
a) keys() b) values() c) items() d) get() e) setdefault()
f) pretty print
23 i) Develop a python program for tic tac toe board. 8+5
ii) Define dictionary. With an example explain nested dictionary.
CBIT-KOLAR
MODULE 3
24 Explain python string handling method with examples. 5
a) split( ) b) endswith( ) c) ljust() d) center() e) lstrip()
25 Explain reading and saving python program variables using shelve module with a suitable 7
python program.
26 Explain python string handling methods with examples 5
a) join() b) startswith() c) rjust() d) strip() e) rstrip()