0% found this document useful (0 votes)
32 views8 pages

Term I - Class Xii - Computer Science

The document outlines the structure and content of a Computer Science exam for Class XII at DAV Public School, Jharkhand Zone 'F', consisting of three sections with various types of questions. Section A includes 25 questions where students must attempt 20, Section B has 24 questions with the same requirement, and Section C consists of 6 case study questions where 5 must be attempted. Each question carries equal marks and covers various topics in computer science.
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)
32 views8 pages

Term I - Class Xii - Computer Science

The document outlines the structure and content of a Computer Science exam for Class XII at DAV Public School, Jharkhand Zone 'F', consisting of three sections with various types of questions. Section A includes 25 questions where students must attempt 20, Section B has 24 questions with the same requirement, and Section C consists of 6 case study questions where 5 must be attempted. Each question carries equal marks and covers various topics in computer science.
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/ 8

DAV PUBLIC SCHOOL, JHARKHAND ZONE ‘F’

Class – XII Term – I Computer Science (2021-22) F.M. - 35 Time- 1 ½ Hours

General Instructions:

 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.
 All questions carry equal marks.
Section-A
This section consists of 25 Questions (1 to 25). Attempt any 20 questions from this
section. Choose the best possible option.
1. Find the valid identifier from the following
a. def b. 2ndName c. Num_1 d. if
2. Consider a declaration Javelin= [1, ' Neeraj Chopra', ’India’, ’Gold’]
Which of the following represents the data type of Javelin?
a. List b. tuple c. dictionary d. string
3. Given a Tuple, Runs= (11, 21, 34, 45, 63, 92, 117).
What will be the output of print (Runs[-5:-2:2]) ?
a. (34,35,63) b. (45,34) c. [34,63] d. (34,63)
4. Which of the following option is correct?
a. if we try to open a text file with ‘w’ mode that does not exist, error occurs.
b. if we try to open a text file with ‘w’ mode that already exist, the same file is used for
writing.
c. if we try to open a text file with ‘w’ mode that already exists, New blank file with same
name gets created.
d. if we try to open a text file with ‘w’ mode that already exists ,Error occurs
5. Which of the following options can be used to read the lines of a text file Sports.txt and store
them as elements of a List ?
a. File = open('Sports.txt'); Data=File.read()
b. File = open('Sports.txt','r'); Data=File.read(n)
c. File = open('Sports.txt'); Data= File.readline()
d. File = open('Sports.txt',’r’); Data= File.readlines()
6. Assume that the position of the file pointer is at the beginning of 5th line in a text file
containing ten lines. Which of the following statement will not give an error?
a. File.seek(-2,2) b.File.seek(2,1) c. File.seek(0,2) d.File.seek(-2,0)
7. A text file Term1.txt is stored in the storage device. Identify the correct option out of the
following options to open the file in write mode.
i. File= open('Term1.txt','rb')
ii. File = open('Term1.txt','w')
iii. File = open('Term1.txt','r')
iv. File = open('Term1.txt')
a. only ii b. both ii and iv c.both iii and iv d.both i and iii
8. The return type of the File.readline() function is
a. String b. integer c. list d. tuple
9. Which of the following operator is used for concatenation and replication with string data
type respectively?
a. -,+ b. /,* c. +,* d. *, /
10. Consider the statement Roomno = (101,201,301,401). Identify the statement that will result in
an error.
a. print(Roomno[6-3]) b. Roomno[1] = Roomno[1] + 7
c. print(max(Roomno)) d. print(min(Roomno))
11. Which of the following statement is correct in the context of binary files?
a. Binary files are always opened using ‘r’ mode for reading.
b. Binary files cannot be read successfully by the software that creates it.
c. Data in binary files have well defined End of Line and End of File characters.
d. Pickle module is used for reading and writing in Binary files
12. The default reference point used by seek() to move the cursor to a required offset is
a. From end of the file b. From current position of the cursor
c. From the beginning of the file d. None of the above
13. Which of the following statement is correct for loading data from a binary file?
a. pickle.load(f,d) Here f is the file pointer and d is a list
b. d=load(f) Here f is the file pointer and d is a list
c. f=pickle.load(d) Here f is the file pointer and d is a list
d. d=pickle.load(f) Here f is the file pointer and d is a list
14. Which of the following integers can be used as a reference point in seek()?
a. -1 b. 4 c. 2 d. -2
15. Which of the following components of a function is used to keep the actual parameters in
Python?
a. Function Header b. return Statement c.Function Body d. Function Call
16. Which of the following function header is correct?
a. def Volume(Length=100,Breadth,Height=100)
b. def Volume(Length=100,Breadth=100,Height)
c. def Volume(Length ,Breadth=100,Height)
d. def Volume(Length,Breadth,Height=100)
17. Which of the following is the correct way to call a function Area()?
a. Call Area() b. def Area() c. Area d. Area()
18. The Full form of csv is?
a. Comma System Value b.Computer System Vector
c. Comma Separated Value d. Computer Separated Value
19. The Syntax to open a csv file abc.csv for reading is:
a. F= open(‘abc.csv’,’rb’) b. F= open(‘abc.csv’,’w’) c. F= open(‘abc.csv’,’r’) d. None
20. Which of the following is a function of csv module in Python?
a. read(n) b. Load() c. reader() d. readline()
21. Which of the following is not a function of csv module in Python?
a. writer() b. writerow() c. write() d.None Of these
22. Which one of the following is the default extension of a text file?
a. .exe b. .p++ c. .py d. .txt
23. Which of the following symbol is used in Python for multiline comment?
a. / b. ‘ ‘ ‘ ‘ ‘ ‘ c // d. #
24. Which of the following statement will add data in an already existing binary file Flowers.dat ?
a. with open('Flowers.dat','wb') as f:
pickle.dump([‘Rose’,’Marigold’],f)
b. with open('Flowers.dat','rb') as f:
pickle.dump([‘Rose’,’Marigold’],f)
c. with open('Flowers.dat','r') as f:
pickle.dump([‘Rose’,’Marigold’],f)
d. with open('Flowers.dat','ab') as f:
pickle.dump([‘Rose’,’Marigold’],f)
25. Which of the following is the correct way to declare a dictionary?
a. D=( 1:’Rohit ‘,2:’Suman’) b. D=[ 1:’Rohit ‘,2:’Suman’]
c. D={ 1:’Rohit ‘,2:’Suman’} d. D=( [1,’Rohit’] ,[2:’Suman’])
Section-B
This section consists of 24 Questions (26 to 49). Attempt any 20 questions.
26. What is the output of following code:
Data=(400,)
print(Data*2)
a. Syntax error b. (400,) c. 800 d. (400,400)
27. Suppose the file 'Wonder7.txt' contains the following three words ‘Pyramids of Egypt’
What will be the output of the following code?
File = open("Wonder7.txt")
Wonder = File.read()
print(len(Wonder//5)
File.close()
a. 3 b. 4 c. 5 d. 6
28. Identify the output of the following Python statements.
Record = [[‘Vijay’,‘Akash’,‘Saurabh’],[‘Kumar’,’Mishra’,’Bose’]]
Data = Record[0][2]+ ‘ ‘ + Record [1][1]
print(Data)
a. Vijay Kumar b. Saurabh Mishra c. Akash Bose d. None
29. Identify the output of the following Python statements.
num = 8
while num != 0:
print(num+1, end=' ')
num = num – 2
a. 3795 b. 9753 c. 6753 d. 7523
30. Identify the output of the following Python statements.
i = 10
for j in range(20, 15, -2):
i += j
print(i)
a. 61 b. 63 c. 66 d. 64
31. Identify the output of the following Python statements.
L = [12, 13, 18, 46, 54]
L.insert( 3, 4)
L.insert( 2, 3)
print (L[-4])
a. 4 b. 3 c. 18 d. 13
32. Payal is trying to write a tuple Actor = (1,’Prakash’,46) on a binary file Actor.dat. Consider
the following code written by her.
import pickle
Actor = (1,’Prakash’,46)
File = open("Actor.dat",'wb')
pickle. #Statement 1
File.close()
Identify the missing code in Statement 1.
a. File.dump(File,Actor) b. File.dump(Actor,File)
c. File.write(File,Actor) d. File.load(File,Actor)
33. A binary file Student.dat has following data created using List [Rollno,Name,Marks].
Rollno Name Marks
1 Arnab 50
2 Ajay 82
3 Anjan 78
4 Antara 89
5 Ayan 64
def Stud():
f=open("Student.dat","rb")
Tot=0
P=pickle.load(f)
for R in P:
if R[0]% 2 == 0:
Tot=Tot+R[2]
print(Tot)
f.close()
When the above mentioned function, Stud() is executed, the output displayed is___.
a. 363 b. 171 c. 146 d. 201
34. What will be the output of the following Python code?
def Calc (one, Two):
global Three
Three = one + Two
return Three // Two
Three = Calc(50,100)
print(Three)
a. None b. 1 c. Null d. One
35. Evaluate the following expression and identify the correct answer.
10 - 4 // 2 + 5 + 3**3 – 4
a. 24 b. 36 c. 28 d. 42
36. What will be the output of the following code?
def Add(a=15, b=20):
a += 5
b=b*2
return a+b
print(Add(5) , Add()*3)
a. 100 180 b. 50 300 c. 50 180 d. 50 100

37. What will be the output of the following code?


Num = 200
def Show(P):
global Num
Num = 100
if P%10==0:
Num = Num // P
else:
Num = Num * P
print(Num, end="$")
Show(50)
print(Num)
a. 200$200 b. 200$2 c. 2$200 d. 2$2
38. What will be the output of the following code?
import random
City=["Ranchi","Jamshedpur","Dhanbad","Bokaro"]
for i in range(4):
j = random.randint(1,3)
print(City[j],end="#")
a. Bokaro#Jamshedpur#Jamshedpur#Jamshedpur#
b. Bokaro#Ranchi#Jamshedpur#Jamshedpur#
c. Bokaro#Jamshedpur#Ranchi#Jamshedpur#
d. Bokaro#Jamshedpur#Jamshedpur#Ranchi#
39. What is the output of the following code snippet?
def Calculate(P,Q):
for i in range(Q):
if P[i]%2 == 0:
P[i]//=2
if P[i]%3 == 0:
P[i]//=3
List = [15,18,20,14]
Calculate(List,4)
for i in List:
print(i,end="#")
a. 5#5#10#7# b. 5#3#10#10# c. 5#3#10#7# d. 5#3#3#7#
40. Suppose content of 'Trees.txt' is
Trees are the best gift of Nature
They give us Oxygen
Birds make nest in Trees
What will be the output of the following code?
File = open("Trees.txt")
record = File.read()
Data= record.split()
print(len(Data))
File.close()
a. 14 b. 15 c. 16 d. 17

41. Find the output of the following code:


Name="oLymPics2021"
R=""
for x in range(len(Name)):
if Name[x].isupper():
R=R+Name[x].lower()
elif Name[x].islower():
R=R+Name[x].upper()
elif Name[x].isdigit():
R=R+Name[x-1]
else:
R=R+"$"
print(R)

a. olYmPICSs202 b. OLYMpICSs22 c. OlYMpICSs202 d. OLYMpICSs202


42. Suppose content of 'Cricketer.txt' is ‘SaChIn’
What will be the output of the following code?
File = open("Cricketer.txt",’r’)
Name = File.read()
print(Name.swapcase())
File.close()
a. SACHIN b. SaChIn c. sAcHiN d. sachin
43. Suppose content of 'Proverbs.txt' is ‘Rome was not built in a day’
File = open("Proverbs.txt")
Text = File.read()
Data = Text.split()
print(Data[1])
File.close()
a. O b. Ro c. w d. was
44. What will be the output of the following code?
def myfunc():
global val
val *= 20
print(val/10, end=' ')
val=10
print(val, end=' ')
myfunc()
print(val, end=' ')
a. 10 20.0 200 b. 20.0 20.0 200 c. 10 10 200 d. 10 20.0 20.0
45. Suppose content of 'Bookname.txt' is ‘My Experiment with Truth’
What will be the output of the following code?
File = open("Bookname.txt",’r’)
Num = list("writeWRITE")
count=0
Data = File.read()
for content in Data:
if content in num:
count += 1
print(count)
File.close()
a. 8 b. 9 c. 10 d. 11
46. Suppose content of ‘Poem.txt' is

Our’s is a land of sages,


Known for bravery for ages,
None can with it compete,
Its culture none can beat,
Whatever caste or religion
All live here in unison.
What will be the output of the following code?
File = open("Poem.txt",’r’)
Count = 0
Record = File.readlines()
for Data in Record:
if Data[0] == 'O' or Data[0]==’A’:
Count += 2
else:
Count += 1
print(Count)
File.close()
a. 7 b. 8 c. 9 d. 10
47. The symbol used to denote current working directory while giving absolute path name for
opening a file in Python is:
a. Double Dot b. Single Dot c. Forward Slash d. Double Forward Slash
48. Assume the content of text file, 'Player.txt' is:
Virendra Kumar Suresh Singh Yogesh Awasthi
What will be the data type of Record?
File = open("Player.txt",’r’)
Record = File.readline()
File.close()
a. String b. list c. tuple d. dictionary
49. What will be the output of the following code?
Data = [1,2,3,[14,19]]
Data[-1][1]=11
print(Data)
a. [1,2,[3,11],[14,19] ] b. [ [1,11],2,3,[14,19] ] c. [1,2,3,[14,11] ] d. Error
Section-C
Case Study based Questions
This section consists of 6 Questions (50-55) Attempt any 5 questions.
Piyush, a software developer, is working on CSV File Module in Python. He has been assigned an
incomplete python code (shown below) to create a CSV File 'Employee.csv' (content shown
below). Help him in completing the code which creates the desired CSV File.
CSV File
1001, Rajesh, Jodhpur, 25000
1002, Swati, Ranchi, 30000
1003, Akhilesh, Raipur, 15000
1004, Peter, Kolkata, 35000
1005, Sujata, Cuttack, 20000
Incomplete Code
______ csv #Statement-1
f = _______(‘Employee.csv,____, newline='') #Statement-2
Ewriter = csv. #Statement-3
Emp = [ ]
header = ['Employee Id', 'Employee Name', 'City', 'Salary']
Emp.append(header)
for i in range(5):
Emp_Id = int(input("Enter Employee Id :"))
Emp_Name = input("Enter Name : ")
City = input("Enter City : ")
Salary = int(input("Enter Salary : "))
rec = [_____] #Statement-4
Emp.append(_____) #Statement-5
Ewriter. (Emp) #Statement-6
f.close()
50. Identify the suitable code for blank space in the line marked as Statement-1.
a. Add b. import c. export d. use
51. Identify the missing code for blank space in line marked as Statement-2.
a. ‘open’,’wb’ b. open ,’w’ c. close,’r’ d. close,’w’
52. Choose the function name (with argument) that should be used in the blank space of line
marked as Statement-3.
a. reader(f) b. reader() c. writer(f) d. writer()
53. Identify the suitable code for blank space in line marked as Statement-4.
a. Emp_Id,Emp_Name, City,Salary b.‘Emp_Id’,’Emp_Name’, ‘City’,’Salary’
c. Emp_Id,’Emp_Name’, City,’Salary’ d. ‘Emp_Id’,Emp_Name, ‘City’,Salary
54. Identify the suitable code for blank space in the line marked as Statement-5.
a. Emp b. Write 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()
***

You might also like