Professional Documents
Culture Documents
12CS T1 2022 SetB
12CS T1 2022 SetB
12CS T1 2022 SetB
8. Rewrite the Python script after removing all the errors. Underline the corrections. [2]
myfile=open('CARS.TXT")
for mydata myfile:
print(mydata.strip())
close()
XII 1st Term Exam 2023-23 Set-B Page 1 / 2 Subject: Computer Science (083)
9. Give the output of the Python scripts given below: [2+3=5]
a) word='OUTSTATION'
print(word[5:], word[:5])
print(word[9::-2], word[::2])
x, y, c=3, 5, 6
pyfunc(c, x)
pyfunc(c, y)
10. Write any three differences between list type and tuple type. [3]
11. Write any two differences between actual parameter and formal parameter. [2]
12. A binary data file 'HOUSE.DAT' storing student records where every record is a list containing
following data: adno,name,grade,house,area
adno is integer, name is string, grade is string ('12A', '12B' …, '11A', '11B', … '10A', '10B', …),
house is string and area is string
a) Write a Python function to append n (n is a parameter to the function) records in the binary
data file 'HOUSE.DAT'.
[3]
b) Write a Python function to read the binary data file 'HOUSE.DAT' and display those records
where area is either 'ABU HALIFA' or 'MAHBOULA'. If no such record is found then display
an appropriate message.
[4]
b) Write a Python function to read and display the CSV data file 'STAFF.CSV'. At the end display
number of records where sub is 'CHEM' and nop>24. [4]
14. Write a Python function to read and display a text file 'EIDBREAK.TXT'. At the end count and
display number of lowercase consonants present in the text file.
[3]
15. Write a Python function to read and display a text file 'EIDBREAK.TXT'. At the end count and
display number of words not ending with a digit present in the text file.
[3]
XII 1st Term Exam 2023-23 Set-B Page 2 / 2 Subject: Computer Science (083)