0% found this document useful (0 votes)
345 views14 pages

12 CS PreBoard SET QPMS 2024-25

Pre board question

Uploaded by

Vikas Chaudhary
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)
345 views14 pages

12 CS PreBoard SET QPMS 2024-25

Pre board question

Uploaded by

Vikas Chaudhary
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/ 14

अनक्र

ु म ांक/ROLL NO सेट/SET : 01

केंद्रीय विद्य लय सांगठन ,जयपुर सांभ ग


KENDRIYA VIDYALAYA SANGATHAN, JAIPUR REGION
प्रथम प्री बोर्ड परीक्ष / 1ST PRE BOARD EXAMINATION :2024-25
कक्ष / CLASS :XII
विषय /SUB : कांप्यूटर विज्ञ नां (83) /COMPUTER SCIENCE (83)
अधिकतम अिधि / Time Allowed :03 Hours अधिकतम अांक Maximum Marks : 70
स म न्य ननर्दे श / General Instructions

● This question paper contains 37 questions.


● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In the case of MCQ, the text of the correct answer should also be written.

Q. Section-A (21 x 1 = 21 Marks) Mark


1 State True or False: 1
The keys of a dictionary must be of immutable types.
2 Identify the output of the following code snippet: 1
str = "KENDRIYA VIDYALAYA"
str=str.replace('YA','*')
print(str)
(a) KENDRIYA VIDYALAYA (b) KENDRI*A VID*ALAYA
(c) KENDRI* VID*LA* (d) * KENDRI* VID*LA*
3 What will be the output of following expression? 1
(5<10 ) and (10< 5) or (3<18) and not 8<18
(a) True (b) False (c) Error (d) No output
4 What is the output of the expression? 1
St1=”abc@pink@city”
print(St1.split("@"))
(a) (“abc”, “@”, “pink”, “@”, “city”) (b) [“abc”, “@”, “pink”,”@’,”city”]
(c) [“abc”, “pink”, “city”] (d) Error
5 What will be the output of the following code snippet? 1
message= "Satyamev Jayate"
print(message[-2::-2])
6 Which of the following options will not result in an error when performed on types in 1
python where tp = (5,2,7,0,3) ?
(a) Tp[1] = 2 (b) tp.append(2)
(c) tp1 = tp+tp (d) tp.sum( )

