0% found this document useful (0 votes)
154 views9 pages

PA 2 Computer Science 12 Set A

The document is the periodic assessment for class 12 computer science students. It contains 3 sections - Section A with 25 multiple choice questions, Section B with 24 multiple choice questions, and Section C with 5 case study based questions. Students must attempt 20 questions from Section A, 20 from Section B, and 5 from Section C, choosing the best option for each question. The duration of the exam is 90 minutes.

Uploaded by

oscar show
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
154 views9 pages

PA 2 Computer Science 12 Set A

The document is the periodic assessment for class 12 computer science students. It contains 3 sections - Section A with 25 multiple choice questions, Section B with 24 multiple choice questions, and Section C with 5 case study based questions. Students must attempt 20 questions from Section A, 20 from Section B, and 5 from Section C, choosing the best option for each question. The duration of the exam is 90 minutes.

Uploaded by

oscar show
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

PRUDENCE SCHOOL

PERIODIC ASSESSMENT 2
SESSION: 2021-22
SUBJECT: COMPUTER SCIENCE
SUBJECT CODE: 083
Class: XII (SET A)
Name of Student: Max.Marks:35
Day & Date: Saturday,25 September 2021 Duration: 90 Minutes

The question paper is divided into 3 Sections - A, B and C.


Section A, consist of 25 Questions (1-25). Attempt any 20 questions.
Section B, consist of 24 Questions (26-49). Attempt any 20 questions.
Section C, consist of 6 case study based Questions (50-55). Attempt any 5 questions.

Section-A
This section consists of 25 Questions (1 to 25). Attempt any 20 questions from this
section. Choose the best possible option

Section-A Mark s

1
Consider a list L = [5, 10, 15, 20], which of the following will result in an error:-
1 a) L[0] += 3 b) L += 3 c) L *= 3 d) L[1] = 45

1
Find the operator which cannot be used with a string in Python from the following:-
2 a) // b) * c) + d) in

1
Consider a tuple in python named Months = (‘Jul’, ‘Aug’, ‘Sep’). Identify the invalid statement(s) from the
3 given below statements:-
a)S = Months[0] b)print(Months[2])
c)Months[1] = ‘Oct’ d)LIST1 =list(Months)

1
4 Functions that do not return any value are known as:-
a)Fruitful functions b)Void functions
c)Standard python functions d)User-defined functions

1
5 Which function of dictionary return both key and value?
a)item b)keyvalue
c)items d)key value
1
6 Which of the following is a wrong way of defining a function:-
a)def f(x=10, y=20, z=30) b)def f(x, y, z)
c)def f(x=10, y, z) d)def f(x, y=20, z=30)
1
7 A void function also returns a value to its caller.
a) None
b) float
c) int
d) string
1
8 The file mode is used when user want to write data into binary file.
a. rb
b. wb
c. r+
d. w+
1
9 Rohan wants to drive a car but He is unable to drive because his age is below 18. A python code is written
to check his age .identify it is correct or incorrect.
Age=input(“enter age:”)
if age<=18:
print(“you are not eligible””)
a)Correct b)Incorrect
c) Can’t say d) Ambiguous
1
10 TSV stands for
a)TAB segregated Values b)TABLE Separated Values
c)TAB Separated Values d)TABLE Segregated values
1
11 The process of converting the structure to a byte stream before writing to the file is known as .
a. Pickling
b. Unpickling
c. Dump
d. load
1
12 What is the default mode of opening a file in python?
a)read b)write c)append d)read and write
1
13 Which of the following expressions is an example of type casting?
a)4.0+float(6) b)5.3+6.3 c)5.0+3 d)None of these

To read twelve characters from a file object f1, we use 1


14 a)f1.read(12) b)f1.read() c)f1.readline() d)read(f1,12)

In which of the following flie modes, the existing data of file will not be lost? 1
15 a)wb+ b)wb c)rb d)w+

16 What is the output of the following Python Code; Select any one of the following options?

import random
print(int(random.random()*5)
a) Generate any number between 0 to 4(including both)
b) Generate any number between 0 To 5(including both)
c) None of Above
d) Ambiguous
Which of the following statement opens a binary file record.bin in write mode and writes
data from a list lst1 = [1,2,3,4] on the binary file?
17
a. with open('record.bin','wb') as myfile:
pickle.dump(lst1,myfile)
b. with open('record.bin','wb') as myfile:
pickle.dump(myfile,lst1)
c. with open('record.bin','wb+') as myfile:
pickle.dump(myfile,lst1)
d. with open('record.bin','ab') as myfile:
pickle.dump(myfile,lst1)

