N.S.N.
MEMORIAL SENIOR SECONDARY SCHOOL
Thirumurugan Salai, Thirumurugan Nagar, Chitlapakkam, Chennai – 600064
Class: XII
Subject: Computer Science
Worksheet-Python fundamentals
1. Identify the types of tokens
a. def f. 34E2
b. ++ g. pno
c. admi_no h. sep
d. >= i. “ “
e. 345.2 h. :
2. Identify the valid identifier. If not give the reason.
a. Id.no f. cont_no.
b. stud name g. ad_no
c. total h. father’s_name
d. degree i. eng_mark
e. d.o.b. h. avg
3. Debug the snippet
a. IF a>b: f. for x in range(1,10,-1):
b. x=input(“enter the first integer”) g. print “welcome to python”
c. for j in range(10) h. if a>b:
d. if j >= 10: print(“ a greater”)
print(“program ends”) else if a > c:
e. while tot=100 : print(“ a greater”)
else :
print(“ a is not greater”)
i. y=int input(“enter your reg no.”))
j. si == (p*n*r)/100
4. Predict the output
a. print(3-2**2**3+99/11) f. if 4>6:
b. print(4 + 3**3/2) print("Ji")
c. print(5<10 and 12>7 or not 7>4) elif 10>5:
d. print (4+3*5/3-5%2) print("Hello")
e. for i in range(0,10,2): elif 7>10:
print(i, end=”#) print("Bye")
else:
print("Finished")
g. i=10
while i>1:
print(i)
else:
print("Hi")
h. print(22.0//5)
i. >>>(not True) and False or True
j. a,b=8/4/2, 8/(4/2)
print(a,b)
5) Write the output of the queries (i) to (iv) based on the table FURNITURE
given below.
Table : FURNITURE
FID NAME DATE OF PURCHASE COST DISCOUNT
B001 Double Bed 03-JAN-2018 45000 10
T010 Dinning Table 10-MAR-2020 51000 5
B004 Single Bed 19-JUL-2021 22000 0
C003 Long back Chair 30-DEC-2016 12000 3
T006 Console Table 17-NOV-2019 15000 12
B006 Bunk bed 01-JAN-2021 28000 14
(i) SELECT SUM(DISCOUNT) FROM FURNITURE WHERE COST>15000;
(ii) SELECT MAX(DATE OF PURCHASE) FROM FURNITURE;
(iii)SELECT * FROM FURNITURE WHERE DISCOUNT>5 AND FID LIKE “T%”;
(iv) SELECT DATE OF PURCHASE FROM FURNITURE WHERE NAME IN
(“Dinning Table”, “Console Table”);
*************