Class 12 Cs Half Yearly
Class 12 Cs Half Yearly
----------------------------------------------------------------------------------------------------------------------------------
General Instructions:
Please check this question paper contains 35 questions.
The paper is divided into 4 Sections- A, B, C, D and E.
Section A, consists of 20 questions (1 to 20). Each question carries 1 Mark.
Section B, consists of 10 questions (21 to 30). Each question carries 2 Marks.
Section C, consists of 5 questions (31 to 35). Each question carries 4 Marks.
Section D, consists of 2 questions (36 to 37). Each question carries 5 Marks.
SECTIONS- A [1 x 20 = 20]
SECTIONS- B [2 x 10 = 20]
21. The code given below accepts a number as an argument and returns the reverse number. Observe
the following code carefully and rewrite it after removing all syntax and logical errors. Underline
all the corrections made.
a. What will be the min and max value that can be assigned to variables START?
i)min=1,max=4 ii)min=1,max=3 iii)min=0,max=4
b. What will be the possible output
i) 10&40&20& ii) 10&30&15&
iii) 40&10&30& iv) 20&40&10&
32. STRING=”CBSEONLINE”
NUMBER= random.randint(0,3)
N=0
While STRING[N]!=’L’:
Print(STRING[N]+STRING[NUMBER]+’#’,end=’’)
NUMBER=NUMBER+1
N=N-1
a. What will be the min and max value that can be assigned to variable NUMBER?
i) min=1,max=4 ii)min=0,max=3 iii)min=0,max=4
b. What will be the possible output for the above code
i) ES#NE#IO# ii) LE#NO#ON#
iii) NS#IE#LO# iv) EC#NB#IS#
33. What will be the output of the Python code?
SECTIONS- D [5 x 2 = 10]
36. Your teacher has given you a method/function FilterWords() in python which read lines from a text
file NewsLetter.TXT, and display those words, which are lesser than 4 characters. Your teachers
intentionally kept few blanks in between the code and asked you to fill the blanks so that the code will
run to find desired result. Do the needful with the following python code.
def FilterWords():
c=0
file=open('NewsLetter.TXT', '_____________') #Statement-1
line = file.____________ #Statement-2
word = ____________ #Statement-3
for c in word:
if ____________: #Statement-4
print(c)
____________ #Statement-5
FilterWords()
On the basis of the above code, choose the right statement which will be executed when different inputs for
pay and location are given.
i) Input: location = "Chennai”, pay = 50000
a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4
ii) Input: location = "Surat" ,pay = 50000
a. Statement 2 b. Statement 4 c. Statement 5 d. Statement 6
iii) Input- location = "Any Other City", pay = 1
a Statement 1 b. Statement 2 c. Statement 4 d. Statement 6
iv) Input location = "Delhi", pay = 500000
a. Statement 6 b. Statement 5 c. Statement 4 d. Statement 3
v) Input- location = "Lucknow", pay = 65000
a. Statement 2 b. Statement 3 c. Statement 4 d. Statement 5