You are on page 1of 10

D.A.V.

GROUP OF SCHOOLS, CHENNAI & RANIPET


COMMON REVISION -1 EXAMINATION – 2021-2022

COMPUTER SCIENCE (083)

Class : XII Time : 90 Minutes


Date : 6/10/21 Max. Marks : 35

General Instructions:
1. The question paper is divided into 3 Sections - A, B and C.
2. Section A- consist of 15 Questions (1 – 15), Section B- consist of 15 Questions
(16 - 30), Section C- consist of 5 case study based Questions (31 – 35) .

SECTION- A
Q.1 Choose the right option showing right order of precedence from highest to least:

[A] or, + , !=, **, %, not

[B] **, %, +, !=, not, or

[C] **, !=, not, or, %, +

[D] or, not, !=, +, %, **

Q.2 As the keys in a dictionary are considered to be unique, given D={‘a’: 100, ‘b’:200,
‘c’:300}, a statement as D[‘c’]= 500 will result in:

[A] KeyError

[B] Updation of value of the key ‘c’ to 500

[C] SyntaxError

[D] No Change

Q.3 Given a complex literal z=4+5j , what will type(z.real) show?

[A] <class 'float'>

[B] <class 'int'>

[C] <class 'complex'>

[D] <class 'None'>

Q.4 The Empty statement in Python, which does nothing, is

[A] break

[B] pass

[C] continue

[D] None
: Page2 :

Q.5 The jump statements in Python are

[A] if ,else

[B] for, while

[C] break, continue

[D] input(), print()

Q.6 The number of times the asterisk * will be printed in the following code is

for k in range(15,3,-7) :

for j in range(k,0,-1):

print('*')

[A] 15 times

[B] 0 times

[C] 23 times

[D] 24 times

Q.7 The return type of the partition() function is:

[A] <class ‘str’>

[B] <class ‘list’>

[C] <class ‘tuple’>

[D] <class ‘None’>

Q.8 What will the following command display ?

print("Revision_Exam"[: : -1].upper().startswith('M'))

[A] maxE_noisiveR

[B] True

[C] MAXE_NOISIVER

[D] False

Q.9 Given T= (3,15,8,10) what is the following operation called:

A, B, C, D = T
: Page3 :

[A] Assignment

[B] Packing

[C] Unpacking

[D] Initialization

Q.10 Given Lst=[3,10,9,8] which of the following will remove all the elements in the list and
make it an empty list:

[A] del Lst[:]

[B] Lst[:] = [ ]

[C] del Lst[0:len(Lst)]

[D] All of the above

Q.11 What will be the result of: tuple({‘a’: 100, 5: ‘b’, “area”: 200 })

[A] (‘a’, 5, ‘area’)

[B] ((‘a’, 5, ‘area’), ( 100, ‘b’, 200))

[C] TypeError (Error in typecasting)

[D] ValueError

Q.12 The command to merge a dictionary Book with another dictionary Library is:

[A] Book = Book + Library

[B] merge(Book, Library)

[C] Book.extend(Library)

[D] Library.update(Book)

Q.13 What will be the result for: print( "Look before you leap". lower().strip('apollo'))

[A] Look before you le

[B] Look before you leap

[C] k before you le

[D] look before you leap


: Page4 :

Q.14 What will be the result for: print("birds of feather flock together". split('r'))

[A] ['bi', 'ds of feathe', ' flock togethe', '' ]

[B] ['birds', 'of', 'feather', 'flock', 'together']

[C] ('bi', 'ds of feathe', ' flock togethe', '')

[D] ('birds', 'of', 'feather', 'flock', 'together')

Q.15 What will be the result for : print("Rolling stone gather no moss"[-2:15:-2].title())

[A] Smo et

[B] Smo Etg

[C] Smo Et

[D] Smo etg

SECTION - B

Q.16 Assume a package Mensuration exists with a module Area which has a function
Area_Circle. What is the correct form of import statement to access the function directly as
Area_Circle()

