Python KNC302 2020-21 AKTU QPaper
Python KNC302 2020-21 AKTU QPaper
B.TECH
(SEM III) THEORY EXAMINATION 2020-21
PYTHON PROGRAMMING
Time: 3 Hours Total Marks: 100
Note: 1. Attempt all Sections. If require any missing data; then choose suitably.
SECTION A
1. Attempt all questions in brief.
Q no. Question Marks CO
a. What is the use of “raise” statement? Describe with an example. 2 5
SECTION B
2. Attempt any three of the following:
Q no. Question Marks CO
a. Write a Python function removekth(s, k) that takes as input a 10 5
string s and an integer k>=0 and removes the character at index k. If k
is beyond the length of s, the whole of s is returned. For example,
SECTION C
3. Attempt any one part of the following:
Q no. Question Marks CO
a. How can you create Python file that can be imported as a library as well 10 5
as run as a standalone script?
makePairs([1,3,5,7],[2,4,6,8])
returns [(1,2),(3,4),(5,6),(7,8)]
makePairs([],[])
returns []
triangle(3) prints:
*
**
***
triangle(5) prints:
*
**
***
****
*****