You are on page 1of 4

COMPUTER SCIENCE (083)

CLASS: XII MAX TIME: 3h


SEC : _____ MAX MARKS: 70

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

4 Identify the valid operators in Python from the following. 1


a) ** b) *= c) => d) None of the mentioned
5 Consider the following code segment: 1
L1[34,56,78,66,4,53]
Choose the correct option to get minimum value of given list
a) List.min(L1) b) min(L1) c) L1.min()
6 What does 8**2 evaluate to? 1
a) 8 b) 16 c) 64 d) 2
7 Which of the following is valid membership operator in Python: 1
a) and b) not c) is d) in
8 Function in Python is also called as_______ 1
a) Divide and conquer b) procedure c) program
9 Which value type does input() return? 1
a) Boolean b) String c) Int d)Float

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

11 What is the output when following statement is executed? 1


>>>chr(ord('D'))
a) D b) 67 c) error d) 68
12 What is the output? 1
m = [[10, 20, 30, 40],
[40, 50, 60, 70],
[80, 90, 100, 110],
[120, 130, 140, 150]]
s=0
for i in range(0, 4):
s=s+m[i][1]
a) 240 b) 250 c) 100 d) 210
13 What is the output? 1
def m(list):
for I in list:
if i%2!=0:
print(i)
values = [12,13,14,14,15]
a) 12 15 b) 13 15 c) 12 13 14
14 Which is the correct form of declaration of dictionary? 1
(i) Day={1:’monday’,2:’tuesday’,3:’wednesday’}
(ii) Day=(1;’monday’,2;’tuesday’,3;’wednesday’)
(iii) Day=[1:’monday’,2:’tuesday’,3:’wednesday’]
(iv) Day={1’monday’,2’tuesday’,3’wednesday’]
15 When global variables are declared, they are accessed by defining global keyword 1
outside the function state true or false
a) True b) False
16 Which statement is used to define empty list 1
a) L1=[] b) L1=list() c) both a & b 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

18 Consider the following code: 1


x=120
def add_one(x):
x=x+3
return x

add_one(3)
print ("x=",x)
What will be printed?
a) 123 b) 120 c) 6 d) 3

SECTION B

19 Write a program to find maximum and minimum element of a list 2

20 Differentiate between actual parameters and formal parameters. 2


OR
Differentiate between writerow() and writerows()
21 Write a python program to access the index of an item in a specified list 2

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

26 What is the difference between 'w' and 'a' modes? 3

27 Write a Python program to read last n lines of a text file 3

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

You might also like