Page 1 of 7
7 If my_dict is a dictionary as defined below, then which of the following statements will 1
raise an exception?
my_dict = {'aman': 10, 'sumit': 20, 'suresh': 30}
(a) my_dict.get('suresh') (b) print(my_dict['aman', 'sumit'])
(c) my_dict['aman']=20 (d) print(str(my_dict))
8 Which of the following can delete an element from a list if the index of the element is 1
given?
(a) pop( ) (b) remove( )
(c) clear( ) (d) all of these
9 Which of the following attributes can be considered as a choice for primary key? 1
(a) Name (b) Street
(c) Roll No (d) Subject
10 Write the missing statement to complete the following code: 1
file = open("abc.txt", "r")
d = file.read(50)
____________________ #Move the file pointer to the beginning of the file
next_data = file.read(75)
file.close()
11 State whether the following statement is True or False: 1
An exception may be raised even if the program is syntactically correct.
12 What will be the output of the following Python code ? 1
v = 50
def Change(n):
global v
v, n = n, v
print(v, n, sep = “#”, end = “@”)
Change(20)
print(v)
(a) 20#50@20 (b) 50@20#50
(c) 50#50#50 (d) 20@50#20
13 Which statement is used to modify data in a table? 1
(a) CHANGE (b) MODIFY (c) UPDATE (d) ALTER

14 How would you return all the rows from a table named "Item" sorted in descending 1
order on the column "IName"?
(a) SELECT * FROM Item SORT 'IName' DESC;
(b) SELECT * FROM Item ORDER BY IName DESC ;
(c) SELECT * FROM Item ORDER IName DESC ;
(d) SELECT * FROM Item SORT BY 'IName' DESC;
15 LIKE clause is used for. 1
(a) For pattern matching (b) For table matching
(c) For inserting similar data in a table (d) For deleting data from a table
16 Count(*) method count 1
(a) NULL values only (b)Empty Values
(c) ALL the values (d) None of these
17 The term HTTP stands for? 1
(a) Hyper terminal tracing program (b) Hypertext tracing protocol
(c) Hypertext transfer protocol (d) Hypertext transfer program

18 A device that connects networks with different protocols – 1


(a) Switch (b) Hub (c) Gateway (d) Proxy Server
19 Which switching technique follows the store and forward mechanism? 1

Page 2 of 7
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct
choice as:
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is False but R is True
20 Assertion :- A parameter having a default value in the function header is known as a 1
default parameter.
Reason:- The default values for parameters are considered only if no value is
provided for that parameter in the function call statement.
21 Assertion :- Both WHERE and HAVING clauses are used to specify conditions.
Reason :- The WHERE and HAVING clauses are interchangeable.

Q Section-B ( 7 x 2=14 Marks) Mark


22 What are immutable and mutable types? List immutable and mutable types of 2
python.
23 If given A=2,B=1,C=3, What will be the output of following expressions: 2
(i) print((A>B) and (B>C) or(C>A))
(ii) print(A**B**C)
24 Write the most appropriate list method to perform the following tasks. 2
(I) A) To delete a given element from the list L1.
OR
B) To sort the elements of list L1 in ascending order.
(II) A) To add an element in the beginning of the list L1.
OR
B) To add elements of a list L2 in the end of a list L1.
25 What possible outputs(s) are expected to be displayed on screen at the time of 2
execution of the program from the following code? Also specify the maximum
values that can be assigned to each of the variables FROM and TO.
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO):
print (AR[K],end=”#“)
(i)10#40#70# (ii)30#40#50# (iii)50#60#70# (iv)40#50#70#
26 Rewrite the following code in Python after removing all syntax error(s). Underline 2
each correction done in the code.
p=30
for c in range(0,p)
If c%4==0:
print (c*4)
Elseif c%5==0:
print (c+3)
else
print(c+10)
27 (i) (A) What constraint should be applied on a table column so that duplicate 2
values are not allowed in that column, but NULL is allowed.
OR
Page 3 of 7
(B) What constraint should be applied on a table column so that NULL is not
allowed in that column, but duplicate values are allowed.
(ii)
(A) Write an SQL command to remove the Primary Key constraint from a table,
named MOBILE. M_ID is the primary key of the table.
OR
B) Write an SQL command to make the column M_ID the Primary Key of an
already existing table, named MOBILE.
28 (A) How is it easier to diagnose fault in Star topology than in Bus topology ? 2
OR
(B) Nirmala is a bit confused between the terms Web server and Web browsers.
Help her in understanding both the terms with the help of suitable example.

Q Section-C ( 3 x 3 = 9 Marks) Mark


29 (A) Write a Python function that count the lines start with the word “the” in a file 3
“xyz.txt” and display it at the end.
OR
B) Write a Python function that Count total number of vowels in a file “abc.txt”.
30 (A) Madhuri has a list containing 10 integers. You need to help him create a 3
program
with separate user defined functions to perform the following operations based on
this list.
● Traverse the content of the list and push the ODD numbers into a stack.
● Pop and display the content of the stack.
For Example:
If the sample Content of the list is as follows:
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
13,21,89,35
OR
(B) Saroj have a list of 10 numbers . You need to help him create a program with
separate user defined functions to perform the following operations based on this
list.
● Traverse the content of the list and push the numbers into a stack which are
divisible by 5.
● Pop and display the content of the stack.
For Example:
If the sample Content of the list is as follows:
N=[2,5,10,13,20,23,45,56,60,78]
Sample Output of the code should be:
5,10,20,45,60
31 (A) Predict the output of the Python code given below: 3
def func(n1 = 1, n2= 2):
n1= n1 * n2
n2= n2 + 2
print(n1, n2)
func( )
func(2,3)

Page 4 of 7
OR
(B) Predict the output of the Python code given below:
T= [“20”, “50”, “30”, “40”]
Counter=3
Total= 0
for I in [7,5,4,6]:
newT=T[Counter]
Total= float (newT) + I
print(Total)
Counter=Counter-1