Which of the following is not a function / method of csv module in Python?


18 a. read()
b. reader()
c. writer()
d. writerow()

19 Syntax for opening Student.csv file in write mode is

myfile = open("Student.csv","w",newline='' '')


What is the importance of newline='' ''?
a. A newline gets added to the file
b. Empty string gets appended to the first line.
c. Empty string gets appended to all lines.
d. EOL translation is suppressed

Which of the given argument types can be skipped from a function call:
20 a Positional argument
b Keyword argument
c Named argument
d Default argument

Syntax of seek function in Python is myfile.seek(offset, reference_point) where myfile is


21
the file object. What is the default value of reference_point?
a. 0
b. 1
c. 2
d. 3

What is the order of resolving scope of a name in a python program ?


a BGEL
22
b LEGB
c GEBL
d LBEG

What is the significance of the tell() method?


a. tells the path of file
23
b. tells the current position of the file pointer within the file
c. tells the end position within the file
d. checks the existence of a file at the desired location

Which of the following statement is incorrect in the context of binary files?


24
a. Information is stored in the same format in which the information is held in memory.
b. No character translation takes place
c. Every line ends with a new line character
d. pickle module is used for reading and writing
Which of the following option is not correct?
25
a. if we try to read a text file that does not exist, an error occurs.
b. if we try to read a text file that does not exist, the file gets created.
c. if we try to write on a text file that does not exist, no error occurs.
d. if we try to write on a text file that does not exist, the file gets
Created.

Section-B
This section consists of 24 Questions (26 to 49). Attempt any 20 questions.

1
What will be the output after the following
26 statements?
a = [0, 1, 2, 3]
del a[:]
print(a)
a)None b)[] c)[0, 1, 2, 3] d)NameError
Partition function return 1
27 A List
B Tuple
C String
D Dictionary
What will the following code produce? 1
28 T=[‘kvs’,’rpr’]
T1=range(len(T))
for i in T1:
T[i]=T[i].upper()
print(T)
a)[‘KVS’,’RPR’]
b)[‘kvs’,’rpr’]
c)[‘Kvs’,’Rpr’]
d) Error
What is the name given to area of memory, where the system stores the parameters and a local variable of a 1
29 function call
a heap
b Storage area
c Stack
d Array

1
Identify the output of the following Python statements.
30 x = 2
while x < 9:
print(x, end='')
x=x+1
a. 12345678
b. 123456789
c. 2345678
d. 23456789
When you open a file for writing, if the file does not exist, an error occurs. 1
31 a True
b False
c can’t say
d None of above

32 The relative path for a file always remains same even after changing the directory. 1
a True
b False
c Can’t say
D None of Above
33 The value of the expressions 4/(3*(4-2)) and 4/3*(4-2) is the same 1
a True
b False
c Can’t say
d None of Above
34 The command to merge the dictionary Book with Library the command would be: 1
a) d=Book+Library b) print(Book+Library)
c)Book.update(Library) d)Library.update(Book)
35 find function in string return when substring not found in main string 1
a Exception
b -1
c valueError
d None of Above
36 Find and write the output of the following python code: 1
a=10
def call():
global a
a=15
b=20
print(a)
call()
a)25 b)35 c)15 d)10
37 What will be the output of the following code?
def my_func(var1=100, var2=200):
var1+=10
var2 = var2 - 10
return var1+var2

print(my_func(50),my_func())
a. 100 200
b. 150 300
c. 250 75
d. 250 300
Raghav is trying to write a tuple tup1 = (1,2,3,4,5) on a binary file test.bin. Consider the 1
38
following code written by him.
import pickle
tup1 = (1,2,3,4,5)
myfile = open("test.bin",'wb')
pickle. #Statement 1
myfile.close()
Identify the missing code in Statement 1.
a. dump(myfile,tup1)
b. dump(tup1, myfile)
c. write(tup1,myfile)
d. load(myfile,tup1)
.
1
39 if a = [5,4,3,2,2,2,1], evaluation of the expression a [ a [ a [ a [ 2 ] + 1 ] ] ]:
a)3 b)4 c)5 d)2
1
What is the output of the following program :
40 print( 0.1 + 0.2 == 0.3)
a)True b)False c)Machine Dependent d)Error
1
What will be the output after the following statements?
41 x=0
y=4
while x + y < 10:
print(x, end=' ')
x += 2
a)0 2 4 6 b)0 2 4 c)0 2 d)0 2 4 8
42 apple =’red’ 1
def fruit():
pineapple=’green’

