Sample Paper 5: Computer Science
Sample Paper 5: Computer Science
SAMPLE PAPER 5
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.
3. This method is used to delete key and respective value from dictionary.
(a) del() (b) delete() (c) pop() (d) remove()
4. Which of the following errors will result the abnormal termination of program?
(a) Run-time (b) Compile-time (c) Semantic (d) Syntax
SAMPLE PAPER 5
5. Which exception classes raised when a generated error does not fall into any category?
(a) RuntimeError (b) TypeError (c) KeyError (d) AttributeError
11. Which access mode can be used for opening a file for both appending and reading in a
text file?
(a) a (b) a+ (c) r (d) r+
14. Which one of the following has the highest precedence in the expression?
(a) Exponential (b) Addition (c) Multiplication (d) Parenthesis
15. Which are the two built-in functions to read a line of text from standard input, which
by default comes from the keyboard?
(a) raw_input() and input() (b) input() and scan()
(c) scan() and scanner() (d) scanner()
17. What will be the output of the following Python code snippet?
d1 = {“Siya”:86, “Naman”:75}
SAMPLE PAPER 5
d2 = {“Siya”:99, “Naman”:75}
d1 == d2
(a) True (b) False (c) None (d) Error
22. Observe the following code and identify the type of file.
File=open(“Mydata”, “a”)
File.write(“ABC”)
File.close()
(a) Binary file (b) CSV file
(c) Text file (d) None of these
23. Consider the declaration a=[2, 3, ‘Hello’, 23.0]. Which of the following represents the
data type of ‘a’?
(a) string (b) tuple (c) dictionary (d) list
Section B
This section consists of 24 questions (26 to 49). Attempt any 20 questions.
SAMPLE PAPER 5
32. Siya is trying to write a list l1=[2, 5, 4, 3] on a binary file ‘hello.bin’. Consider the
following code written by her.
import pickle
l1=[2, 5, 4, 3]
f=open (“hello.bin”,‘wb’)
SAMPLE PAPER 5
x = x[:− 1]
print(i, end = “”)
(a) i i i i i i (b) a a a a a a
(c) a a a a a (d) None of the mentioned
38. Evaluate the following expression and identify the correct answer.
25 + ( 6 − 4) * 2 + 4 / /3 * 4 − 1
(a) 32 (b) 42 (c) 22 (d) 33
print(i)
(a) 11 12 13 (b) {11, 12, 13} {11, 12, 13} {11, 12, 13}
(c) Error (d) None
Section C
(Case Study Based Questions)
This section consists of 6 questions (50 to 55). Attempt any 5 questions.
Riya wrote a program to search any string in text file “school”. Help her to execute the
program successfully.
def check() :
datafile = open (_______) #Line 2
found = input(“Enter any string to be searched : ”)
f = False
for line in _______ : #Line 5
SAMPLE PAPER 5
if found in line :
f = _______ #Line 7
_______ #Line 8
return f
f = check ()
if(f = = _______) : #Line 11
print (“True”)
else :
print (_______) #Line 14
CBSE Sample Paper Computer Science Class XII (Term I) 99
54. Choose the correct option to fill up the blank in Line 11.
(a) 0 (b) 1 (c) False (d) True
SAMPLE PAPER 5