Q Section-D ( 4 x 4 = 16 Marks) Mark


32 Write SQL queries for (i)to(iv),which are based on the table: ACTIVITY given 4
below:
Table:ACTIVITY
ACode ActivityName ParticipantsNum PrizeMoney ScheduleDate
1001 Relay100x4 16 10000 23-Jan-2004
1002 Highjump 10 12000 12-Dec-2003
1003 ShotPut 12 8000 14-Feb-2004
1005 LongJump 12 9000 01-Jan-2004
1008 DiscussThrow 10 15000 19-Mar-2004
(i) To display the name of all activities with their Acodes in descending order.
(ii) To display sum of PrizeMoney for each of the Number of participants
groupings (as shown in column ParticipantsNum(10,12,16).
(iii) To display the Schedule Date and Participants Number for the activity
Relay100x4.
(iv) To increase PrizeMoney by 500 for High jump activity
OR
Write output for SQL queries(i) to(iii) and query for (iv),which are based on the
table: ACTIVITY:
(i) select count(distinct ParticipantsNum) from ACTIVITY;
(ii) select max(ScheduleDate),min(ScheduleDate) from ACTIVITY;
(iii) select sum(PrizeMoney) from ACTIVITY;
(iv) Write a query to delete the record of Acode 1003.
33 Abhishek is making a software on “Countries & their Capitals” in which various 4
records are to be stored/retrieved in CAPITAL.CSV data file. It consists of some
records. As a programmer, you have to help him to successfully execute the
program.

(A) Write a function in Python named AddNewRec(Country,Capital) to append


following records in the file “CAPITAL.CSV”.
[“FRANCE”,”PARIS”]
[“SRILANKA”,”COLOMBO”]
(B) Write a function in Python named ShowRec( ) that will show all the contents of
CAPITAL.CSV
34 Write SQL commands for the queries (i) to (iii) and output for (iv) & (v) based 4
on a table COMPANY and CUSTOMER .

Page 5 of 7
COMPANY
CID CNAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY MADRAS MOBILE
666 DELL DELHI LAPTOP

CUSTOMER
CUSTID NAME PRICE QTY CID
101 Rohan Sharma 70000 20 222
102 Deepak Kumar 50000 10 666
103 Mohan Kumar 30000 5 111
104 Sahil Bansal 35000 3 333
105 Neha Soni 25000 7 444
106 Sonal Aggarwal 20000 5 333
107 Arjun Singh 50000 15 666
(i) To display those company name along with price which are having price less
than 30000.
(ii) To display the name and price of the companies whose price is between 20000
to 35000.
(iii) To increase the price by 1000 for those customer whose name starts with ‘S’
(iv) To display those product name, city and price which are having product name
as MOBILE.
35 Kabir wants to write a program in Python to insert the following record in the table 4
named Student in MYSQL database, SCHOOL:
- rno(Roll number) – integer
- name(Name) – string
- DOB(Date of Birth) – Date
- Fee – float
Note the following to establish connectivity between Pythonand MySQL:
- Username – root
- Password – tiger
- Host – localhost
The values of fieldsrno, name, DOB and fee has to be accepted from the user.
Help Kabir to write the program in Python.

Q Section-E ( 2 x 5 = 10 Marks) Mark


36 Amit is a manager working in a recruitment agency. He needs to manage the 5
records of various candidates. For this, he wants the following information of each
candidate to be stored: -
Candidate_ID – integer
Candidate_Name – string
Designation – string
Experience – float

Page 6 of 7
You, as a programmer of the company, have been assigned to do this job for Amit.
(i) Write a function to input the data of a candidate and append it in a binary file.
(ii) Write a function to update the data of candidates whose experience is more
than 12 years and change their designation to "Sr. Manager".
(iii) Write a function to read the data from the binary file and display the data of all
those candidates who are not "Sr. Manager".
37 PVS Computers decided to open a new office at Ernakulum, the office consist of 5
Five Buildings and each contains number of computers. The details are shown
below.

Distance between the buildings

Building 1 and 2 20 Meters Building No of computers


1 40
Building 2 and 3 50 Meters
2 45
Building 3 and 4 120 Meters 3 110
4 70
Building 3 and 5 70 Meters
5 60
Building 1 and 5 65 Meters
Building 2 and 5 50 Meters

The Company has now decided to connect network in buildings.


(i)Suggest the most suitable place (i.e. building) to house the server of this
organization. Also give a reason to justify your suggested location.
(ii) Where would you place Hub/Switch? Answer with justification.
(iii) Suggest a cable layout of connection between the buildings (Topology).
(iv) Do you think anywhere Repeaters required in the campus? Why
(v) Suggest a protocol that shall be needed to provide Video Conferencing solution
between Ernakulum Campus and Ranchi Campus.
OR
What type of network (PAN, LAN, MAN, or WAN) will be set up among the
computers connected in the Ernakulum campus?

Page 7 of 7
Kendriya Vidyalaya Sangathan, Jaipur Region
Pre-Board Examination: 2024-25
Marking scheme Set No: 1
Class: XII Subject: Computer Science (083)
Maximum Marks: 70 Period: 3 Hours
Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In the case of MCQ, the text of the correct answer should also be written.

Q. Section-A (21 x 1 = 21 Marks) Mark


Ans 1 True 1
(1 mark for correct answer)
Ans 2 (c) KENDRI* VID*LA* 1
(1 mark for correct answer)
Ans 3 (b) False 1
(1 mark for correct answer)
Ans 4 (c) [“abc”, “pink”, “city”] 1
(1 mark for correct answer)
Ans 5 tyJvmya 1
(1 mark for correct answer)
Ans 6 (c) tp1 = tp+tp 1
(1 mark for correct answer)
Ans 7 (b) print(my_dict['aman', 'sumit']) 1
(1 mark for correct answer)
Ans 8 (a) pop( ) 1
(1 mark for correct answer)
Ans 9 (c) Roll No 1
(1 mark for correct answer)
Ans10 file.seek(0) ( OR file.seek(0,0) ) 1
(1 mark for correct answer)
Ans11 True 1
(1 mark for correct answer)
Ans12 (a) 20#50@20 1
(1 mark for correct answer)
Ans13 (c) UPDATE 1
(1 mark for correct answer)
Ans14 (b) SELECT * FROM Item ORDER BY IName DESC ; 1
(1 mark for correct answer)
Ans15 (a) For pattern matching 1
(1 mark for correct answer)
Ans16 (c) ALL the values 1
(1 mark for correct answer)
Ans17 (c) Hypertext transfer protocol 1
(1 mark for correct answer)
Ans18 (c) Gateway 1
(1 mark for correct answer)
Ans19 Message Switching technique 1
(1 mark for correct answer)
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct
choice as:
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is False but R is True
Ans20 (b) Both A and R are true and R is not the correct explanation for A 1
(1 mark for correct answer)
Ans21 (c) A is True but R is False
(1 mark for correct answer)

Q Section-B ( 7 x 2=14 Marks) Mark


Ans Immutable types are those that can never change their value in place. These are : 2
22 integers, float, string, tuple
Mutable types are those whose values can be changed in place. These are : lists,
dictionaries
(1 mark for each correct definition and example)
Ans (i) True 2
23 (ii) 2
(1 mark for each correct answer.)
Ans 2
24 (I) A) L1.remove(4)
OR
B) L1.sort( )
(II) A) L1.insert( )
OR
B) L1.extend(L2)
(1 mark for each correct answer)
Ans (ii)30#40#50# 2
25 Maximum value assigned to FROM is 3
Maximum value assigned to TO is 4
(1 mark for each correct answer)
(½ x 2 = 1 Mark for correct Maximum values)
Ans p=30 2
26 for c in range(0,p):
if c%4==0:
print (c*4)
elif c%5==0:
print (c+3)
else:
print(c+10)
(½ mark each for correcting 4 mistakes)
Ans (I) A) UNIQUE 2
27 OR
B) NOT NULL
(1 mark for correct answer)

