11th Revision Set1
11th Revision Set1
INSTRUCTIONS
● This question paper contains five sections, Section A to E.
● All questions are compulsory.
● Section A consists of 10 questions carrying 1 mark each.
● Section B has 5 Very Short Answer type questions carrying 2 marks each.
● Section C has 4 Short Answer type questions carrying 3 marks each.
● Section D has 2 Long Answer type questions carrying 4 marks each.
● Section E has 2 questions carrying 5 marks each.
● All programming questions are to be answered using Python Language only.
SECTION A
1. Which function is used to convert string into tuple?
a) string() b) tup() c) str_tuple() d) tuple()
2. Ansh is working in python interactive mode. He noticed this symbol >>> but forgot what
it is called? Select an appropriate option for him out of these?
a) Python Shell b) Python Script c) Python prompt d) Python Interpreter
3. What is the output of ?
Str=""
print(Str.isalpha())
4. What is the output of this expression 2*3**3*4?
a) 216 b) 72 c) 864 d) Error
5. Predict the output of the following code?
for x in range(5):
print(x,end=" ")
a) 1234 b) 0 1 2 3 4 c) 0 1 2 3 4 5 d) 12345
6. Consider the list alist=[“SIPO”,[1,3,5,7]]. What would the following code print?
print(alist[0][1],alist[1][1])
a) S 3 b) S,1 c) I,1 d) I 3
7. Which of the following is not a declaration of the dictionary?
a) {} b) {1,”A”,2 “B”} c) {1:’A’, 2: ‘B’} d) dict([[1,‘A’],[2,‘B’]])
8. What will be the output of the following code?
import math
print(int(math.pow(2,5)))
print(math.floor(67.2))
1-SKI-CS(083)
Q.Nos.9 and 10 are ASSERTION (A) And REASON (R) based questions. Mark the correct
choice as
a) Both A and R are true and R is the correct explanation for A
b) Both A and R are true and R is not the correct explanation for A
c) A is True but R is False
d) A is false but R is True
9. Assertion (A): A dictionary is an unordered collection of data that can be duplicated.
Reason (R): In Python, a dictionary is a collection of keys and their values. A key
along with its corresponding value is collectively known as the key-value
pair by placing the elements within {} braces.
10. Assertion (A): Syntax errors occurs when the grammar of the programming statements
are not followed properly.
Reason (R): A logical error is the error made in planning of the program’s logic due to
which the desired output is not obtained.
SECTION B
11. Rewrite the following program after correcting the errors and underlining it. [2]
N=input("Enter a number")
A=10
while (N<A)
print(N)
N=N+1
print(N-a)
12. Rewrite the following code using while loop: [2]
num=-5
min=0
max=0
if num < 0:
min=num
max=0
sum=0
for i in range(min,max+1):
sum+=i
print(min,max,sum)
13. Find the possible outputs at the time of execution of the program from the following [2]
code. Also specify the maximum values of variables Lower and Upper.
import random
AR=[20,30,40,50,60,70]
Lower=random.randint(1,3)
Upper=random.randint(2,4)
for k in range(Lower, Upper+1):
print(AR[k], end= “#”)
14. Write a program that accepts a string and check whether it is a palindrome or not. [2]
2-SKI-CS(083)
15. D={‘apple’ : 5, ‘orange’ : 20} is a dictionary in python. [2]
i) Write a python statement to add a new element ‘banana’:20 in the dictionary D.
ii) Write a python statement to change the value of apple to 10 in the dictionary D.
SECTION C
16. a) Write a program in python that accepts sales and customer number from the user and [2]
calculate the net amount which the customer has to pay after availing discount(if any).
The company gives an extra 2% discount on the net amount to every 50 customers. The
discount details given below:
Sales >=10000 the discount will be 35% of sales
Sales < 10000 and >=5000 the discount will be 25% of sales
Sales < 5000 and >=1000 the discount will be 15% of sales
b) Consider the following code and predict the output. [1]
Flowers=(“ROSE”, “LOTUS”, “LILY”, “LAVENDER”, “HIBISCUS”)
(a,b,c,d,e)=Flowers
print(a[2]+c)
17. a) Predict the output of the following code: [1]
s='mahendra singh dhoni'
s1=s.split()
for i in s1:
if(i>'n'):
print(i.upper())
else:
print(i)
b) Consider the following code and predict the output. [1]
m1={‘J’ : “Jan”, ‘F’ : “Feb”, ‘M’ : “Mar”, ‘A’ : “Apr”, ‘N’ : “May”}
m2=m1.copy()
m3=m2
m2[‘M’]=”March”
print(m1[‘M’], m2[‘M’], m3[‘M’])
c) Predict the output of the following code. [1]
L=[2,3,4,6,9,3,8,9]
print(L.index(4))
print(L.count(3))
L.append(L.count(9))
print(L)
18. a) Which type of error occurs when you execute the following code? [2]
(Syntax Error, Name Error, Value Error, Type Error)
i) Fruit=apple ii) int(‘11.23’) iii) ‘abc’+4-4 iv) 2=6
b) Using the given values x=5,y=6,z=20 evaluate the following: [1]
print((x >=y) and (not(z == y)) or (z < x))
3-SKI-CS(083)
19. a) Write a program to print the following pattern: [2+1=3]
12345
1234
123
12
1
b) Differentiate between pop() and popitem() functions in the dictionary by giving examples
for each.
20. a) Predict the output of the following code: [2]
d={1: “Amit”, 2: “Sumit”, 3: “Taniya”}
print(d.get(2))
d.pop(3)
print(d)
d.clear()
print(d)
a=list(d.items())
print(a)
b) S= ‘&&&&&&&&&& Computer World #########’ [1]
Write a statement to remove leading ‘&’ and trailing ‘#’ signs.
SECTION D
20. a) Write a program that repeatedly asks the user to enter product names and prices. Store [2]
all of them in a dictionary whose keys are product names and values are prices. And
also write a code to search an item from the dictionary.
For example:
Input: D={‘eraser’:10, ‘pen’:25, ‘pencil’:10}
Output: Enter the product you want to search: pencil
Product found with price: 10
b) What is the output of the following code? [2]
L=[25,8,75,12]
for i in range(4):
if L[i] % 5 == 0:
L[i] //= 5
if L[i] % 3 == 0:
L[i] //= 3
for i in L:
print(i, end='#')
21. a) Write a function mlist(L) which accepts a list of numbers as an argument and increases [2]
the value of the elements by 10 if the elements are divisible by 5. Also write a proper call
statement for the function.
For example:
Input: L=[3,5,10,12,15]
Output: L=[3,15,20,12,25]
4-SKI-CS(083)
b) Which of the following statements will produce an error as well as find the output? [2]
m=(1,2,3,4)
m.append((5,6,7,8))
print(len(m))
m.pop(2)
print(m)
SECTION E
22. a) Predict the output of the following code [2]
text=['g','i','v','e','i','t','@','T', 'r','y','!']
print(text)
for L in range(len(text)-1,-1,-1):
if text[L].islower():
text[L]=text[L].upper()
elif text[L].isspace():
text[L]=text[L-1]
else:
text[L]=text[L-1]
print(text)
b) Write a program to print the following series 1 4 7 10 ………… 40 [1 ½]
c) Write a program to input ‘n’ numbers and store it in tuples. [1 ½]
23. a) Suppose d={“rachna”: 11, “sagar” : 45}, to delete the entry for “rachna”. What [1]
command do we use?
b) What value will be returned, if x=math.ceil(4.4)? [½]
c) Predict the output of the following code: [1 ½]
a=30
def call(x):
if x%2==0:
x+=a
else:
x-=a
return x
print(call(35),end='#')
print(call(40),end="@")
d) Write a user - defined function parser(L) that accepts a list as parameter and creates [2]
another two lists storing the numbers from the original list, that are even and numbers that
are odd.
****************** ALL THE BEST *****************
5-SKI-CS(083)