0% found this document useful (0 votes)
17 views

Revision Ques

Uploaded by

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

Revision Ques

Uploaded by

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

Evergreen Vidhyaashram Senior Secondary School

REVISION TEST-I
SUBJECT CODE-83
Class XII mark:70
Subject: Computer science Duration :3Hr
General Instructions:
i. This question paper consists of 29 questions in 4 sections.
ii. All questions are compulsory. However, an internal choice is provided in some questions. A
student is expected to attempt only one of these questions.
iii. Section A consists of objective type questions carrying 1 mark each.
iv. Section B consists of Very Short questions carrying 02 marks each. Answers to these
questions should in the range of 30 to 50 words.
v. Section C consists of Short Answer type questions carrying 03 marks each. Answers to these
questions should in the range of 50 to 80 words
vi. Section D consists of long answer type question carrying 05 mark each answer to these
question should be in the range of 80 to 120 words.
vii. Section E consists of 1 case-based units of assessment each with sub-parts.
Section A
I.Choose the correct answer (16×1=16)
1.Data structure stack is also known as _____list
a) First in first out b) First in last out
c)last in first out d)All of these
2. _____form of access is used to add /remove nodes from a stack .
a)LIFO b) FIFO c)Both(a)and(b) d)None of these
3. How many except statements can a try-except block have?
a) zero
b) one
c) more than one
d) more than zero
4. When will the else part of try-except-else be executed?
a) always
b) when an exception occurs
c) when no exception occurs
d) when an exception occurs in to except block
5. . Is the following Python code valid?
try:
# Do something
except:
# Do something
finally:
# Do something
a) no, there is no such thing as finally
b) no, finally cannot be used with except
c) no, finally must come before except
d) yes
6. What will be the output of the following Python code?
def foo():
try:
return 1
finally:
return 2
k = foo()
print(k)
a) 1 b) 2 c) 3 d) error, there is more than one return statement in a single try-finally
block
7. What will be the output of the following Python code?
f = None
for i in range (5):
with open("data.txt", "w") as f:
if i > 2:
break
print(f.closed)
a) True
b) False
c) None
d) Error
8. To read the next line of the file from a file object infile, we use ____________
a) infile.read(2)
b) infile.read()
c) infile.readline()
d) infile.readlines()
9. . Which of the following are the modes of both writing and reading in binary format in
file?
a) wb+
b) w
c) wb
d) w+
10. Which of the following statements is true about reading files in Python?
a) The read() method reads one line at a time
b) The readline() method reads the entire file at once
c) The readlines() method reads one character at a time
d) The read() method reads the entire file at once
11. Which of the following is used to open a file in Python in binary mode?
a) open(‘file.txt’, ‘b’)
b) open(‘file.txt’, ‘binary’)
c) open(‘file.txt’, ‘rb’)
d) open(‘file.txt’, ‘wb’)
12.What will be the output of the following python code?
1st =[3,4,6,1,2,]
1st[1:2]=[7,8]
Print (1st )
a)[3,7,8,6,1,2] b)Syntax error c)[3,[7,8,],6,1,2] d)[3,4,6,7,8]
13.In a stack ,deletions take place at____end
a)front b)top c)rear d)any
Assertion Reasoning Question
Directions :In the following questions,a statement of assertion is followed by a statement of
reason
Mark the correct choice as:
I)Both A and R are true and R is the correct explanation of A.
II)Both A and R are true but R is not the correct explanation of A.
III)A is true but R is false IV) A is false but R is true
14.Assertion : Exception handling handles all types of errors and exception .
Reasoning :Exception handling is responsible for handling anomalous stiuuation during the
execution of a program
15. Assertion:Text file stores information in the ASCII or Unicode format/characters
Reasoning®:In a rext file,there is no delimiter for a line
16.Assertion:Stack is a memory structure that works on the principle of FIFO (First In ,First
Out)
Reasoning ®:Stack is implement using list and allows to add an element using append
()method ()
Section B
II.Answer the following Question. (5x2=10)
17.Give the necessary declaration of a list implement stack containing numeric type
data .also write user-defined function to pop a number from the stack
18. Write function in python ,do_push (Num)and do_pop (num),to add a new number and
delete a number from a list of numbers ,considering them to act as push and pop operation of
the stack data structure .
19. Display a program to read and display the contents of employee .csv file
20. What is the different in file opening mode “a” and “w” ?
21. Write a function in python to count the number of lines in “POEM.txt”
begins from Upper case character.
For e.g if the content of file
is : O Corona O Corona
Jaldi se tum Go na
Social Distancing ka palan
karona sabse 1 meter ki duri
rakhona Lockdown me ghar me
ho to online padhai karona
Output should be: Lines starting from Capital letters: 4
Section C
III. Answer the following Question (any seven) (7x3=15)
22. Write a function in python to read lines from file “POEM.txt” and count
how many times the word “Corona” exists in file.
For e.g. if the content of file is : O Corona O Corona
Jaldi se tum Go na
Social Distancing ka palan karona sabse 1 meter ki duri rakhona Lockdown me
ghar me ho to online padhai karona
O Corona O Corona Jaldi se tum Go na
Output should be: Number of time word Corona occurs : 4
23. Write a program to create a CSV file to store student data (Rollno,Name,Marks)obtain
data from user and write 5 records into the file .
24. How to creating a queue using list & inserting an element into a queue.
25. Write a function COUNT() in Python to read contents from file
“REPEATED.TXT”, to count and display the occurrence of the word “Catholic”
or “mother”.
For example:
If the content of the file is “Nory was a Catholic because her mother was a
Catholic , and Nory‟s mother was a Catholic because her father was a Catholic
, and her father was a
Catholic because his mother was a Catholic , or had been The function should
display:
Count of Catholic, mother is 9
26 . Evaluate the postfix expression AB+C/if A=2,B=3,C=4and D=5.
27. Evaluate the following postfix notation of expression (show status of stack after
execution of each operation )4,10,5,+,*,15,3,1,-]
28. Write a program to read a text file and display the count of lowercase and uppercase
letter in the file.
29. Write a program to accept string /sentences from the user till the user
enter”END”to .save the data in a text file and then display only those sentences which begin
with an uppercase alphabet
Section D
IV.Answer the following Question (any three) (3x5=15)
30. Display a program to enter the following record in a binary file
Item no integer
Item-Name string
Qty integer
Price float
Number of record to entered should be accepted from the user .read the file to display the
records in the following format
Item no :
Item-Name :
Quantity :
Price per item :
Amount to be calculated as price *Qty)
31. Write a python function ATOEDISP() for each requirement in Python to
read the file “NEWS.TXT” and
Display “E” in place of all the occurrence of “A” in the word COMPUTER.
Display “E” in place of all the occurrence of “A”:
i sell computars. i have a computar. i need a computar. i want a
computar. i use that computar. my computar crashed.
the function should display
i) i sell computers. i have a computer. i need a computer. i want a
computer. i use that comptuer. my computer crashed.
ii) ii) i sell computers. i heve e computer. i need e computer. i went e
computer. i use thet comptuer. my computer creshed.
32.I)Show a output of the following python code ?Explain the try and except used in the
code
A=0
B=6
Print (‘one’)
Try:
Print(‘two’)
X=8/A
Print(‘Three’)
Exception Zero DivisionError:
Print(B*2)
Print (‘Four’)
Except :
Print(b*3)
Print(‘five’)
II)Explain try ..except ..else with the help of an example which raise an error when the the
denominator is zero while dividing x by y and display the quotient otherwise.
33.Differentiate between a text file, a binary file and a CSV file
I)Write a program to add Employee record such as employee number ,employee
name ,salary onto a CSV file

