0% found this document useful (0 votes)
4 views4 pages

HolidayHomework XII CS LSPAL

This document contains a worksheet for Class XI students at Kendriya Vidyalaya Kandhamal, focusing on Python programming and functions. It includes multiple choice questions, short answer questions, and long answer questions designed to test students' understanding of Python concepts. The questions cover various topics such as operators, list manipulation, function definitions, and code debugging.

Uploaded by

guyrhh6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

HolidayHomework XII CS LSPAL

This document contains a worksheet for Class XI students at Kendriya Vidyalaya Kandhamal, focusing on Python programming and functions. It includes multiple choice questions, short answer questions, and long answer questions designed to test students' understanding of Python concepts. The questions cover various topics such as operators, list manipulation, function definitions, and code debugging.

Uploaded by

guyrhh6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

KENDRIYA VIDYALAYA KANDHAMAL

Worksheet- I for Chapter –I & II [Revision tour of Class XI python & Functions]
[Multiple Choice Questions]
Q1. Which of the following, value of a=5 // 10 * 9 % 3 ** 8 + 8 – 4:
(A) 10.90 (B) -4.0 (C) 4 (D) Error (E) None of these
Q2. Which of the following is output of Python program code:
def check(x,y):
if x != y:
return x+5
else:
return y+10
print (check (10,5))
(A) 1.5 (B) 10 (C) 15 (D) x+y
Q3. Which of the following are in-valid operators in Python?
(A) += (B) ^ (C) =+ (D) &&
Q4. A Python List is declared as Stud_Name = ['Aditya', 'aman', 'Aditi','abhay']
What will be the value of min(Stud_Name)?
(A) abhay (B) Aditya (C) Aditi (D) aman
Q5. Which of the following function headers is correct?
(A) def f(a=2,b): (B) def f(a=3,b,c=6): (C) def f(a=3,b=1,c=6): (D) def f(a=3,b=1,c=6,d):
Q6. What type of the k value?
l=[1,2,5,6,7,9,10,22,38]
k=[e1*r for e1 in l if (e1-4)>1 for r in l[:4]]
print(k)
(A) int (B) bool (C) tuple (D) list (E) None of these
Q7. Fill in the blank of code for calculating the factorial of number:
def fact(num):
if (num ==0):
return 1
else:
return ________________
(A) num*fact(num+1) (B) (num-1)*fact(num) (C) num(num-1) (D) num*fact(num-1)
Q8. What will be the output of the following code:
x=”dcbaef”
i=”k”
while i in x:
print(i, end=” “)
(A) kkkkk……… (B) ddddd…….. (C) dcbaef (D) No output (E) None of these
Q9. Assertion(A): To remove the middle element 3 from the list L= [1,2,3,4,5] the statement L. remove (3)
can be used.
Reason(R): The function remove will delete the element 4 in the list as it is placed on the index no 3.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true, but R is not the correct explanation of A.
(c) A is true, but R is false.
(d) A is false, but R is true.
Q10. Assertion(A): The programming expression int('12.5') results in error.
Reason(R): The literal value for int() with base 10: '12.5' is valid.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true, but R is not the correct explanation of A.
(c) A is true, but R is false.
(d) A is false, but R is true.
[Short Answer Questions]
Q11. Find and write the output of the following python code:
def Alter(P=15,Q=10):
P=P*Q
Q=P/Q
print(P,"#",Q)
return Q
A=100
B=200
A=Alter(A,B)
print(A,"$",B)
B=Alter(B)
print(A,"$",B)
Q12. Rewrite the following code in python after removing all syntax errors. Underline each
correction done in the code:
def Data-Print():
30=To
for K in range(0,To)
IF k%4==0:
print (K*4)
Else:
print (K+3)
Q13. 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=”#“)

(A) 10#40#70# (B) 30#40#50# (C) 50#60#70# (D) 40#50#60# (E) B & D both
Q14. Write the output of the code given below:
(i) (ii)
a, a1=5,2 def CALLME(n1=1, n2=2):
n1=n1*n2
def welcome(a1, b1=2): n2=n1+2
global a print(n1, n2)
a=6 CALLME()
a*=a1 CALLME(20)
CALLME(5,-4)
b1//=a
return a,b1
print(welcome(3),welcome(2,-5),sep='&')
Q15. Rewrite the following code after removing all syntax errors. Underline each correction done in
the code:
(i) (ii)
Def func(a): Def func(a):
S,m,n=0 for i in (0,a):
for i in (0,a) if i%2 =0:
if( i%5==0): s=s+1
s=s+i else if i%5= =0
else if(i%5==0) m=m+2
m=m+i else:
else: n=n+i
n=n+i print(s,m,n)
print(s,m,n) func(15)
func(15)
[Long Answer Questions]
Q16. Write the output of following python code:
def result(s):
n = len(s)
m=' '
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m + s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m + s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m + '$'
print(m)
st='KVNo.1_Sambalpur'
result(st)
Q17. Write a python function HCF() and LCM() and pass two arguments in each function to calculate
and return highest common factor and least common factor of passing numbers. Write proper
input and output statement.
Q18. What will be the output for the following code?
L=[“These”,[“are”,”a”],[“few”,”words”],”that”,”we”,”will”,”use”]

(a) L[3:4]+L[1:2]
(b) L[2][1:]
(c) L[1]+L[2]
(d) “few” in L[2:3][0]
Q19. Nandan has created the following dictionary. Find the output for statement 1,2 and 3:
D={"011":"Delhi","022":"mumbai","033":"Kolkata","044":"kochi","055":"Chennai"}
D1={}
print(D.keys()) #Statement1
for i in D.items():
if(i[1].istitle()==False):
D1[i[0]]=i[1].upper()
print(D1) #Statement2
D.update(D1)
print(D) #Statement3
Q20. Write a function lenFOURword(L), where L is the list of elements (list of words) passed as
argument to the function. The function returns another list named ‘indexList’ that stores the
Indices of all four lettered word of L.
For example: If L contains [“DINESH”, “RAMESH”, “AMAN”, “SURESH”, “KARN”]
The indexList will have [2, 4]
Q21. Predict the output of the Python code given below:
data=["L",20,"M",40,"N",60]
times=0 alpha=""
add=0
for c in range(1,6,2):
times = times + c
alpha = alpha + data [c-1] + "@"
add = add + data[c]
print (times, add, alpha)
OR
Predict the output of the Python code given below:
L=[1,2,3,4,5]
Lst=[]
for i in range(len(L)):
if i%2==1:
t=(L[i],L[i]**2)
Lst.append(t)
print(Lst)

************HAPPY SUMMER VACATION **********

You might also like