12 CS PreBoard SET QPMS 2024-25
12 CS PreBoard SET QPMS 2024-25
ु म ांक/ROLL NO सेट/SET : 01
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
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.
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
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.
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.
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.
31 2 4 3
65
OR
47.0
35.0
54.0
26.0
( 3 Mark for correct output, 1 mark for partial correct)
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()
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)
(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()