Sample Paper 2: Computer Science
Sample Paper 2: Computer Science
Sample Paper 2: Computer Science
SAMPLE PAPER 2
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.
4. Which of the following operators in Python are used to determine whether a value is of
a certain class or type?
(a) Identity operators (b) Membership operators
SAMPLE PAPER 2
9. The process of converting a data type into another data type is known as ............ .
(a) expression (b) operator
(c) type conversion (d) comparison
21. Which of the following operators has its associativity from right to left?
(a) + (b) //
(c) % (d) **
23. What will be the output of the following Python code snippet?
d1 = {“Neha”:86, “Yash”:92}
d2 = {“Neha”:86, “Yash”:88}
d1 > d2
(a) True (b) False (c) Error (d) None
Section B
This section consists of 24 questions (26 to 49). Attempt any 20 questions.
29. What will be the output of the following Python code snippet?
x = ‘abcd’
for i in range(len(x)):
print(x)
x = ‘a’
(a) a (b) abcd abcd abcd abcd
(c) a a a a (d) None of the mentioned
32. Sohan is a student of Class 12th. He got an assignment on Python language, in which
one question is
Write a tuple test = (3, 4, 8, 11, 2) on a binary file hello.bin. Consider the following code
written by him.
import pickle
test=(3, 4, 8, 11, 2)
file=open(“hello.bin”, “wb”)
pickle. —————————— # line 1
file.close()
Identify the missing code in line 1.
(a) dump (file, test) (b) dump (test, file)
(c) write (test, file) (d) load (file, test)
35. Evaluate the following expression and identify the correct answer.
SAMPLE PAPER 2
print power(5)
print power(5, 5)
(a) 625 (b) 625 (c) 3125 (d) Error
3125 625 3125
41. Find the output of the following code from given options.
def calcresult ():
i=9
while i > 1 :
if (i % 2 = = 0):
x = i% 2
i = i− 1
CBSE Sample Paper Computer Science Class XII (Term I) 61
else:
i = i − 2
x = i
print (x * * 2)
(a) 81 (b) 81 (c) 81 (d) 49
49 49 49 25
25 25 25 9
9 9 1
1
44. A text file “Quotes.txt” has the following data written in it.
Living a life you can be proud of
Doing your best
Spending your time with people
for i in z:
count=count+1
print (count)
(a) 14 (b) 15 (c) 16 (d) 29
45. What will be the output of the following Python code snippet?
a={}
a[1] = 1
a[‘1’] = 2
a[1]=a[1]+1
62 CBSE Sample Paper Computer Science Class XII (Term I)
count = 0
for i in a:
count+= a[i]
print(count)
(a) 1
(b) 2
(c) 4
(d) Error, the keys cannot be a mixture of letters and numbers
Section C
(Case Study Based Questions)
This section consists of 6 questions (50 to 55). Attempt any 5 questions.
51. Choose the correct option to fill up the blank in line 2 as marked.
(a) i (b) count (c) i + 1 (d) count +1
52. Choose the correct option to fill up the blank in line 3 as marked.
(a) lower (b) upper (c) islower (d) isupper
53. Choose the correct option to fill up the blank in line 4 as marked.
(a) 1 (b) i * 2 (c) i/2 (d) i
54. Choose the correct option to fill up the blank in line 5 as marked.
SAMPLE PAPER 2
55. Choose the correct option to fill up the blank in line 6 as marked.
(a) newstr (b) str (c) makenew (d) mystr