(II) A) ALTER TABLE MOBILE DROP PRIMARY KEY;


OR
B) ALTER TABLE MOBILE ADD PRIMARY KEY (M_ID);
(1 mark for correct answer)
28 Ans: Fault diagnosis is easier in Star topology as if there is any problem in a node 2
will affect the particular node only. While in bus topology, if problem exists in
common medium it will affect the entire nodes.
OR
Web Server Web browser
A web server is a computer or a group A web browser is an application used
of computers that hosts or stores to access and view websites.
content of website. Common web browsers include
It processes and delivers web pages Microsoft Internet Explores, Google
of the websites to the users. Chrome etc.
The main job of a web server is to
display the website content
(2 mark for correct answer)

Q Section-C ( 3 x 3 = 9 Marks) Mark


29 (A) 3
Logic:- We need to split all the words of a every line and then check first word of
each line.
def count_the():
F=open(“abc.txt”,”r”)
L=F.readlines()
count=0
for x in L: # read all the lines one by one
L1=x.split() # It will split all the lines into words
if L1[0].lower() == “the” :
count=count+1
print(“total lines are :- “,count)
F.close()
(½ mark for correct function header)
(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
(½ mark for splitting the text into words/character)
(1 mark for correctly displaying the desired counts)
OR
(B)
Read the file character by character
def count_vowels():
F=open(“abc.txt”, “r”)
S=f.read()
Count=0
for x in S:
if x.lower() in “aeiou”:
count=count+1
print(“total number of vowels are :- “, count)
F.close()

(½ mark for correct function header)


(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
(½ mark for checking vowels)
(1 mark for correctly displaying the desired counts)
30 N=[12, 13, 34, 56, 21, 79, 98, 22,35, 38] 3
def PUSH(S,N):
S.append(N)
def POP(S):
if S!=[ ]:
return S.pop()
else:
return None
ST=[ ]
for k in N:
if k%2!=0:
PUSH(ST,k)
while True:
if ST!=[ ]:
print(POP(ST),end=" ")
else:
break
(2x1 mark for correct function body; 1 mark for function calling)
OR
(B) N= [2,5,10,13,20,23,45,56,60,78]
def PUSH(S,N):
S.append(N)
def POP(S):
if S!=[]:
return S.pop()
else:
return None
ST=[]
for k in N:
if k%5==0:
PUSH(ST,k)
while True:
if ST!=[]:
print(POP(ST),end=" ")
else:
break
(2x1 mark for correct function body; 1 mark for function calling)

31 2 4 3
65
OR
47.0
35.0
54.0
26.0
( 3 Mark for correct output, 1 mark for partial correct)

Q Section-D ( 4 x 4 = 16 Marks) Mark


32 i) Select ActivityName, Acode from ACTIVITY order by Acode desc; 4
ii) Select sum(PrizeMoney) from ACTIVITY group by ParticipantsNum;
iii) Select ScheduleDate, ParticipantsNum from ACTIVITY where
ActivityName = ‘Relay 100 x4’;
iv) Update ACTIVITY set PrizeMoney = PrizeMoney + 500 where
ActivityName = “High jump”;

