Class Xi Comp Science PDF
Class Xi Comp Science PDF
10. What do you mean by comment line in python? Explain its type 2
11. What is the difference between interactive mode and script mode in Python? 2
Section - C
16. Write a python program to find max among three input numbers? 3
17. Write a Program in Python to obtain the Grade of a student based on the following 3
criteria
Marks obtain Grade
Less than 33 D
33 to 44 C
45 to 59 B
60 and above A
APEEJAY SCHOOL FARIDABAD
Monthly Test- II 2022-23
CLASS XI
SUBJECT: COMPUTER SCIENCE
Time Allowed: 1Hr Max Marks: 25
Note :
Answer the questions after carefully reading the text.
Please write down the serial number of the question before attempting it
1. Multiple Choice Questions 1*5=5
i. Consider a tuple in python named Months = (‘Jul’, ‘Aug’, ‘Sep’). Identify the
invalid statement(s) from the given below statements:-
a)S = Months[0] b)print(Months[2])
c) Months[1] = ‘Oct’ d)LIST1 =list(Months)
iii. a=[30,23,56,[78]]
b=list(a)
a[3][0]=46
a[1]=34
print(b)
iv. T=[‘kvs’,’rpr’]
T1=range(len(T))
for i in T1:
T[i]=T[i].upper()
print(T)
v. arr = [[1, 2, 3, 4], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]]
for i in range(0, 4):
print(arr[i].pop())
20. What are membership operators? Explain their use with an example. 2
21. What is the role of indentation in python? 2
22. Name the function: 2
i. To determine type of an object
ii.returns true if all the letters in the string are in uppercase.
23. What is the difference between an expression and a statement in Python? 2
24. How many times is the word ‘Python’ printed in the following statement? 2
s = ”I love Python”
for ch in s[3:8]:
print(‘Python’)
25. ‘Comments are useful and easy way to enhance readability and understandability of a program”. 2
Elaborate with example
26. What will be the output: 2
((ch+i)/db), if
i. ch=5, i=2, db=5.0
ii. ch=36.0, i=5.0, db=5.0
27. What would be the output of the following code, if the input is: i)aaccbb ii)abccb 2
s=input("Enter a string")
count=3
while True:
if s[0]=="a":
s=s[2:]
elif s[-1]=="b":
s=s[:2]
else:
count+=1
break
print(s)
print(count)
28. What will the code written below calculating?
2
33. What is the utility of these software? (a) disk fragmentor (b) backup software 2
General Instructios :
Answer the questions after carefully reading the text.
Please write down the serial number of the question before attempting it
Section C
3 a) If we have list L and tuple T, 2
T[i]=element and L[i]=element , then which statement is valid & why?
b) What possible outputs(s) are expected to be displayed on screen at the time of 2
execution of the program from the following code? Also specify the maximum
values that can be assigned to each of the variables.
import random
x=random.random()
y=random.randint(0,4)
print(int(x),":",y+int(x))
for K in range(int(x), +1):
print (K,end="#")
(i) 0:0
0#
(ii) 1:3
1#2#3#
(iii) 0: 4
0#1#2#3#4
(iv) 0:3
0#1#2#3#
c) Find the output of the following program: 2
Moves=[11, 22, 33, 44]
Queen=Moves
Moves[2]+=22
L=len(Moves)
for i in range (L):
print("Now@",Queen[L-i-1],"#", Moves[i])
d) Examine the code:
tuple1 = (11, 22, 33, 44, 55 ,66)
list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple) 2
i. What is the program calculating? 2
ii. Can we change append with extend? Justify your answer with explanation
e) Name the function: 2
i. To check whether string contains digit
To delete an element from the end of list.
f) What would be the output of the following code, if the input is: i)aaccbb ii)abccb 2
s=input("Enter a string")
count=3
while True:
if s[0]=="a":
s=s[2:]
elif s[-1]=="b":
s=s[:2]
else:
count+=1
break
print(s)
print(count)
Section D
3 a) Write a program to input n numbers and to insert any number in a particular 2
position.
b) What would be the output of the following code: 2
list1 = ["python", "list", 1952, 2323, 432]
list2 = ["this", "is", "another", "list"]
print(list1[1:4])
print(list1[1:])
print(list1[0])
print(list1 * 2)
print(list1 + list2)
c) What will be the output of the following Python code? [A] 2
tr="Python123.com"
for i in range(len(str)):
if(str[i].isalpha()):
print(str[i-1],end='')
if(str[i].isdigit()):
print(str[i],end='')
d) Write a program that prompts the user for a string s and a character c, and 3
outputs the string produced from s by capitalizing each occurrence of the
character c in s and making all other characters lowercase.
For example, if the user inputs "Mississippi" and "s", the program outputs
"miSSiSSippi".
e) Write Python program that search for prime numbers from 15 through 25 3
e) Marks of three students “Arya”, “Romil”, “RItesh” in three subjects are available 3
in following three dictionaries respectively:
d1={1:40,2:70,3:60}
d2={1:50,2:80,3:80}
d3={1:70,2:90,3:70}
Create a nested dictionary that stores the marks details along with student
names and then prints the output as shown below:
Name: Arya
Subject(Key) Marks(Value)
1 40
2 70
3 60
Name: Romil
Subject(Key) Marks(Value)
1 50
2 80
3 80
Name: Ritesh
Subject(Key) Marks(Value)
1 70
2 90
3 70