Sample Paper 3: Computer Science
Sample Paper 3: Computer Science
Sample Paper 3: Computer Science
SAMPLE PAPER 3
COMPUTER SCIENCE
A Highly Simulated Practice Questions Paper
for CBSE Class XII (Term I) Examination
Instructions
1. This question paper is divided into three sections.
2. Section - A contains 25 questions (1-25). Attempt any 20 questions.
3. Section - B contains 24 questions (26-49). Attempt any 20 questions.
4. Section - C contains 6 case study based questions (50-55). Attempt any 5 questions.
5. Each question carries 0.77 mark.
6. There is no negative marking.
Maximum Marks : 35
Roll No. Time allowed : 90 min
Section A
This section consists of 25 questions (1 to 25). Attempt any 20 questions from this section. Choose the best
possible option.
6. ……… operator checks whether the left value is greater than the one on the right.
(a) Greater than or equal to (b) Greater than
(c) Less than or equal to (d) Less than
CBSE Sample Paper Computer Science Class XII (Term I) 69
15. What will be the output of the following Python code snippet?
d = {“Neha”:140, “Paras”:145}
print(list(d.keys())
(a) [“Neha”, “Paras”] (b) [“Neha”:140, “Paras”:145]
(c) (“Neha”, “Paras”) (d) (“Neha”:140, “Paras”:145)
17. Which one of the following has the same precedence level?
(a) Addition and Subtraction
(b) Multiplication, Division and Addition
(c) Multiplication, Division, Addition and Subtraction
(d) Addition and Multiplication
SAMPLE PAPER 3
25. Which of the following is not a valid attribute of a file object (fp)?
(a) fp.name (b) fp.closed
(c) fp.mode (d) fp.size
Section B
This section consists of 24 questions (26 to 49). Attempt any 20 questions.
else:
j = j + 1
print(“m =”, m)
print(“k =”, k)
print(“j =”, j)
(a) m = 2 (b) m = 4 (c) m = 1 (d) m = 2
k=4 k=2 j=2 k=4
j=1 j=1 k=4 j=3
a=[13,6,77]
a.append([87])
a.extend([45,67])
print(a)
(a) [13,6,77, [87], 45, 67] (b) [13,6,77,87,45,67]
(c) [13,6,77,87,[ 45,67]] (d) [13,6,77, [87], [45,67]]
72 CBSE Sample Paper Computer Science Class XII (Term I)
inclusive)
(c) Display details of employees who are earning between 20000 and 40000 (only 20000
inclusive)
(d) Display details of employees who are earning between 20000 and 40000 (only 40000
inclusive)
35. Evaluate the following expression and identify the correct answer.
15 − ( 2 + 7) * 5 + 3 * *2 * 6 − 4 + 2
(a) 18 (b) 20 (c) 22 (d) 35
CBSE Sample Paper Computer Science Class XII (Term I) 73
36. What will be the output of the following Python code snippet?
a = ‘hello’
for i in range(len(a)):
a[i].upper()
print(a)
(a) hello (b) HELLO
(c) Hello (d) Error
43. Find and write the output of the following Python code.
a=10
def call():
global a
a=15
b=20
print(a)
call()
SAMPLE PAPER 3
if len(w)<4:
print(w)
file.close()
If the content of file “Story.txt” is
A computer is a machine that can be programmed to carry out
sequences of arithmetic or logical operations automatically.
(a) 9 (b) 10
(c) 19 (d) 11
47. What will be the output of the following Python code snippet?
dic1 = {1:‘One’, 2:‘Two’, 3:‘Three’}
del dic1[1]
dic1[1] = ‘Four’
del dic1[2]
print(len(dic1))
(a) 0
(b) 2
(c) 1
(d) Error as the key-value pair of 1:‘One’ is already deleted
print (s)
f.close()
If the content of file “student.txt” is
Welcome to Arihant!
(a) 20 (b) 18 (c) 19 (d) 17
76 CBSE Sample Paper Computer Science Class XII (Term I)
Section C
(Case Study Based Questions)
This section consists of 6 questions (50 to 55). Attempt any 5 questions.
Riya write a program to open a file ‘status.txt’ to read each character and print the
occurrence of alphabets A and N.
def countAN():
f = open(“status.txt”, “r”)
a = 0
n = 0
while ____ : #line 1
l = f.readline( )
if not l :
____ #line 2
for i in ____ : #line 3
if (i = = ‘A’ or i = = ‘a’):
a = + 1
elif (____): #line 4
n = ____ #line 5
print (“A :”, a)
print (“N :”, n)
____ . close () #line 6
51. Choose the correct option to fill the blank in line 2 as marked.
(a) continue (b) break (c) False (d) True
52. Choose the correct option to fill the blank in line 3 as marked.
(a) l (b) f (c) n (d) a
55. Identify the missing code to close the file in line 6 as marked.
(a) l (b) n (c) f (d) file