WORKSHEET – XI (1)
Chapter – 1: GETTING STARTED WITH PYTHON
1) When was Python released?
_____________________________________________________________________________
2) Who developed Python?
_____________________________________________________________________________
3) Is Python an Object Oriented Language?
_____________________________________________________________________________
4) “Python is an interpreted language”. What does it mean to you?
_____________________________________________________________________________
5) Python is a Free and Open Source language. What do you understand by this feature?
_____________________________________________________________________________
6) What does a cross platform language mean?
_____________________________________________________________________________
7) In how many ways, can you work in Python?
_____________________________________________________________________________
_____________________________________________________________________________
8) What is the difference between Interactive mode and Script Mode in Python?
_____________________________________________________________________________
9) What are the advantages of Python?
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
10) What are the limitations of Python?
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
WORKSHEET – XI (2)
Chapter – 2: PYTHON FUNDAMENTALS
i) What is None literal in Python?
_________________________________________________________________________________
ii) What is the error in following code: x, y =7 ?
_________________________________________________________________________________
iii) what will the following code do: a=b=18 ?
_________________________________________________________________________________
iv) Find the error in the following code:
(a) temp=90 (b) a=12 (c) print(“x=”x)
Print temp b=a+b
print( a And b)
(d) a, b, c=2, 8, 4 (e) x = 23 (f) else = 21-4
print(a, b, c) 4=x
c, b, a = a, b, c
print(a; b; c)
_______________________________________________________________________________
v) Find the error in the following code:
(a) y = x +5 (b) a=input(“Value: “) (c) print(x = y = 5)
print(x,y) b = a/2
print( a, b)
________________________________________________________________________________
vi) What factors guide the choice of identifiers in program?
________________________________________________________________________________
vii) What is the role of indentation in Python?
_________________________________________________________________________________
viii) What is the error in following Python program with one statement?
print(“My name is : “, name)
suggest a solution
_________________________________________________________________________________
ix)Predict output:
a,b,c=2,3,4
a,b,c=a*a,a*b,a*c
print(a,b,c)
_________________________________________________________________________________
x) WAP to print the area of circle when radius of the circle is given by user.
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
WORKSHEET – XI (3)
1) Identify the data types of the following values given bellow –
3, 3j, 13.0, “12”, “14”, 2+0j,19, [1,2,3], (3,4,5)
2) What will be the output of the following
(a)12/4 (b)14//14 (c)14%4 (d) 14.0/4 (e) 14.0//4 (f)14.0%4
3) What are data types? What is Python’s built-in core data types?
4) What are mutable and immutable types in Python? List both of them.
5) What will be the output of the following:
a=5-4-3
b=3**2**3
print(a)
print(b)
6) x = range(3, 6) x = range(1, 10,2)
for n in x: for n in x:
print(n) print(n)
7) Rewrite the following code fragment using for loop:
i=100
while(i>0):
print(i)
i-=3
8) Rewrite the following code fragment using while loop:
for i in range(1,10):
if i%3==0:
print(i)
9) If a is (1, 2, 3), is a *3 equivalent to a + a + a?
10) What is the difference between (30) and (30,)?
WORKSHEET – XI (4)
1) which of the following is not a Python legal string operation?
(a)‟abc‟+‟abc‟ (b) „abc‟*3 (c)‟abc‟ + 3 (d)‟abc‟.lower()
2) From the string S = “CARPE DIEM”. Which ranges return “DIE” and “CAR”?
3) Given a string S = “CARPE DIEM”. If n is length/2 then what would following return?
(a) S[:n] (b) S[n:] (c) S[n:n] (d) S[1:n] (e) S[n:length-1]
4) What would following expression return?
(a) ”Hello World”.upper().lower() (b) ”Hello World”.lower().upper()
(c) ”Hello World”.find(“Wor”,1,6) (d) ”Hello World”.find(“Wor”)
(e) ”Hello World”.find(“wor”) (f) ”Hello World”.isalpha()
(g) ”Hello World”.isalnum() (h) ”Hello World”.isdigit()
(i) “123FGH”.isdigit()
5) Find the output – if we give input as “Hello”
6) Start with the list[8,9,10]. Do the following using list functions
(a) Set the second entry (index 1) to 17 (b) Add 4, 5 and 6 to the end of
the list.
(c) Remove the first entry from the list. (d) Sort the list.
(e) Double the list. (f) Insert 25 at index 3
7) If a is [1, 2, 3], what is the difference (if any) between a*3 and [a, a, a]?
8) What is the purpose of the del operator and pop method? Try deleting a sliceDFHG
9) What is the length of the tuple shown below?
T = ((((„a‟, 1), ‟b‟, ‟c‟), ‟d‟, 2), ‟e‟, 3)
10) Find out the output generated by following code fragments:
(a) plane = (“Passengers”, ”Luggage”)
plane [1] = “Snakes”
(b) (a, b, c) = (1,2,3) (c) (a, b, c, d) = (1,2,3)
(d) a, b, c, d = (1,2,3) (e) a, b, c, d, e = (p, q, r, s, t) = t1