QP - Hy Cs Xii 2023
QP - Hy Cs Xii 2023
1 Which of the following network devices is used to connect between two dissimilar protocols? 1
0 a) Switch b) Router c) Modem d) Gateway
11 Which network protocol provides a command line interface for communication with a remote 1
device or server?
a) Telnet b) HTTP c) PPP d) SMTP
1 Which of the following switching techniques sends small pieces of data across a network? 1
2 a) Circuit switching
b) Message switching
c) Packet switching
d) All the above.
Questions 15 to 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as:
i) Both A and R are true and R is the correct explanation for A
ii) Both A and R are true and R is not the correct explanation for A
iii) A is True but R is False
iv) A is false but R is True
1 Assertion: Positional parameters in a python function must always follow the default parameters. 1
6 Reasoning: Default parameters provide a default value whenever the argument is not passed
during a function call.
1 Assertion: CSV files stores data in a file with values separated by commas and we can open them 1
8 normally using open() function.
Reasoning: CSV files are simple text files with .csv extension.
2
SECTION-B
1 State True or False: 2
9 a) Nested lists inside a tuple are mutable. Eg. (10, [20,30,40], 50) can become (10,
[20,50,40], 50)
b) A python user defined function may not have a body at all and can be successfully called.
Eg.
def foo():
2 Read the following programs and name the exceptions that will arise after executing the code: 2
2 a) print(int('A'))
b) a = 10
print(b)
2 What will be the lowest and the highest values of n in the program given below. Also predict the 2
3 correct output from the given choices:
import random
name = ['TOM','BOB','JIM','SID','JOE']
low = 1
high = 4
for i in range(4):
n = random.randrange(low, high+1)
print(name[n], end='#')
high=high-1
a) BOB#JOE#JIM#BOB#
b) JIM#JIM#BOB#SID#
c) BOB#JIM#JIM#BOB#
d) JOE#SID#SID#BOB#
2 Rewrite the following program after removing the errors. Also underline the corrections made. 2
4 n = int(input())
if n % 10 = 0:
n = n + 10
elif n >= 20:
n =- 5
else
n = 40
print("n=" n)
2 Write one advantage and one disadvantage of bus topology. 2
5
3
4
2 Expand the following abbreviations: 2
6 a) SMTP
b) ARPANET
SECTION – C
2 Fill in the blanks for the following questions: 3
7 a) ___________ topology is highly dependent on the central node.
b) The unit of measurement of data transfer rate is ____________.
c) The relative address of a document or a resource on a webserver is called ___________.
[OR]
What will be the output of the following python program:
name = "HOME ALONE WITH MOM"
data = name.partition('ALONE')
print(data[0].lower())
print(data[2].title())
print(data[1][::-2])
3 A pre-written text file data.txt has some strings stored in it. Write a python function display() that 3
0 reads the contents of the file and displays all the words that start with the substring 'th' or 'Th'.
Eg. If the file has the following data:
“There was a man who throughout his life
thanked others for their little help”
The output should be:
There
throughout
thanked
[OR]
A pre-written text file info.txt has some strings written in it. Write a python function countme()
that reads the contents of the file and returns the count of all the words which are 'that'.
5
3 A pre-written text file info.txt has some lines written in it. Write a function display() that prints 3
1 all the lines that has the word 'India' in them.
[OR]
A pre-written text file data.txt has some lines written in it. Write a function display() that prints
all the lines that have exactly 10 words in them.
SECTION – D
3 A binary file student.dat needs to be written with the following data in the form of dictionaries. 4
3 Rollno Name Class Marks
1001 Tom 10 75
1002 Bob 11 80
1003 Sid 10 90
a) Write a python function insert() that opens the binary file for writing and writes all the three
records in it.
b) Write python function view() that opens the binary file for reading and displays student
details whose Marks are more than 75.
[OR]
A binary file emp.dat needs to be written with the following data in the form of lists.
Empno Ename Gende Salary
r
2001 Richa F 7500
2002 Sonam F 9000
2003 Manu M 8000
a) Write a python function insert() that opens the binary file for writing and writes all the three
records in it.
b) Write python function show() that opens the binary file for reading and displays employee
details whose gender is F.
3 Write a python function push(stack) that pushes on to an empty list(stack) all the values of a 4
4 dictionary whose keys are palindromes.
Eg: for the dictionary {'ROY':100, 'ARORA':200, 'MADAM':250, 'SAHA':300, 'LEVEL':400}
the stack should have the values 200, 250 and 400 since ARORA, MADAM and LEVEL are
palindromes.
Write a python function popstack(stack) that pops out the last added element from the stack each
time the function is called and also prints a 'Stack Empty' message if all the elements have
popped out.
Also write the call statements for both the functions.
[OR]
Write a python function push(stack) that pushes on to an empty list(stack) all the values from a
list of strings, whose lengths are more than 5.
Write a python function popstack(stack) that pops out the last added element from the stack each
time the function is called and also prints a 'Stack Empty' message if all the elements have
popped out.
Also write the call statements for both the functions.
SECTION – E
3 Rohit wants to create a python application that writes a set of records in a csv file info.csv. He is 5
5 having some issues and has left a few blank lines. On behalf of Rohit, you are directed to write
the missing codes.
6
_____________ # Statement 1
f = open('info.csv', 'w', newline='')
csvwriter = __________________ # Statement 2
head = ['Id', 'Book', 'Quantity', 'Price']
data = [[101, 'Stardust', 100, 50], [102, 'Athabasca', 200, 300], [103, 'Troy', 150, 180]]
___________________ # Statement 3
___________________ # Statement 4
___________________ # Statement 5
a) Statement 1 : Write a statement that enables python to work with csv files.
b) Statement 2 : Write a statement to initialize the csvwriter object.
c) Statement 3 : Write a statement to write the head object to the file.
d) Statement 4 : Write a statement to write the data object to the file.
e) Statement 5 : Write a statement end the program be releasing the file handle f.
3 Tribor infotech has their new campus in Bangalore. They have four buildings on their campus 5
6 that need to be connected through a network. The details of the number of computers in each
building and distance between the buildings are as below.
Accounts HR
Tech Admin