Xi Second Fifty
Xi Second Fifty
Second 50 % EXAMINATION
COMPUTER SCIENCE
CLASS: XII Commerce
Time Allowed: 3 hr Maximum Score:70
General Instructions:
l1=[10,20,30,40,50,60,10,20,10]
print(l1.count(10))
16. What will be the output
d1={‘rohit’:56,”Raina”:99}
print(“Raina” in d1)
a) True b) False c) No output d) Error
17.Assertion (A): Python allows function arguments to have default values; if the
function is called without the argument, the argument gets its default value.
Reason (R): During a function call, the argument list first contains default
argument(s) followed by positional argument(s).
18.
19. Define mutable and immutable data types?
20. What will be the output of the following code snippet?
M=”I#N#F#O#R#M#A#T#I#O#N#”
print(M.split("#")[2:-1])
a. ['F', 'O', 'R', 'M', 'A', 'T', 'I', 'O', 'N', '']
b. ['F', 'O', 'R', 'M', 'A', 'T', 'I', 'O', 'N']
c. ['I', 'N','F', 'O', 'R', 'M']
d. None of the above
21. Consider the code snippet given below. Find the output.
a = (5, (7, 5, (1, 2) ), 5, 4)
print((a[1][2][1],)*3)
a. (2,2,2) b. ((1,2),(1,2),(1,2)) c. 6 d.
Error
Section B
22. Identify the correct output(s) of the following code. Also write the minimum and
the maximum possible values of the variable
import random
a="Wisdom"
b=random.randint(1,6)
for i in range(0,b,2):
print(a[i],end='#')
(A) W# (B) W#i# (C) W#s# (D) W#i#s#
23. What will be the output of the following statements?
list1 = (1,2,3,4,5,6,7,8,9,10)
print(list1[::-2])
print(list1[:3] + list1[3:])
24. If d1={'a':'apple','b':'bat','c':'cat'} then, Answer using builtin functions only
i. Write the statement to returns the value of the item with the specified key
‘a’ in dictionary d1.
ii. Write the statement to Remove the last item from the dictionary
25. Write the queries for the following questions using the table Product with the
following fields. (P_ Code, P_Name, Qty, Price)
(i) Display the price of product having code as P06.
(ii) Display the name of all products with quantity greater than 50 and price
less than 500
26. a) What is the output produced by the following code –
d1={5:[6,7,8],”a”:(1,2,3)}
print(d1.values())
b) What is the length of the tuple shown below?
T=((((‘a’,1),’b’,’c’),’d’,2),’e’,3)
27. Identify the correct output(s) of the following code. Also write the minimum and
the maximum possible values of the variable final.
import random
elements=[180,90,77,65,33,12,54,4,219]
beg=random.randint(1,4)
final=random.randint(beg,5)
for z in range(beg,final+1):
print(elements[z],"@")a=(1,2,3)
a) 90@ b. 90@ c. 180@ d. 90@
77@ 70@ 12@ 4@
65@ 54@
33@ 4@
Section C
28.