In above code apple is a variable while pineapple is a variable.


a) Non local, local
b) Global,local
C) Local,global
1
43 Which of the following is the use of id() function in Python?
a) Id returns the identity of the object b) Every object doesn’t have a unique ID
c) All of the mentioned d) None of the mentioned

Identify the output of the following Python statements.


44
x = [[10.0, 11.0, 12.0],[13.0, 14.0, 15.0]]
y = x[1][2]
print(y)
a. 12.0
b. 13.0
c. 14.0
d. 15.0
Which type of error will occur when the following code is executed?
>>>print(‘Cloud’ + 9)
45
(a) Syntax Error
(b) Type Error
(c) Name Error
(d) Value Error
Evaluate the following expression and identify the correct answer.
46 16 - (4 + 2) * 5 + 2**3 * 4
a. 54
b. 46
c. 18
d. 32

47 Suppose content of 'Myfile.txt' is


EK BHARAT SHRESHTHA BHARAT

What will be the output of the following code?


myfile = open("Myfile.txt")
vlist = list("aeiouAEIOU")
vc=0
x = myfile.read()
for y in x:
if(y in vlist):
vc+=1
print(vc)
myfile.close()
a. 6
b. 7
c. 8
d. 9
What will be the output of the following code?
48 value = 50
def display(N):
global value
value = 25
if N%7==0:
value = value + N
else:
value = value - N
print(value, end="#")
display(20)
print(value)
a. 50#50
b. 50#5
c. 50#30
d. 5#50#
What will be the output of the following code?
49 import random
List=["Delhi","Mumbai","Chennai","Kolkata"]
for y in range(4):
x = random.randint(1,3)
print(List[x],end="#")

a. Delhi#Mumbai#Chennai#Kolkata#
b. Mumbai#Chennai#Kolkata#Mumbai#
c. Mumbai# Mumbai #Mumbai # Delhi#
d. Mumbai# Mumbai #Chennai # Mumbai
Section-C
Case Study based Questions
This section consists of 6 Questions (50 -55) Attempt any 5 questions.
Rohit, a student of class 12th, is learning CSV File Module in Python. During
examination, he has been assigned an incomplete python code (shown below) to create
a CSV File 'Student.csv' (content shown below). Help him in completing the code which
creates the desired CSV File.
1,AKSHAY,XII, A
2,ABHISHEK,XII,A
3,ARVIND,XII,A
4,RAVI,XII,A
5,ASHISH,XII,A
Incomplete Code
import #Statement-1
fh = open( , , newline='') #Statement-2
stuwriter = csv. #Statement-3
data = [ ]
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
class = input("Enter Class : ")
section = input("Enter section : ")
rec = [ ] #Statement-4
data.append(rec) # Statement 5
stuwriter. (data) #Statement-6
fh.close()
Answer any four of the following questions.
50 Identify the suitable code for blank space in line marked as Statement-1 1
a) csv file b) CSV c) csv d) Csv
51 Identify the missing code for blank space in line marked as Statement-2? 1
a) "School.csv","w" b) "Student.csv","w" c) "Student.csv","r" d)
"School.csv","r"
52 Choose the function name (with argument) that should be used in the 1
blank space of line marked as Statement-3
a) reader(fh) b) reader(MyFile) c) writer(fh) d) writer(MyFile)
53 Identify the suitable code for blank space in line marked as Statement-4. 1
a) 'ROLL_NO', 'NAME', 'CLASS', 'SECTION'
b) ROLL_NO, NAME, CLASS, SECTION
c) 'roll_no','name','Class','section'
d) roll_no,name,Class,section

54 Identify the suitable code for blank space in the line marked as Statement-5. 1
a) data
b) record
c) rec
d) insert
55 Choose the function name that should be used in the blank space of line marked as
Statement-6 to create the desired CSV File?
a) dump()
b) load()
c) writerows()
d) writerow()
9|Page

You might also like