Professional Documents
Culture Documents
Python Revision Tour-1 Worksheet
Python Revision Tour-1 Worksheet
MADHAVARAM
Class:12
PYTHON REVISION TOUR -1 WORKSHEET
print(NUM1)
2. int(‘X’) produces error but the expression
len(‘X’) or int(‘X’) will not. Why?
3. What is the output of the statement
print(print(print(“Jackfruit”,end=”***”)))
4. Consider the loop given below:
for I in range(-50):
print(i)
How many times will this loop run
5. Write the output for the following code.
X=100
P=10
Q=25
if P%6==0:
X+=100
else:
X+=50
Sum=P+Q+X
print(P,'#',Q,'$',Sum)
6. What will be the output of the following statement?
print(2+9*((3*12)-8)/10)
14.print(5-(2+3)*99/11+2**3**2)
15. What possible outputs(s) are expected to be displayed on screen at the time of
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end="#")
26. Which of the following statement converts a tuple into a list in Python:
(i) len(string) (ii)list(tuple) (iii)tup(list) (iv)dict(string)
27. Name of the process of arranging array elements in a specified order is termed as
i)indexing ii)slicing iii)sorting iv) traversing
28. What type of value is returned by input() function by default?
i)int ii)float iii)string iv)list
29. Write the output of the following python code:
x = 123
for i in x:
print(i)
i)1 2 3 ii) 123 iii)infinite loop iv) error
30. write the ouput of following code
A = 10/2
B = 10.0//3
print(A,B)
i)5,3.3 ii) 5.0 , 3.3 iii) 5.0 , 3.0 3 iv) 5,4
31. Name the built-in mathematical function / method that is used to return square
root of a number.
i)SQRT() ii)sqrt() iii) sqt() iv) sqte()
32. i.print( (3-10**2+99/11))
ii. print( not 12 > 6 and 7 < 17 or not 12 < 4)
iii. print( 2 ** 3 ** 2)
iv. print(7//5+8*2/4-3)
v. print(not False and True or False and True)
33. Differentiate between break and continue statement used in python.
What is comment in python ? Explain its significance.
Explain the types of errors occurring in python programming language.
Differentiate between type conversion and type casting in python with examples.
Explain mutable and immutable objects in python with examples.
What is the use of else statement in for loop and in while loop ? Explain.
c. Dictionaries are also called mappings or hashes or associative arrays
34. State True or False
“break keyword skips remaining part of an iteration in a loop and compiler goes
to starting of the loop and executes again”
35. Which of the following are random number generators ?
(a) randint() (b) randrange() (c) random() (d) All of these
36. Which of the following are sequence of character data?
(a) Lists (b) Tuples (c) Strings (d) Dictionaries
37. a = 1.0
b = 1.0
c=float(input("enter")) #c=1.0
print(a is b)
print(a is c)
38. a = 6
b = 5.5
sum = a+b
print(sum)
print(type (sum))
39. print(print("Biscope"))
40. in and not in are.......Operators. (a) Arithmetic (b) Membership (c) Logical (d)
Identity
41. which of the following operator cannot be used with string data type?
(a) + (b) in (c) * (d) /
44. mul=3
value=10
type (name)
47. b = 1
b += a + 2
print(b)
48. Predict the output of the following program:
a=5
b = a = 15
c = (a <
15)
print (“a = ”, a)
print (“b = ”, b)
print (“c = ”, c)
49. for i in range (-5,-7,-1):
print (i + 1)
50. a, b = 10, 5
x, y = a + b, b -2
z=x–y
51. State True or False : “All elements in Python list must be of same data type
(a) print('hello',end='%',sep='#')
(b) print('hello',sep='#',end=’%’)
i) PHYPHY
CHEMCHEM
MATHSMATHS
COMPCOMP
ii) PHY
PHYCHEM
PHYCHEMMATHS
iii) PHY
CHEMCHEM
COMPCOMPCOMP
v) PHY
CHEM
MATHS
COMP
56. State True or False:
“The else part of a loop gets executed only when a break statement terminates it.”
57. Evaluate the following expression and identify the correct answer.
5-(2+3)*99/11+2**3**2
58. What possible outputs(s) are expected to be displayed on screen at the time of
execution of the program from the following code
import random
AR=[20,30,40,50,60,70];
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end="#")
62. State True or False: “In Python, the result of sorted() is always a tuple.”
64. x="abcdef"
i="i"
while i in x:
print(i,end="")
T=2
for i in S:
print(i,sep="$",end="@")
if (1,2):
print(T)
elif[]:
print(S)
x= range(10,5,-3)
for y in x:
print(y)