[A] import Mensuration

[B] from Mensuration import Area

[C] import Mensuration . Area

[D] from Mensuration import Area . Area_Circle

Q.17 Consider the following function definition:

def Prog(Lang_Name=‘Basic’, Lang_Proc ='Interpreter', Type ='Application'):


print(Lang_Name, “is a” , Lang_Proc, “based”, Type)
Which function call will produce the output :

Python is a Interpreter based Language

[A] Prog(Type='Language', 'Python')

[B] Prog(“Python”, Type=”Language”)

[C] Prog(Type='Language')

[D] Prog('Interpreter', Lang_Name= 'Python', Type='Language')


: Page5 :

Q.18 Given the following code, what will be displayed as output ?:

L1= “exam”
L2= [(L1[k]*(k+1)) for k in range(len(L1))]
print(L2)

[A] ['e', 'ex', 'exa', 'exam']

[B] ['e', 'xx', 'aaa', 'mmmm']

[C] ['e1', 'xx2', 'aaa3', 'mmmm4']

[D] Syntax Error

Q.19 Given the following code, what will be displayed as output ?:

L1=[12,45,56,78,90,4,10]
L2=[E**2 for E in L1[-1:2:-2] if (E-len(L1))%3==0]
print(L2)

[A] [100, 8100]

[B] [ ]

[C] [100]

[D] SyntaxError

Q.20 What will be the output for the following code?

numberGames = {}

numberGames[(1,2,4)] = 8

numberGames[(4,2,1)] = 10

numberGames[(3,1)] = 12

sum = 0

for k in numberGames:

if len(k) % 2 : sum += numberGames[k]

else : sum += max(k)

print ( max(numberGames.values()) + sum )

[A] 30

[B] 24

[C] 33

[D] 12
: Page6 :

Q.21 What will the following result in ?

M= [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’]


print( ''. join(M)) # '' - empty string

[A] TypeError

[B] P y t h o n

[C] None

[D] Python

Q.22 What will the following display ? print(“Good Luck”[15:30])

[A] IndexError

[B] SyntaxError

[C] No output

[D] Good Luck

Q.23 Given the following statement, what will the print command show?

a , L = None, [ ]
L += [a]
print( '*' . join(str(k) for k in L*3))

[A] TypeError

[B] 'None*None*None'

[C] None*None*None

[D] None*None*None*

Q.24 Given the following code, what will be the output shown?

def FN(x):
x=x-4
return x
print(sqrt(x))
FN(40)

[A] 36

[B] 6.0
36

[C] no output

[D] NameError ( as math module is not imported for using math.sqrt())


: Page7 :

Q.25 A student register is maintained using a dictionary having the roll numbers as the key
and value being students First_name ,Last_name stored as a list, a sample of which is shown
below:

Stud_List ={1 : ['alan', 'Turing'], 2: ['Charles', 'babbage'], 3 : ['von', 'rossum']}

The first_name and Last_name should be uniformly changed to have their first letter
capitalized, so that the Stud_List now contains:

{1: ['Alan', 'Turing'], 2: ['Charles', 'Babbage'], 3: ['Von', 'Rossum']}

Given the following code to do the above, which option(s) can fill in the blank appropriately, to
get the desired result.

for k in Stud_List:
Stus_List [k]= _______________

Option 1: [Stud_List[k][0].capitalize(), Stud_List[k][1]. capitalize ()]


Option 2: [Stud_List[k][0].title(), Stud_List[k][1].title()]

[A] Option1 only

[B] Option2 only

[C] Options 1 and 2

[D] None of the above

Q.26 A text file “Content.txt” exists with the content: Python Coding is Interesting

Given:
F = open(“Content.txt”, “a+”)
F.seek(6)
F.write(“Easy”)
F.close()

What will be the new contents of the file?

[A] PythonEasying is Interesting

[B] Python Coding is InterestingEasy

