KV No 1, Afs, Agra: Section - A
KV No 1, Afs, Agra: Section - A
SECTION - A
Neha is making software on “Items & their prices” in which various records are to be
stored/retrieved in STORE.CSV data file. It consists some records (Item & Price).
She has written the following code in python. As a programmer, you have to help her to
successfully execute the program.
def ShowRecord():
with open(“STORE.CSV”,”r”) as NI:
NewItem=csv._______ (NI) # Statement-5
for rec in NewItem:
print(rec[0], “#”, rec[1])
#main-code
AddItem(“Sugar”, 38.00)
AddItem(“Rice”, 48.50)
ShowRecord() # Statement-6
Find the suggested output option(s) (i) to (iv). Also, write the least value and highest
value that can be generated.
(i) 102 105 104 105 (ii) 110 103 104 105
(iii) 105 107 105 110 (iv) 110 105 105 110
Q8. Find and write the output of the following Python code: [2]
def findOutput():
data=["P",20,"R",10,"S",30]
times, add = 0, 0
alpha=""
for c in range(1, 6, 2):
times = times + c
alpha = alpha + data [c-1] + "$"
add = add + data[c]
print (times, add, alpha)
findOutput()
Q9. Write python code to print just the last line of a text file “data.txt” [2]
SECTION – B
Q10. Find the output: [1]
def fun1(t):
return max(t)
#main-code
a=('Amit', 'Sumit','ashish','Sumanta')
print(fun1(a))
Q14. This method is used to unpickling data from a binary file: [1]
A. dump B. unpickle C. load D. seek
Q15. Find the output of the following code: [1]
def test(n):
D1 = {"cat":17, "dog":6, "bear":23}
return n in D1
print(test(23))
A. False B. True C. None D. Error
Q16. What are the technical names of insertion and deletion in a stack? [1]
Q17. Find the output of the following: [1]
def func(message, times=3):
print(message*times)
#main-code
func(‘Python’)
func(‘Easy’* 3)
SECTION – C