Code: 20CS4T04 R20
SWARNANDHRA COLLEGE OF ENGINEERING &
TECHNOLOGY [AUTONOMOUS]
Seetharampuram, NARSAPUR-534 280
B. Tech IV Semester Regular Examinations
PYTHON PROGRAMMING
MECHANICAL ENGINEERING AND ROBOTICS
[OUTCOME BASED EDUCATION PATTERN]
Note: 1. The question paper consists of two parts (Part-A and Part-B)
2. Answer all questions from Part-A
3. Answer all questions from Part-B with either or choice
Duration: 3 Hours Max Marks: 70
PART-A (5x2=10M)
Cognitive
S No Question CO Marks
Level
a How to run python scripts in IDLE? K2 1 2
Write a python program and demonstrate What happens if a keyword
b is used as variable name K3 2 2
1 c What is the difference between ‘/’ and ‘//’ operators in python? K2 3 2
Justify your answer with an example
d Discuss about lambda function and their need with an example. K2 4 2
What is Encapsulation? Give a suitable example.
e K2 5 2
PART – B (5X12 = 60 M)
S. No Question Cognitive
CO Marks
Level
a K2 1 6
What is an expression? Explain the syntax of an expression in python
2 with suitable example.
b In how many modes we can write python programs? Give examples K2 1 6
for each mode.
OR
a Explain any three major differences between Python 2.x and 3.x with K2 1 6
3 examples.
Discuss about REPL shell in python programming with suitable K2 1 6
b examples
Does python support increment (++) and decrement(--) operators? K2 2 6
a How does python implement them, explain with suitable example
4 b Write a python program to print all prime numbers less than the given K4 2 6
number by user.
OR
List and explain membership and identity operators in python with K3 2 6
a suitable examples.
5
Write a python program to find factorial of a given number. K3 2 6
b
Write a python program to create, append and delete the elements in K3 3 6
6 a a list.
Discuss about the following dictionary built-in functions with an K3 3 6
b
example:
i) keys ii) values iii) items iv) clear v) update vi) copy
OR
a Explain the following list methods with an example: K2 3 6
7 i) remove ii) sort iii) reverse Iv) count
b Is the tuple mutable or immutable? Discuss. K4 3 6
a Explain about functions in Python, define arguments and parameters K2 4 6
with example.
8
b Differentiate function, module and packages with suitable K2 4 6
example
OR
Discuss about the following with an example: [12M] i) function ii) K2
a Recursion iii) Tail recursion.
9 4 6
b Explain the different ways of importing a packaging in python with a K3 4 6
suitable example.
Discuss the difference between an error and exception with suitable K2 5 6
a
examples.
10
Can a `except` block exist without at least one ` try` block ? Justify K3 5 6
b
your answer.
OR
a Define Inheritance? Explain the types of inheritances supported by K3 5 6
11 python with example.
b Write Program to handle : K2 5 6
i) ClassNotFoundException ii) FileNotFoundException Exceptions.