2
KENDRIYA VIDYALAYA SANGATHAN : HYDERABAD REGION
SUBJECT : COMPUTER SCIENCE - CLASS 12
STUDY MATERIAL PREPARATION
SNO NAME OF THE KV TOPIC ALLOTTED
TEACHER
1 Mr PRABODH SURYALANKA REVISION OF PYTHON TOPICS COVERED
DINAKAR in Class XI.
MULTIPLE CHOICE QUESTIONS
1 Find the valid identifier from the following
1. 2_Myname
2. My name
3. True
4. Myname_2
Answer is:4
2 Which of the following will give output as [23,2,9,75] .If L=[6,23,3,2,0,9,8,75]
1. print(list1[1:7:2])
2. print(list1[0:7:2])
3. print(list1[1:8:2])
4. print(list1[0:8:2])
Answer is:3
3
Which of the following operator can be used with string data type?
1. ** 2. % 3. + 4. /
Answer is:3
4 Consider a tuple T = (10, 15, 25, and 30). Identify the statement that will result in an error.
1. print(T[2]) 2. T[3] = 19 3. print(min(T)) 4. print(len(T))
Answer is: 2
5
Which of the following symbol is used in Python for Multiline comments line comment?
1. /*** 2. /* 3. „‟‟ 4. #
Answer is:
6
Identify the output of the following Python statements.
3
x = [[10.0, 11.0, 12.0],[13.0, 14.0, 15.0]]
y = x[1][2] print(y)
1. 12.0 2. 13.0 3. 14.0 4. 15.0
Answer is: 3
7
Identify the output of the following Python statements.
L= [10, 15, 20, 25, 30]
L.insert( 3, 4)
L.insert( 2, 3)
print (lst1[-5])
1. 2 2. 3 3. 4 4. 20
Answer is:2
8
Which of the following properly expresses the precedence of operators (using parentheses) in
the following expression: 5*3 > 10 and 4+6==11
1.((5*3) > 10) and ((4+6) == 11)
2.(5*(3 > 10)) and (4 + (6 == 11))
3.((((5*3) > 10) and 4)+6) == 11
4.((5*3) > (10 and (4+6))) == 11
Answer is : 1
9
What will be the output of the following Python code?
i=1
while True:
if i%0O7 == 0:
break
print(i)
4
i += 1
1. 1 2 3 4 5 6
2. 1 2 3 4 5 6 7
3. error
4. none of the mentioned
Answer is: 1
10
values = [1, 2, 3, 4]
numbers = set(values)
def checknums(num):
if num in numbers:
return True
else:
return False
for i in filter(checknums, values):
print i
1. 1 2 3 4 2. 1 2 3. 3 4 5. 2 3 4
Answer is:1
CASE STUDY QUESTIONS (R)
1
Based on the following code answer the questions
import ___________________ #1
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
5
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end=”#“)
1. What module should be imported To execute the above code #1?
(I) math (II) random (iii) pickle (iv) csv
Answer is: ii
2
What will Be the maximum value of the variables FROM and TO?
(i) 3,4 (ii) 4,3 (iii) 2,4 (iv) 4,2
Answer is : I
3
What will Be the minimum value of the variables FROM and TO?
(i) 2, 1 (ii) 1, 2 (iii) 1, 3 (iv) 1, 4
Answer is: ii
4
What possible outputs(s) are expected to be displayed on screen at the time of execution
of the program?
(i) 10#40#70# (ii) 30#40#50# (iii) 50#60#70# (iv) 40#50#70#
Answer is: ii
5
What will be the output of random.random ( )
(i) 2 (II) 3.2 (iii)0.82 (iv) -0.32
Answer is : ii
6 Ramu write a list program as shown below .based on the code answer the questions
data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] #1
def fun(m):
6
print(m) #2
v = m[0][0]
print(v) #3
for row in m:
for element in row:
if v < element:
v = element
return v
print(fun(data[0])) #4
(1) The declaration of the LIST data is called
(i) Local (ii) Global (iii) local and global (iv) none of the above
Answer is : 2
7
What will be printed after execution of the line #2 ?
(i) [1,2] (ii) [[1, 2], [3, 4]] (iii) [[5, 6], [7, 8]] (iv) [5,6]
Answer is:ii
8
What will be printed after execution of the line #3 ?
(i) 4 (ii) 5 (iii)2 (iv)1
Answer is: iv
9
What will be last line of the output after execution of the line #4 ?
(i) 4 (ii) 5 (iii)2 (iv)1
Answer is: i
10
What will be the last line of the output of the above code, if line #4 is replaced with print
(fun (data (1)) ?
(i) 8 (ii) 5 (iii)2 (iv)1
Answer is: i