XII Monthly test CS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Kendriya Vidyalaya, No.

1, Delhi Cantt (Shift-II)


Subject- Computer Science (083)
Class-XII (Monthly Test- April)
M:M: 35 Time: 1 Hr 30 Min

One Marks Questions (Q.No. 1 to 21)

1. Which of the following is valid arithmetic operator in Python:


(i) // (ii) ? (iii) < (iv) and
2. Write the type of tokens from the following:
(i) if (ii) roll_no
3. Name the Python Library modules which need to be imported to invoke the following functions:
(i) sin( ) (ii) randint ( )
4. What do you understand by the term Iteration?
5 Which is the correct form of declaration of dictionary?
(i) Day={1:’monday’,2:’tuesday’,3:’wednesday’}
(ii) Day=(1;’monday’,2;’tuesday’,3;’wednesday’)
(iii) Day=[1:’monday’,2:’tuesday’,3:’wednesday’]
(iv) Day={1’monday’,2’tuesday’,3’wednesday’]
6. Identify the valid declaration of L:
L = [1, 23, ‘hi’, 6].
(i) list (ii) dictionary (iii) array (iv) tuple
7. Find and write the output of the following python code:
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
8. Find and write the output of the following python code:
a=10
def call():
global a
a=15
b=20
print(a)
call()
9. Find the valid identifier from the following
a) My-Name b) True c) 2ndName d) S_name
10. Given the lists L=[1,3,6,82,5,7,11,92] , What will be the output of print(L[2:5])
11. Write the full form of IDLE.
12. Identify the valid logical operator in Python from the following.
a) ? b) < c) ** d) and
13. Suppose a tuple Tup is declared as Tup = (12, 15, 63, 80), which of the following is incorrect?
a) print(Tup[1]) b) Tup[2] = 90 c) print(min(Tup)) d) print(len(Tup))
14. Write a statement in Python to declare a dictionary whose keys are 1,2,3 and values are Apple, Mango and
Banana respectively.
15. A tuple is declared as T = (2,5,6,9,8), What will be the value of sum(T)?
16. Name the built-in mathematical function / method that is used to return square root of a number.
17. If the following code is executed, what will be the output of the following code?
str="KendriyaVidyalayaSangathan"
print(str[8:16])
18. Which of the following are valid operators in Python: (i) ** (ii) between (iii) like (iv) ||
19. Given the lists L=[“H”, “T”, “W”, “P”, “N”] , write the output of print(L[3:4])
20. What will be the output of: print(10>20)
21. Evaluate the following expression.
a) 51+4-3**3//19-3
2 MARKS QUESTIONS (Q.No. 21 to 27)

21. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the
code.
30=To
for K in range(0,To)
IF k%4==0:
print (K*4)
Else:
print (K+3)
22. What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from
the following code? Also specify the maximum values that can be assigned to each of the variables FROM and TO.
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=”# “)
(i) 10#40#70# (ii) 30#40#50#
(iii) 50#60#70# (iv) 40#50#70#
23. What do you understand by local and global scope of variables? How can you access a global variable inside the
function, if function has a variable with same name.
24. Evaluate the following expressions:
a) 8 * 3 + 2**3 // 9 – 4
b) 12 > 15 and 8 > 12 or not 19 > 4
25. Rewrite the following code in Python after removing all syntax error(s). Underline each correction done in the
code.
p=30
for c in range(0,p)
If c%4==0:
print (c*4)
Elseif c%5==0:
print (c+3)
else
print(c+10)

26. What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from
the following code? Also specify the maximum values that can be assigned to each of the variables Lower and Upper.
import random
AR=[20,30,40,50,60,70];
Lower =random.randint(1,4)
Upper =random.randint(2,5)
for K in range(Lower, Upper +1):
print (AR[K],end=”#“)
(i) 40# (ii) 40#50#60# (iii) 50# (iv) All of these

27. Rewrite the following code in python after removing all syntax errors. Underline each correction done in the code:
def func(a):
for i in (0,a):
if i%2 =0:
s=s+1
else if i%5= =0
m=m+2
else:
n=n+i
print(s,m,n)
func(15)

You might also like