Professional Documents
Culture Documents
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q30 against
part C only.
8. All programming questions are to be answered using Python Language only.
Q.N.
SECTION A MRK
1 Find the invalid identifier from the following 1
a) return b) price_5 c) import
2 Write down the output of the following 1
L=[56,43,555 ,89,59]
L[3]=631
print(L[-1])
a) 43 b) 56 c) 59 d) 555
3 Exponential expression in python executes from left to right, state true or false 1
Page 1
10 Write down the output for the following python snippet 1
x = 'KEYBOARD”
for i in range(len(x)):
i[x].lower()
print (x)
a) Error b) Keyboard
c) KEYBOARD d) none of the mentioned
Page 2
17 Which one of the following is used to define empty statement 1
a) Null b) None c) pass
add_one(3)
print ("x=",x)
What will be printed?
a) 123 b) 120 c) 6 d) 3
SECTION B
22 Write a program to remove all the lines that contain the character 'a' in that file and 2
write other lines into file.
23 Differentiate between read() and readline() 2
24 2
Write a program to count the word “autograph” in a text file myautograph.txt
25 What are the fruitful functions 2
OR
Write a note on return statement
SECTION C
28 Write a Python program to create a file where all letters of English alphabet are listed 3
by specified number of letters on each line
29 Write a function reverselist(Arr,n) in Python, which accepts a list Arr of 3
numbers and n is a numeric value by which all elements of the list are reversed.
Sample Input Data of the list
Arr= [ 78,5,32,90,158]
Page 3
Output
Arr = [158,90,32,5,78]
30 Write a program to enter the following records in a binary file: Item No integer 3
Item_Name string Qty integer Price float Number of records to be entered should be
accepted from the user. Read the file to display the records in the following format:
Item No:
Item Name :
Quantity:
Price per item:
Amount: ( to be calculated as Price * Qty)
OR
Write a program to search perticular record of student display it on the screen from
stud.dat file
For Example: Enter the roll number : 12345
Name: Harish Class: XII Sec: C Total Marks: 467
SECTION D
31 Write a function to write data into binary file marks.dat and display the records of 5
students who scored more than 95 marks.
32 Write a Python program that reads each row of a given CSV file and skip the header of 5
the file. Also print the number of rows and the field names.
33 Consider a binary file employee.dat containing details such as empno: ename: salary: 5
Write a python function to display details of those employees who are earning between
20000 and 30000(both values inclusive)
SECTION E
34 a) Write a single loop to display all the contents of a text file file1.txt after removing 4
leading and trailing WHITESPACES
b) Write a user defined function to display the total number of words present in the file
quotes.txt.
35 Write a function countmy() in python to read the text file "DATA.TXT" and count the 4
number of times "my" occurs in the file. For example if the file DATA.TXT contains-"This
is my website.I have diaplayed my preference in the CHOICE section ".-the countmy()
function should display the output as:"my occurs 2 times".
***
Page 4