Section E
IV.Casebased question (2x4=8)
34. Airbnb, a global booking platform, handles millions of transactions daily. To ensure
seamless bookings, Airbnb implemented robust data exception handling and error debugging
mechanisms. Their system detects and resolves errors in real-time, logs exceptions for
analysis, and triggers alerts for critical issues. Automated testing and continuous integration
ensure prompt bug fixes, minimizing downtime and ensuring a smooth user experience.
1. What is the primary benefit of Airbnb's real-time error detection?
A) Improved scalability B) Enhanced security C) Reduced downtime D) Increased revenue
2.How does Airbnb handle critical exceptions?
A) Manual resolution B) Automated workflows C) User notification D) Alert triggers
3. What is the outcome of Airbnb's error debugging efforts?
A) Increased system crashes B) Reduced user engagement
C) Seamless bookings D) Higher maintenance costs
4. What data exception handling mechanism does Airbnb utilize?
A) Data validation B) Data normalization C) Data logging D) Data encryption
35. New Horizon Technology institute stores the detains of the student enrolled with it.A
binary file “STUDENT.DAT”has the structure –
adimission_number,name ,percentage .write a function countRed ()in python that would read
contents of the file “STUDENT.DAT”and display the details of those student whose
percentage is above 75.Also display the number of student scoring above 75%
SIGNATURE OF THE TEACHER SIGNATURE OF THE COORDINATOR

SIGNATURE OF THE PRINCIPAL

You might also like