[C] Easy

[D] No opening mode as “a+”

Q.27 Assertion(A) : Given:

F = open(“Story.txt”)
for k in F : print(k) - will display the file contents one line at a time
: Page 8 :

Reason (R) : When we iterate through the file handler used to open a file in read mode, the
loop variable moves through the file line by line

[A] Both A and R are true and R is the correct explanation of A

[B] Both A and R are true and R is not the correct explanation of A

[C] A is true but R is false

[D] A is false but R is true

Q.28 Assertion(A) : Given:

F = open(“Story.txt”, “w”)

for k in range(3): F.write( input(“enter line”+str(k+1)))

The above code creates a file Story.txt with 3 lines of text written in separate lines.

Reason (R) : The write() does not add any extra character like ‘\n’

[A] Both A and R are true and R is the correct explanation of A

[B] Both A and R are true and R is not the correct explanation of A

[C] A is true but R is false

[D] A is false but R is true

Q.29 Assertion(A) : Given:

F = open(“Story.txt”, “a”)

print(F.tell())

The above displays the size of the file “Story.txt”

Reason (R) : When the file is opened in ‘a’ mode, the file pointer is automatically
positioned at the end.

[A] Both A and R are true and R is the correct explanation of A

[B] Both A and R are true and R is not the correct explanation of A

[C] A is true but R is false

[D] A is false but R is true

Q.30 Reshma tried the following code to store details of 3 students in the form of a CSV file:
import csv
F =open(“Student.csv”, “w”)
W= csv.writer(F)
W.writerows([1, “AAA”], [2, “BBB”], [3,”CCC”])
F.close()
: Page9 :

But when she retrieved the records and displayed, an empty record was displayed between
records.

Statement1: A CSV file can only be created with empty records between records

Statement2: Omitting the newline argument in the open() function causes EOL translation to
take place.

[A] Both the statements are true

[B] Statement 1 is true but Statement 2 is false

[C] Statement 2 is true but Statement1 is false

[D] Both the statements are false

SECTION – C : Consider the following code for questions Q31 to Q35:

A student register having details of Roll number, name, age and marks are maintained in an
existing “Student.csv” file. The marks of one student has to be changed given the roll
number of the student. A code has been created with certain portions left blank. Fill in the
blanks appropriately using the specifications and the options given:

def Modify_Student(R, NewMark):

with open (“Student.csv”, ‘r’) as F :

R_Obj= csv.reader(F)

_________ #statement 1

with open ____________________ as FileObj : #statement 2

W_Obj = ____________ #statement 3

for rec in Lst:

if _________________ : #statement 4

rec[3] = NewMark

W_Obj.writerow(rec)

__________ #statement 5

Q. 31 Choose the option for statement 1 to store the contents of the csv file into a list

[A] Lst = list(F)

[B] Lst = list(R_Obj)

[C] F = list(Lst)

[D] Lst = [R_Obj]


: Page10 :

Q.32 Choose the option for statement 2 to open the file to rewrite the modified contents:

[A] “Student.csv”, “w+”

[B] “Student.csv” , “a+”

[C] “student.csv”, “w”, newline=’’

[D] “Student.csv”, newline=’’

Q.33 Choose the option for statement 3 to create a writer object

[A] csv.writer(FileObj)

[B] csv.writer(F)

[C] csv.Writer(FileObj)

[D] csv. write(FileObj)

Q. 34 Choose the option for statement 4 to check if the roll number of each record matches
with the parameter passed:

[A] rec ==R

[B] rec[0] ==12501

[C] int(rec[0]) == R

[D] rec[0] = R

Q.35 Choose the option for statement 5 to invoke the function to change the marks of student
with roll number 12501 to 93:

[A] Modify_student(R, NewMark)

[B] Modify_student(12501, 93)

[C] Modify_Student(“student.csv”)

[D] Modify_Student(12501, 93)

---------------------------------------------------

You might also like