XII 1st PRE BOARD QP Withsolution 2023
XII 1st PRE BOARD QP Withsolution 2023
XII 1st PRE BOARD QP Withsolution 2023
70
General Instructions:
(i) All questions are compulsory.
(ii) This Paper contains five sections, Section A to E.
(iii) Section A has 18 questions carrying 01 marks each.
(iv) Section B has 07 questions carrying 02 marks each.
(v) Section B has 07 questions carrying 02 marks each.
(vi) Section C has 05 questions carrying 03 marks each.
(vii) Section D has 03 questions carrying 05 marks each.
(viii) Section E has 02 questions carrying 04 marks each.
(viii) All Questions are to be answered using Python Language only.
SECTION - A
1. State True or False
“Variable declaration is implicit in Python.”
2. Which of the following is an invalid data type in Python?
(a) Set (b) None (c)Integer (d)Real
3. Given the following dictionaries:-
dict_exam={“Exam”:”AISSCE”, “Year”:2023}
dict_result={“Total”:500, “Pass_Marks”:165}
Which statement will merge the contents of both dictionaries?
i) dict_exam.update(dict_result)
ii) dict_exam + dict_result
iii) dict_exam.add(dict_result)
iv) dict_exam.merge(dict_result)
4. Consider the given expression: not True and False or True
Which of the following will be correct output if the given expression is evaluated :
(a)True (b)False (c)NONE (d)NULL
a) List the names of those students who obtained DIV 1 sorted by NAME .
b) Display a report, listing NAME , STIPEND , SUBJCT and amount of stipend
received in a year assuming that the STIPEND is paid every month.
c) Give the output of the following SQL statements based on table GRADUATE :
(i) Select MIN(AVERAGE ) from GRADUATE where SUBJECT= “PHYSICS”;
(ii)Select SUM(STIPEND) from GRADUATE where DIV=1;
30. A) Write a function countmy() in Python to read the text file "DATA.TXT" and count the
number of times "my" occurs in the file. For example, if the file "DATA.TXT" contains
"This is my website. I have displayed my preferences in the CHOICE section." - the
countmy() function should display the output as: "my occurs 2 times"
Or
Write a method/function DISPLAYWORDS() in python to read lines from a text file
STORY.TXT, and display those words, which are less than 4 characters
SECTION – D
31. Young Minds Ltd. is an educational organization. It is planning to setup its India campus at
Chennai with its head office at Delhi. The Chennai campus has 4 main buildings – ADMIN,
ENGINEERING, BUSINESS and MEDIA. You as a network expert have to suggest the best
network related solutions for their problems raised in (i) to (v), keeping in mind the
distances between the buildings and other given parameters.
ADMIN to BUSINESS 90 m
ADMIN to MEDIA 50 m
ENGINEERING to BUSINESS 55 m
ENGINEERING to MEDIA 50 m
BUSINESS to MEDIA 45 m
DELHI Head Office to CHENNAI Campus 2175 km
import # Line 1
AddStudents(“Raghava”, “2541”)
AddStudents (“Pooja”,”3411”)
AddStudents(“Krutika”,”2218”)
Retrievestudents () #Line 5
----------******----------
Answer to the Above Question Paper
SECTION A
1. True
2. d) real
3. i) dict_exam.update(dict_result)
4. a) True
5. i) Year.0.at All the best
6. b) r+
7. c) alter
8. b) DROP TABLE
9. b) statement 4
10. ii) Foreign key
11. (a) file_object.seek(offset [, reference_point])
12. iii) DISTINCT
13. a) VoIP
14. c) [1,3,2,1,3,2]
15. b) csv.writer(file)
16. b) database
17. c)
18. a)
Section B
19 a) 27 b) False 2
20 a) Post Office Protocol b)Transmission Control 2
Protocol/InternetProtocol c) World Wide Web
d) Hypertext Transfer Protocol Secure
21 Candidate Key: The columns which can serve as primary key of a 2
tableis known as candidate keys. There can be multiple candidate
for a relation.
Primary Key: Primary key is a field name which identifies rows
uniquely. There can be only one primary key for a relation.
22 1 2
2
3
3
Sum=9
23 ALTER Command is used to add, delete, modify the attributes of the 2
relations (tables) in the database. UPDATE Command is used to
updateexisting records in a database.
24 i)Cyber stalking ii)Phishing 2
25 a) GCODE, GNAME, b) Degree=5 & Cardinality=6 2
26 def 3
push(stk,item):
stk.append(item
)
def
Pop(stk):
if stk==[]:
return
Noneelse:
return
stk.pop()stk=[]
d={"Ramesh":58, "Umesh":78, "Vishal":90, "Khushi":60,
"Ishika":95}for i in d:
if d[i]>70:
push(stk,i
)
while
True: if
stk!=[]:
print(Pop(stk),end="
)else:
break
I) WORKER_ID
27 3
II) alter table worker modify FIRST_NAME varchar(20);
lll)DELETE FROM WORKER;
28. a) csv 3
.b) reader
.c) remove
29 A. List the names of those students who obtained DIV 1 sorted 2+1
byNAME .
Ans.: SELECT name FROM graduate WHERE div=1 ORDER BY
name; (b )Display a report, listing NAME , STIPEND , SUBJCT and
amount ofstipend received in a year
assuming that the STIPEND is paid every month.
Ans.: SELECT name, stipend, subject, stipend *12 FROM graduate;
(C) Give the output of the following SQL statements based on
tableGRADUATE :
(i) Select MIN(AVERAGE ) from GRADUATE where
SUBJECT=”PHYSICS”;Ans. MIN(AVERAGE)
63
(ii) Select SUM(STIPEND) from GRADUATE where
DIV=1;Ans.: SUM(STIPEND)
1000
30 A) 3
def countmy ():
f = open("DATA.txt", "r")
count = 0
x = f.read()
word =
x.split()for i in
word :
if (i == "my") :
count = count + 1
print ("my occurs", count,
"times")
A. close()
Or
ii) )
def DISPLAYWORDS() :
file = open("story.txt",
"r")lst = file.readlines()
for i in lst :
word =
i.split()for j in
word :
if len( j ) < 4
:print( j )
file.close()
print("Word with length smaller than 3 :-
\n")DISPLAYWORDS()
SECTION -D
(i) Most suitable place to install the server is ADMIN, as this building
31 hasmaximum number of computers. 5
(ii) Topology: STAR
Cable layout:
(iii) Repeater
(iv) Satellite Link
(v) (c) Video Conferencing
32 (i) Select Cname, Charges from Car where Colour=’silver’; 5
(ii) Select distinct Ccode from customer;
(iii) Select min(Charges), max(Charges) from Car;
(iv) Update Car set Charges=Charges - Charges*0.1 from Car R,
Customer Cwhere R.Ccode=C.Ccode;
(v) Select Cname, Make from Car where Charges between 2000 and 3000;
33 import pickle 5
def
AddVahan():
f1= open(“vehicle.dat”, “ab”)
RegNo = input(“Enter the vehicle registration number: “)
Type = input(“Enter the vehicle type: “)
Make = input(“Enter the manufacturer name: “)
Year = int(input(“Enter the year of manufacturing:
"))rec = [RegNo, Type, Make, Year]
pickle.dump(rec,
f1)f1.close()
def CountVahan(Type):
f1 = open(“vehicle.dat”,
“rb”)count = 0
try:
while True:
rec =
pickle.load(f1)if
Type == rec[1]:
count = count +
1except:
f1.close()
return
count
OR
import pickle
def ShowPlayer():
f1 = open(“player.dat”,
“rb”)count = 0
try:
while True:
rec= pickle.load(f1)
if rec[3] >50 and rec[2] == “India”:
print(rec [0], rec [1], rec [2], rec [3],sep=”\t”)
count
+=1except:
f1.close()
print(“Number of Indian players with strike rate more than 50=”, count)
SECTION E
34 (a) BookNo 4
(b) Degree=4 Cardinality =7
(c) UPDATE collections SET quantity = quantity + 20 WHERE quantity < 50;
(d) DELETE FROM Collections;
35 (a) Line 1 :import csv 4
(b) Line 2 :f=open('students.csv','a')
(c) Line 3 :readerObj=csv.reader(fobj)
(d) Line 4: Not mandatory, as we have opened the file using “with”
operator, itcloses automatically.