Sample paper-UT2
Sample paper-UT2
BANGALORE EAST
UNIT TEST-2 Practice Paper 2024– 2025
Name: Date:
Subject: Computer Science Class: XII
Duration: 3 hours Max.Marks:70
General Instructions:
1. This question paper contains 37 questions.
2. All questions are compulsory.
3. The paper is divided into 5 Sections- A, B, C, D and E.
4. Section A, consists of 21 questions (1 to 21). Each question carries 1 Mark.
5. Section B, consists of 7 questions (22 to 28). Each question carries 2 Marks.
6. Section C, consists of 3 questions (29 to 31). Each question carries 3 Marks.
7. Section D, consists of 4 questions (32 to 35). Each question carries 4 Marks.
8. Section E, consists of 2 questions (36 to 37). Each question carries 5 Marks.
9. All programming questions are to be answered using Python Language only.
10. In case of MCQ, text of the correct answer should also be written.
5. State True/False 1
file mode is mandatory argument for open() function.
6. __________ files are stored in a computer in a sequence of bytes. 1
(A) Text
(B) Binary
(C) CSV
(D) Notepad
7. Dima is trying to read a list l1 from a binary file ‘num’. Consider the 1
following code written by her.
import pickle
f1 = open("num",'rb')
l1=__________________#Statement 1
print(l1)
f1.close()
Identify the missing code in Statement 1.
A. pickle.load(f1)
B. pickle.load(l1,f1)
C. pickle.read(f1)
D. pickle.dump(l1,f1)
8. Consider the following directory structure. 1
What will be the absolute path of infrastructure?
(a) Final\Infrastructure
(b) D:\Data\Final\Infrastructure
(c) ..\Final\Infrastructure
(d)..\Shapefiles\Final\Infrastructure
9. A text file is opened using the statement f = open(‘story.txt’). The file has a 1
total of 10 lines. Which of the following options will be true if statement 1 and
statement 2 are executed in order.
Statement 1: L1 = f.readline( )
Statement 2: L2 = f.readlines( )
A. L1 will be a list with one element and L2 will be list with 9 elements.
B. L1 will be a string and L2 will be a list with 10 elements.
C. L1 will be a string and L2 will be a list with 9 elements.
D. L1 will be a list with 10 elements and L2 will be an empty list.
10. ______ condition will arise, if a user tries to pop an empty stack. 1
15. A set of rules that need to be followed by the communicating parties in order 1
to have successful and reliable data communication is called ____.
20. Assertion (A): If numeric data are to be written to a text file, the data needs to 1
be converted into a string before writing to the file.
Reason (R): write() method takes a string as an argument and writes it to the
text file.
21. Assertion (A): If a text file already containing some text is opened in write 1
mode the previous contents are overwritten.
Reasoning (R): When a file is opened in write mode the file pointer is present
at the beginning position of the file.
SECTION-B ( 7 x 2 = 14 )
22. How can a function return multiple values? Illustrate with an example 1+1
program.
23. Rewrite the code after correcting it and underline the corrections. 2
Def swap(d):
n={}
values = d.values()
keys = list(d.keys[])
k=0
for i in values
n(i) = keys[k]
k=+1
return n
result = swap({‘a’:1,’b’:2,’c’:3})
print(result)
25. Differentiate between fruitful and non-fruitful function with the help of an 2
example.
26. What are the benefits of Exception Handling. 2
27. (i) Expand the following terms : URL, XML 1+1
(ii) Give one difference between HTTP and FTP.
28. (i) Define the term IP address with respect to network. 1+1
(ii) What is the main purpose of a Router?
SECTION-C ( 3 x 3 = 9 )
31. A dictionary, d_city contains the records in the following format : {state:city} 3
Define the following functions with the given specifications :
(i) push_city(d_city): It takes the dictionary as an argument and pushes all the
cities in the stack CITY whose states are of more than 4 characters.
(ii) pop_city(): This function pops the cities and displays "Stack empty" when
there are no more cities in the stack.
SECTION-D ( 4 x 4 = 16 )
32. (i) When is EOFError exception raised in python? 1+3
(ii) Give an example code to handle EOFError? The code should display the
message "No more objects to read" in case of EOFError exception, and the
message "Some error occurred" in case of any other exception.
34. (i) Give one difference between write() and writeline() function in text 1+3
file.
(ii) Write a method/function COUNTWORDS() in Python to read
contents from a text file DECODE.TXT, to count and return the
occurrence of those words, which are having 5 or more characters
and at least one digit in it.
SECTION-E ( 2 x 5 =10 )
36. (i) What is the main purpose of seek() and tell() method ? 1+4
(ii) A binary file “Items.dat” has structure as [Code, Description, Price].
Write a function UpdateRec(Code) in Python which will accept the code as
parameter and update the price of that by 5%. Also display an appropriate
message if there is no record matching for that particular Code in the file.
37. Logistic Technologies Ltd. is a Delhi based organization which is expanding 5
its office set-up to Ambala. At Ambala office campus, they are planning to
have 3 different blocks for HR, Accounts and Logistics related work. Each
block has a number of computers, which are required to be connected to a
network for communication, data and resource sharing.
(i) Suggest the most appropriate block/location to house the SERVER in the
Ambala office. Justify your answer.
(ii) Suggest the best wired medium to efficiently connect various blocks within
the Ambala office compound.
(iii) Draw an ideal cable layout (Block to Block) for connecting these blocks
for wired connectivity.
(iv) The company wants to schedule an online conference between the
managers of Delhi and Ambala offices. Which protocol will be used for
effective voice communication over the Internet?
(v) Which kind of network will it be between Delhi office and Ambala office ?