python- 4th sem
python- 4th sem
-·---·---.,.
~
MAULANA ABUL KAIAM AZAD UNIVERSITY OF TECHNOLOGY, WEST BENGAL
Paper Code: BCACA03 Python Programming
UPID: 400088
»> a={5, 4}
))) b={l,2,4,5}
»> a(b
<111 What is the extension of the Python file?
(Ill) What will be the output of the following Python program?
i =0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
!
i
I print(0)
!
/
jlVl Suppose listl is [2, 33, 222, 14, 25], What is listl[:-1]?
(¥( What will be the output of the,following Python code?
)))my_tuple = (1, 2, 3, 4)
)))my_tuple.append( (5, 6, 7))
.)))print len{my_tuple)
(Vil
(VII)
What will be the value of the following Python expression?
4+3%5
What will be the output of the following PythoH code?
(
print("Hello {0(0]} and {0(1]}".format(('foo', 'bin')))
(Y111l What will be the output of the following Python code?
~
1/2
II.
~ ~ - -......... ....,
(~;
,0
/
/
~ >» a=~,s,s)
>» b=(2, 8, ~
>» ~ ~•"--\:(~+ceb')
In python?
(Xl What is. the order of preceden
......
(XI) The process of pickling
in Python Includes _ _ __
following Python code?
1xnf What will be the output of the
>>>t = (1, 2, 4, 3, 8, 9)
2)]
»> [t[i ] for i in range(0, len( t),
stion)
Group-B (Short Answer Type Que { 5 X 3 = 15)
Answer any three of the following :
{5)
the same value for every class instance (object).
2. Define a property that must have [SJ
3. Define variable in Python? {SJ
4. Is elif a nested if in Python? (SJ
5. What are functions in Python? [SJ
nct integers.
ible unique subsets from a set of disti
6. Write a Python class to get all poss
)
Group-C (Long Answer Type Question [ 15 X 3 = 45]
Answer any three of the following :
[ 5]
7. (a) Define functions in Python. [ 10 J
ks whether the number i_s
a number as a parameter and chec
(b) Write a Python function that takes
prime or not. [ 10 J
Python?
disadvantages of using a for loop in
.8. (a) What are the advantages and [ 5]
t in a for loop in Pyth on?
{b) How can I use a break statemen [ 10]
on with an example.
'9. (a) Explain Inheritance in Pyth f5]
on?
{b) How are classes created in Pyth [ 15 J
name and student_class from
e a Python func tion student_data () that will take as argument student_
10. Writ
and class.
the user and print the student name [5J
in Python?
11. (a) How to comment multiple lines [ 10]
Explain with an example.
(b) What is a dictionary in Python?
2/2