(1 mark for each correct Query.)


OR
(i)
Count(distinct ParticipantsNum)

3
(ii)
Max(ScheduleDate) Min(ScheduleDate)

2004-03-19 2003-12-12
(iii)
Sum(PrizeMoney)

54000
(iv) delete from ACTIVITY where Acode = 1003;
(1 mark for each correct answer.)
Ans Ans: (a) 4
33 import csv
def AddNewRec(Country,Capital):
f=open("CAPITAL.CSV",'a')
fwriter=csv.writer(f,lineterminator="\n")
fwriter.writerow([Country,Capital])
f.close()
(b)
def ShowRec():
with open("CAPITAL.CSV","r") as NF:
NewReader=csv.reader(NF)
for rec in NewReader:
print(rec[0],rec[1])

AddNewRec(“FRANCE”,”PARIS”)
AddNewRec(“SRILANKA”,”COLOMBO”)
ShowRec()

Ans SQL Two table based question 4


34 (i) SELECT CNAME, PRICE FROM COMPANY, CUSTOMER WHERE
COMPANY.CID = CUSTOMER.CID AND PRICE < 30000;
(ii) SELECT CNAME, PRICE FROM COMPANY, CUSTOMER WHERE
COMPANY.CID = CUSTOMER.CID AND PRICE BETWEEN 20000 AND 35000;
(iii) UPDATE CUSTOMER SET PRICE = PRICE+1000 WHERE NAME LIKE “S%”;
(iv) SELECT PRODUCTNAME,CITY, PRICE FROM COMPANY,CUSTOMER
WHERE COMPANY.CID=CUSTOMER.CID AND PRODUCTNAME=”MOBILE”;
(1 mark for each correct query.)
Ans import mysql.connector as mysql 4
35 con1 = mysql.connect(host = “localhost”, user = “root”, password = “tiger”,
database = “sample”)
mycursor = con1.cursor( )
rno = int(input(“Enter Roll Number : “))
name = input(“Enter the name : “)
DOB = input(“Enter date of Birth : “)
fee = float(input(“Enter Fee : “
query = “INSERT into student values({ }, ‘{ }’, ‘{ }’ , { })”.format(rno,name,DOB,fee)
mycursor.execute(query)
con1.commit( )
print(“Data added successfully”)
con1.close( )
(½ mark for correctly importing the connector object)
(½ mark for correctly creating the connection object)
(½ mark for correctly creating the cursor object)
(½ mark for correctly inputting the data)
(1 mark for correct creation of query)
(½ mark for correctly executing the first query with commit
(½ mark for correctly displaying the data)

Q Section-E ( 2 x 5 = 10 Marks) Mark


Ans (I) import pickle 5
36 def input_candidates():
candidates = [ ]
n = int(input("Enter the number of candidates you want to add: "))
for i in range(n):
candidate_id = int(input("Enter Candidate ID: "))
candidate_name = input("Enter Candidate Name: ")
designation = input("Enter Designation: ")
experience = float(input("Enter Experience (in years): "))
candidates.append([candidate_id, candidate_name, designation,
experience])
return candidates
candidates_list = input_candidates()

def append_candidate_data(candidates):
with open('candidates.bin', 'ab') as file:
for candidate in candidates:
pickle.dump(candidate, file)
print("Candidate data appended successfully.")
append_candidate_data(candidates_list)

(II) import pickle


def update_senior_manager():
updated_candidates = [ ]
try:
with open('candidates.bin', 'rb') as file:
while True:
try:
candidate = pickle.load(file)
if candidate[3] > 10: # If experience > 10 years
candidate[2] = 'Senior Manager'
updated_candidates.append(candidate)
except EOFError:
break # End of file reached
except FileNotFoundError:
print("No candidate data found. Please add candidates first.")
return
with open('candidates.bin', 'wb') as file:
for candidate in updated_candidates:
pickle.dump(candidate, file)
print("Candidates updated to Senior Manager where applicable.")
update_senior_manager()

(III)
import pickle
def display_non_senior_managers():
try:
with open('candidates.bin', 'rb') as file:
while True:
try:
candidate = pickle.load(file)
if candidate[2] != 'Senior Manager': # Check if not Senior Manager
print(f"Candidate ID: {candidate[0]}")
print(f"Candidate Name: {candidate[1]}")
print(f"Designation: {candidate[2]}")
print(f"Experience: {candidate[3]}")
print("--------------------")
except EOFError:
break # End of file reached
except FileNotFoundError:
print("No candidate data found. Please add candidates first.")
display_non_senior_managers()

(1/2 mark of import pickle)


(1/2 mark for input)
(1/2 mark for opening file in append mode and 1/2 mark for using dump)
(1/2 mark for opening file in read mode and 1/2 mark for using load)
(1 mark for checking the condition and updating the value)
(1 mark for checking the condition and displaying data correctly)
(1 mark for try and except block)
37 Networking based question 5
(i) Server should be installed in Building 3 , As maximum computer is there
(ii) Hub/Switch installed in each and every building to connect computers in each
building.
(iii) Bus/ Star topology
(iv) No repeater is required as distance between building is less than 100 meter.
(v) Voip
OR
LAN (Local Area Network)

(1x5=5 mark for each correct answer)

You might also like