Kvs Pb i Cs 202425 Solutions
Kvs Pb i Cs 202425 Solutions
Kvs Pb i Cs 202425 Solutions
2 a) KENDRIYA-vidyalaya@Sangathan 1
(1 mark for correct answer)
3 (b) False 1
4 @aaa 1
5 (b) (1,2,[1,3.5],3) 1
6 c. True@False 1
(1 mark for correct answer)
7 a.0 1
9 True 1
10 b. del COLOR["Red"] 1
(1 mark for correct answer)
11 (c) file object 1
(1 mark for correct answer)
12 (iii) PYTHON#0#0 1
13 (b) describe 1
14 (c) Cardinality 1
16 Alter Table 1
17 a. PAN 1
18 (a) VoIP 1
19 Modem 1
(1 mark for correct answer)
20 a. Both A and R are true and R is the correct explanation for A. 1
SECTION-B (7 x 2 =14M)
if i%2==0:
s=s+I
m=m+i
else:
n=n+i
print(s,m,n) #indentation
Calc(15)
b. print(S.split())
OR
L1.insert(1,100)
L1.sort()
25 (a) 30 @ 2
MAX value of BEG and END are 2 and 4
(1 mark for each correct answer and 1 mark for maximum value)
26 Degree: The number of attributes or columns in a relation is called the Degree of 2
the relation.
Attribute: An attribute is a specification that defines a property of an object
(column / fields of a relation) Example: Any valid example to show degree and
attribute.
(2 mark for correct answer)
Or
Foreign Key: Foreign Key is a non-key attribute derived from primary key of
some other table. A table can have 0 or more foreign keys.
27 DELETE is used for deleting records from a table. DROP is used to delete the 2
entire schema of any database object like table.
Or
28 Star topology 2
In Star topology if the central hub fails then the whole network fails.
Bus Topology
In Bus topology each device in the network is connected to a single cable which
is known as the backbone
In Bus topology the failure of the network cable will cause the whole network to
fail.
Or
Basic structure of every web page is designed using HTML. HTML uses tags to
define the way page content should be displayed by the web browser. Web
pages are stored as .html or .htm files.
SECTION-C (3 x 3 = 9 M)
29 def display_lines(): 3
fin = open('Poetry.txt','r')
count=0
lst=fin.readlines()
if l[0]=='It':
count = count+1
print(count)
fin.close()
Or
while True:
text= fin.readline( )
if len(text) != 0:
if text[e] != "#":
fout.write(text)
fin.close()
fout.close()
Transfer("source.txt", "destination.txt")
for i in List:
if i[2]=="Delhi":
Record.append(i)
print(Record)
while True:
if len(Record)==0:
print('Empty Stack')
break
else:
print(Record.pop())
OR
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
def PushElement(S,N):
S.append(N)
def PopElement(S):
if S!=[ ]:
return S.pop()
else:
return None
ST=[]
for k in N:
if k%7==0:
PushElement(ST,k)
while True:
if ST!=[ ]:
print(PopElement(ST),end=" ")
else:
break
SECTION-D (4 x 4 = 16 M)
32 I. TypeError exception raised when an operation or function is applied to an
object of inappropriate type,
ii.def get_numeric_input(prompt):
while True:
try:
value = float(input(prompt))
return value
except ValueError:
except:
result = n1 * n2
OR
i.The raise keyword is used to manually raise an exception like exceptions are
raised by Python itself. That means, as a programmer can force an exception to
occur through raise keyword. It can also pass a custom message to your
exception handling module.
if b == 0:
print(a/b)
except ZeroDivisionError:
COUNTROW()
iv. Select avg(Rate) from garment where rate between 1200 and 2000;
35 def ChecknDisplay():
mydb=mycon.connect(host="localhost",user="root",
passwd="school123",database="COMPANY")
mycur=mydb.cursor()
query=query.format(eid,nm,s,dept)
mycur.execute(query)
mydb.commit()
print(rec)
SECTION-E (2 x 5 = 10 M)
36 i.Binary file: 5
Extension is .dat
Not human readable
Stores data in the form of 0s and 1s
CSV file
Extension is .csv
Human readable
Stores data like a text file
(1 mark for correct answer)
ii.import pickle
def AddStudents():
F= open("STUDENT.DAT",'wb') #1 statement to open the binary file to write
data
while True:
Rno = int(input("Rno :"))
Name = input("Name : ")
Percent = float(input("Percent :"))
L = [Rno, Name, Percent]
c. pickle.dump(L,F)
Choice = input("enter more (y/n): ")
if Choice in "nN":
break
F.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly inputting the data)
(½ mark for correctly writing the record in the file)
(½ mark for correctly closing the file, or ½ mark if the file was opened using
with)
def GetStudents():
Total=0
Countrec=0
Countabove75=0
with open("STUDENT.DAT","rb") as F:
while True:
try:
R = pickle.load(F)
Countrec+=1
Total+=R[2]
if R[2] > 75:
print(R[1], " has percent =",R[2])
Countabove75+=1
except:
break
if Countabove75==0:
F.close()
37 a. Most suitable place to install the server is HR center, as this center has 5
maximum number of computers.
b.
.
c. Switch
d. Repeater may be placed when the distance between 2 buildings is more than
70 meter.
e. WAN, as the given distance is more than the range of LAN and MAN.
Page: 1/11
14. (C) Details of all students whose name contains ' Singh '
(1)
(1 mark for correct answer)
15. (D) CHAR
(1)
(1 mark for correct answer)
16. (A) total()
(1)
(1 mark for correct answer)
17. (C) VoIP
(1)
(1 mark for correct answer)
18. (A) Modem
(1)
(1 mark for correct answer)
19. Circuit Switching
(1)
(1 mark for correct answer)
20. (C) A is True but R is False.
(1)
(1 mark for correct answer)
21. (C) A is True but R is False.
(1)
(1 mark for correct answer)
Page: 2/11
(II)
A) L1.extend(L2)
OR
B) L2.clear()
(1 mark for correct answer)
25. (A), (B) and (C)
(1 Mark)
(2)
Minimum and maximum possible values of the variable b: 1,6
(½ x 2 = 1 Mark)
26.
(2)
27. (I)
A) CHECK
OR
B) PRIMARY KEY
(1 mark for correct answer)
(2)
(II)
A) ALTER TABLE STUDENT DROP PRIMARY KEY;
OR
B) ALTER TABLE STUDENT ADD PRIMARY KEY (S_ID);
(1 mark for correct answer)
28. A)
(1 mark for correct Advantage)
(1 mark for correct Disadvantage)
(2)
OR
Page: 3/11
B) HTTPS: Hyper Text Transfer Protocol Secure.
def show():
f=open("story.txt",'r')
data=f.read()
words=data.split()
for word in words:
if '@gmail' in word:
print(word,end=' ')
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)
(1 mark for correctly displaying the desired words) (3)
OR
(B)
def display_long_words():
with open("story.txt", 'r') as file:
data=file.read()
words=data.split()
for word in words:
if len(word)==5:
print(word,end=' ')
(½ 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)
(1 mark for correctly displaying the desired words)
Page: 4/11
30. (A)
(I)
def push_book(Books, new_book):
Books.append(new_book)
(II)
def pop_book(Books): if not
BooksStack:
print("Underflow")
else:
return(Books.pop())
(III)
def peep(Books): if not
Books: print("None")
else:
print(Books [-1])
(3x1 mark for correct function body; No marks for any function header as it
was a part of the question)
OR
(B)
(3)
Page: 5/11
31. (A) ND-*34
OR
(3)
(B) 1 @2 @3 @
1 @2 @
1@
(4)
(B) 4 x 1 mark for each correct answer
Page: 6/11
33. (I)
def show():
import csv
f=open("country.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
for i in records:
if int(i[1])>5000000:
print(i)
f.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records) (4)
(II)
def Count_records():
import csv
f=open("country.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
count=0
for i in records:
count+=1
print(count)
f.close()
Page: 7/11
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correct use of counter)
(½ mark for correctly displaying the counter)
Note (for both parts (I) and (II)):
(i) Ignore import csv as it may be considered the part of the
complete program, and there is no need to import it in individual
functions.
(ii) Ignore next(records, None) as the file may or may not have the
Header Row.
34. (I) Select * from FACULTY natural join COURSES where Salary<12000;
Or
Select * from FACULTY, COURSES where Salary<12000 and
facuty.f_id=courses.f_id;
(II) Select * from courses where fees between 20000 and 50000;
(III) Update courses set fees=fees+500 where CName like
'%Computer%';
(IV)
(A) Select FName, LName from faculty natural join courses where
Came="System Design"; (4)
Or
Select FName, LName from faculty, courses where Came="System
Design" and facuty.f_id=courses.f_id;
OR
Page: 8/11
(½ 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)
(½ mark for correct creation of first query)
(½ mark for correctly executing the first query with commit)
(½ mark for correctly executing the second query)
(½ mark for correctly displaying the data)
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:
Page: 9/11
break # End of file reached
except FileNotFoundError:
print("No candidate data found. Please add candidates first.")
return
(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()
(III)
Page: 10/11
(or Any other correct layout)
Cable: Coaxial cable
(½ mark for correct layout + ½ mark for correct table type)
(IV) There is no requirement of the Repeat as the optical fibre cable used for
the network can carry the data to much longer distances than within the
campus.
(1 mark for correct answer)
Page: 11/11
KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION
CLASS: XII SESSION: 2024-25
PREBOARD I MARKING SCHEME
COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70
27 (I) 2
(A) UNIQUE ,NOT NULL
OR
(B) NOT NULL (PRIMARY KEY CAN BE GIVEN MARK)
(II)
(A) ALTER TABLE flight ADD PRIMARY KEY(F_id);
OR
(B) ALTER TABLE CUSTOMER DROP REMARKS;
28 STAR Adv DisAdv ½ mark each 2
BUS Adv DisAdv ½ mark each
OR
DNS definition 1 mark, IP purpose 1 mark
LOGISTICS
ACCTS
ADMIN
HR
(b)
33 (I) 4
def show():
import csv
f=open("Employee.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
for i in records :
if int(i[2])>50000:
print(i)
f.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records)
(II)
import csv
def Count_records():
f=open("Employee.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
count=0
for i in records:
count+=1
print(count)
f.close()
34 (a) 4
(i)Select w_id,firstname,address,city from from workers where city=”newyork”;
(ii)select *from workers order by lastname;
(iii)select firstname,lastname,salary+benefits as “total_salary”from workers,desig where
workers.w_id=desig.w_id and designation=”clerk”;
(iv)select min(salary)from desig group by desig having designation=”managers” or
designation=”clerk”;
(b)
OUTPUT OF NATURAL JOIN
4
import mysql.connector as mycon
def BOOK_ADD_DISP();
mydb=mycon.connect(host="localhost",user="root", passwd="",database="booktore")
mycur=mydb.cursor()
35 no=int(input("Enter Book id: "))
nm=input("Enter Book Name: ")
pr=float(input("Enter Book price: "))
qty=int(input("Enter qty: "))
query="INSERT INTO bookdetails VALUES ({},'{}',{},{})"
query=query.format(no,nm,pr,qty)
mycur.execute(query)
mydb.commit()
mycur.execute("select * from bookdetails where price>450")
for I in mycur:
print(I)
(III)
1
What changes will be made in t after the execution of the following statement?
t.append(4)
(a) t=(12,13,14,16,[2,3],4) (b) t= (12,13,14,16,[2,3,4])
(c) t=(4,12,13,14,16,12,3) (d) It will give an error
(d) It will give an error
7 What will be the output? 1
test = {1:'A', 2:'B', 3:'C'}
del test[1]
test[1] = 'D'
del test[2]
print(len(test))
(a) 0 (b) 1 (c) 2 (d) Error
8 Predict the output of following code snippet: 1
Lst = [10,20,30,40,50,60,70,80,90]
print(Lst[::3])
(iii) Alter
10 Which of the following options is the correct Python statement to read and display 1
the first 10 characters of a text file “poem.txt” ?
(a) F=open(‘poem.txt’) print(F.load(10))
(b) F=open(‘poem.txt’) print(F.reader(10))
(c) F=open(‘poem.txt’) print(F.read(10))
(d) F=open(‘poem.txt’,) print(F.readline(10))
(c) F = open('poem.txt') print(F.read(10))
11 When will the else part of try-except-else be executed? 1
a) always b) when an exception occurs
c) when no exception occurs d) when an exception occurs in to except block
c) when no exception occurs
12 Find and write the output of following python code: 1
a=100
def show():
global a
a=-80 def
invoke(x=5):
global a
a=50+x
show()
invoke(2)
2
invoke()
print(a)
55
13 Fill in the blank: __________command is used for changing value of a column in a 1
table in SQL.
(a) update (b) remove (c) alter (d) drop
(a) update
14 What will be the output of the query? 1
SELECT * FROM products WHERE product_name LIKE 'BABY%';
(a) Details of all products whose names start with 'BABY'
(b) Details of all products whose names end with 'BABY'
(c)Names of all products whose names start with 'BABY'
(d)Names of all products whose names end with 'BABY'
15 To fetch the multiple records from the result set you may use-- method in SQL? 1
a) fetch() b) fetchmany() c) fetchmultiple () d) None of the mentioned
b) fetchmany()
16 Which function is used to display the total no of records from a table in a database? 1
(a) total() (b) total(*) (c) count(*) (d) count()
(c) count(*)
17 Fill in the blank: is a communication medium, classified as long-distance high speed 1
unguided medium.
(a) Optical fiber (b) Microwave (c) Satellite Link (d)WIMAX
(c) Satellite Link
3
read and written without the need the data conversion
(B) Both A and R are true and R is not the correct explanation for A.
Q No Section-B ( 7 x 2=14 Marks) Marks
22 How are list different from dictionaries. Write two points. 2
Access Method: Lists use indices; dictionaries use keys.
Purpose: Lists store ordered collections; dictionaries store data as key-value
pairs for efficient retrieval.
23 Give two examples of each of the following: 2
(I) Membership operators (II) Identity operators
Membership Operators-in , not in
Identity operators-is, is not
25 What possible outputs are expected to be displayed on screen at the time of execution 2
of the program from the following code? Select correct options from below.
import random arr=['10','30','40','50','70','90','100']
L=random.randrange(1,3)
U=random.randrange(3,6)
for i in range(L,U+1):
print(arr[i],"$",end="@")
a)30 $@40 $@50 $@70 $@90
b)30 $@40 $@50 $@70 $@90 $@
c) 30 $@40 $@70 $@90 $@
d) 40 $@50 $@
b,d
26 2
Sona has written the following code to check whether the number is divisible by3.
4
She could not run the code successfully. Rewrite the code and underline each
correction done in the code.
x=10
for i range in (a):
if i%3=0:
print(i)
else: pass
x = 10
for i **in** range(x):
if i % 3 **==** 0:
print(i)
else:
pass
27 (I) A) Differentiate ORDER BY and GROUP BY with an example. 2
The ORDER BY clause is used to sort the result set (the rows returned by a
query) in either ascending (ASC) or descending (DESC) order based on one or
more columns.
The GROUP BY clause is used to group rows that have the same values in
specified columns. It is typically used with aggregate functions like COUNT(),
SUM(), AVG(), etc., to perform operations on each group of rows.
OR
B) Classify the following statements into DDL and DML a)delete b)drop table
c)update d)create table
DDL Commands: DROP TABLE, CREATE TABLE (altering the structure of
database objects).
DML Commands: DELETE, UPDATE (modifying the data within tables)
(II)
A) What do you understand by VARCHAR datatype in a table? Give a suitable
example and differentiate the same with the data type CHAR.
VARCHAR is more flexible and space-efficient for variable-length data, while
CHAR is best suited for fixed-length data where space usage consistency is
important.
OR
B) Categorize the following commands as Group by /Math function: count(),
pow(), round(), avg()
Group by Functions: COUNT(), AVG()
Math Functions: POW(), ROUND()
5
28 A) Expand the following terms: i)MAN ii)HTML 2
MAN: Metropolitan Area Network
HTML: HyperText Markup Language
OR
B) What is URL ?
A URL (Uniform Resource Locator) is the address used to access resources on
the internet. It specifies the location of a web resource (like a webpage, an image,
or a file) and the method to retrieve it. URLs are used by browsers to find and
display the requested resources.
Q No. Section-C ( 3 x 3 = 9 Marks) Marks
29 A) Write a function linecount() in python which read a file ‘data.txt’ and count 3
number of lines starts with character ‘P’.
def linecount():
count = 0
open('data.txt', 'r')
for line in file:
if line.startswith('P'):
count += 1
return count
OR
B) Write a function in python to count number of words ending with ‘n present in a
text file “ABC.txt” If ABC.txt contains “A story of a rich man And his son”, the
output of the function should be Count of words ending with ‘n’ is 2
def count_words_ending_with_n(file_name):
# Open the file in read mode
with open(file_name, 'r') as file:
content = file.read() # Read the content of the file
# Split the content into words
words = content.split()
# Count words that end with 'n' (case insensitive)
count=0
for word in words
if word.lower().endswith('n'))
count=count+1
print(f"Count of words ending with 'n' is “,count)
30 A) A list, items contain the following record as list elements [itemno, itemname, 3
stock]. Each of these records are nested to form a nested list.
Write the following user defined functions to perform the following on a stack
reorder .
i. Push(items)- it takes the nested list as its argument and pushes a list object
containing itemno and itemname where stock is less than 10
6
ii. Popitems() -It pops the objects one by one from the stack reorder and also
displays a message ‘Stack empty’ at the end.
items=[[101,'abc',8],[102,'gg',12],[103,'tt',5],[104,'yy',15]]
reorder=[]
def Push(items):
for i in items:
if i[2]<10:
reorder.append([i[0],i[1]])
Push(items)
reorder [[101, 'abc'], [103, 'tt']]
def Popitems():
while len(reorder):
print(reorder.pop())
else:
print("Stack empty")
Popitems()
OR
(B) Write a function RShift(Arr) in Python, which accepts a list Arr of numbers and
places all even elements of the list shifted to left.
Sample Input Data of the list Arr= [10,21,30,45,12,11],
Output Arr = [10, 30, 12, 21, 45, 11]
def RShift(Arr):
# Separate even and odd elements
even_elements = [num for num in Arr if num % 2 == 0]
odd_elements = [num for num in Arr if num % 2 != 0]
# Combine even elements followed by odd elements
Arr[:] = even_elements + odd_elements
return Arr
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2)
15@
7@
7
9@
OR
2,2,0,1,2,
8
WHERE Gender = 'Male';
OR
B) Write the output
(I) Select city, sum(basicsalary) as Salary from EMPLOYEE group by city;
city Salary
------------------------------------
Udhamwara 92000
Kupwara Nagar 75000
Bhawani 45000
Ahmed Nagar 50000
Nagar Coolangetta 33000
NewDelhi 40000
max(basicsalary)
----------------------
75000
33 A csv file "furdata.csv" contains the details of furniture. Each record of the file 4
contains the following data:
● Furniture id
● Name of the furniture
● Price of furniture
For example, a sample record of the file may be:
[‘T2340’, ‘Table’, 25000]
Write the following Python functions to perform the specified operations on this
9
file:
a. add() – To accept and add data of a furniture to a CSV file furdata.csv. Each
record consists of a list with field elements as fid, fname, fprice to store furniture
id, furniture name and furniture price respectively
b. search() – To display the records of the furniture whose price is more than
10000.
import csv
# Function to add furniture data to the CSV file
def add():
with open('furdata.csv', 'a', newline='') as file:
writer = csv.writer(file)
fid = input("Enter Furniture ID: ")
fname = input("Enter Furniture Name: ")
fprice = float(input("Enter Furniture Price: "))
record = [fid, fname, fprice]
writer.writerow(record)
print("Furniture record added successfully!")
# Function to search and display furniture with price more than 10000
def search():
with open('furdata.csv', 'r') as file:
reader = csv.reader(file)
34 Write the output of the SQL commands for (i) to (iv) on the basis of 4
tables BOOKS and ISSUES.
Table: BOOKS
Book_id BookName AuthorName Publisher Price Qty
10
L05 Telugu Nannayya DEF 60 25
L02 13
L04 5
L05 21
(I) To display complete details (from both the tables) of those Books whose quantity
issued is more than 5.
Select * from BOOKS, ISSUES where Qty>5 and
BOOKS.Book_id=ISSUES.Book_id;
(II) To display the details of books whose quantity is in the range of 20 to 50 (both
values included).
Select * from BOOKS where Qty between 20 and 50;
(III) To increase the price of all books by 50 which have "DEF” in their PUBLISHER
names.
Update BOOKS set Price=Price+50 where Publisher like '%DEF%';
(IV) (A) To display names (BookName and AuthorName) of all books.
Select BookName, AuthorName from BOOKS;
OR
(B) To display the Cartesian Product of these two tables.
Select * from BOOKS, ISSUES;
35 A table, named STUDENT, in SCHOOL database, has the following structure: 4
Field Type
Rollno integer
Name string
Clas integer
Mark integer
11
import mysql.connector
def AddStudent():
mydb = mysql.connector.connect(host="localhost",user="root",
password="root",database="SCHOOL")
cursor = mydb.cursor()
rollno = int(input("Enter Roll No: "))
name = input("Enter Name: ")
clas = int(input("Enter Class: "))
mark = int(input("Enter Mark: "))
query = "INSERT INTO STUDENT (Rollno, Name, Clas, Mark) VALUES
(%s, %s, %s, %s)"
values = (rollno, name, clas, mark)
cursor.execute(query, values)
mydb.commit()
print("Student record added successfully!")
# Retrieve and display all records where Mark is greater than 80
cursor.execute("SELECT * FROM STUDENT WHERE Mark > 80")
results = cursor.fetchall()
# Display the results
if results:
print("\nStudents with marks greater than 80:")
for row in results:
print(f"Rollno: {row[0]}, Name: {row[1]}, Class: {row[2]}, Mark:
{row[3]}")
else:
print("No students found with marks greater than 80.")
12
book_name = input("Enter Book Name: ")
author = input("Enter Author Name: ")
price = float(input("Enter Price: "))
book_record = [book_no, book_name, author, price]
pickle.dump(book_record, file)
cont = input("Do you want to add another record? (yes/no): ").lower()
if cont != 'yes':
break
37 Vidya for all is an NGO. It is setting up its new campus at Jaipur for its web-based 5
activities. The campus has four buildings as shown in the diagram below
13
Resource building to Training building 125m
Resource building 25
Training building 10
Main Finance
Resource Training
14
*************************************
15
केन्द्रीय विद्यालय सं गठन, कोलकाता सं भाग
KENDRIYA VIDYALAYA SANGATHAN, KOLKATA REGION
प्रथम प्री-बोर्ड परीक्षा / 1st PRE-BOARD EXAMINATION- 2024-25
कक्षा /CLASS- XII अविकतम अं क /MAX MARKS- 70
विषय /SUB- Computer Science (083) समय /TIME- 03 घं टे / Hours
MARKING SCHEME
Q No. SECTION A (21X1=21) Marks
1. True (1 mark for correct answer) (1)
2. (D) copy#THON (1 mark for correct answer) (1)
3. ( C) 5.0 (1 mark for correct answer) (1)
4. (B) ['', 'nsp', 'rat', 'onal ', 'dea'] (1 mark for correct answer) (1)
5. (A) Aabtsi (1 mark for correct answer) (1)
6. (B) False (1 mark for correct answer) (1)
7. (B) print(my_dict['apple', 'banana']) (1 mark for correct answer) (1)
8. (A) cursor.rowcount (1 mark for correct answer) (1)
9. (C) 3 (1 mark for correct answer) (1)
21. (C) A is True but R is False. (1 mark for correct answer) (1)
½ marks for each correction (Corrections are marked bold and underlined)
Page: 2/10
27. (I)
A) UNIQUE
OR
B) NOT NULL
(1 mark for correct answer) (2)
(II)
A) ALTER TABLE MOBILE DROP PRIMARY KEY;
OR
B) ALTER TABLE MOBILE ADD PRIMARY KEY (M_ID);
(1 mark for correct answer)
28. (2)
Any correct difference. (1 mark for each correct difference)
OR
B) TCP/IP: Transmission Control Protocol / Internet Protocol
(1 mark for correct expansion)
A Gateway serves as a point of entry and exit for network traffic between two
networks and can provide security like a firewall from any attack on the network.
Page: 3/10
Q No. SECTION C (3 X 3 = 9) Marks
29. (A)
def show():
f=open("Email.txt",'r')
data=f.read()
words=data.split() for
word in words:
if '@gov' in word:
print(word,end=' ')
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)
(1 mark for correctly displaying the desired words)
OR (3)
(B)
def display_long_words():
with open("Friends.txt", 'r') as file:
data=file.read()
words=data.split()
for word in words:
if len(word)<6:
print(word,end=' ')
(½ 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)
(1 mark for correctly displaying the desired words)
Page: 4/10
(III)
def peep(BooksStack):if
not BooksStack:
print("None")
else:
print(BookStack[-1])
(3x1 mark for correct function body; No marks for any function header as itwas a
part of the question)
OR
(B)
def Push_Bright(StudRec):
admno=StudRec.keys()
tot=0
for k in admno:
tot=sum(StudRec[k])
if tot>350:
BRIGHT.append({k:tot})
print(BRIGHT)
return
def Pop_Bright():
if BRIGHT==[]:
print("Stack is Empty")
for k in range(len(BRIGHT)-1, -1, -1):
print(BRIGHT.pop())
"""
else:
print("Stack is Empty")
"""
return
#__main___
StudRec={101:[80,90,80,70,90], 102:[50,60,45,50,40], 103:[90,90,99,98,90]}
BRIGHT=[]
Push_Bright(StudRec)
Pop_Bright()
Page: 5/10
31. (A) 15@
7@
9
OR
(B) 1 #2 # 3# (3)
1 #2 #3 #
1#
(II)
(IV)
MAX(Price)
12000
(4 x 1 mark for each correct output)
Page: 6/10
33. import csv
def AcceptStock():
(4)
fob=open("stock.csv",'a',newline='')
wob=csv.writer(fob)
headings=["Stock No.", "Name of the Stock", "Stock Price", "Quantity"]
wob.writerow(headings)
ch='y'
while ch.upper()=='Y':
stockno=int(input("Enter the Stock No. "))
sname=input("Enter the stock name: ")
price=float(input("Enter the stock price: "))
qty=int(input("Enter the stock quantity: "))
data=[stockno,sname,price,qty]
wob.writerow(data)
ch=input("Have you any more records to enter(y/n): ")
fob.close()
return
def StockReport():
fob=open('stock.csv','r')
rob=csv.reader(fob,delimiter=',')
data=list(rob)
print(data[0]) # to be used as header
Page: 7/10
mark for correct use of counter)
(½ mark for correctly displaying the counter)
Note (for both parts (I) and (II)):
(i) Ignore import csv as it may be considered the part of the complete program,
and there is no need to import it in individualfunctions.
(ii) Ignore next(records, None) as the file may or may not have the Header Row.
34. (i) SELECT SNAME, QTY, PRICE, STOCK.TCODE, TNAME FROM STOCK NATURAL JOIN
TRADERS ;
(or any alternative query)
(ii) SELECT * FROM STOCK WHERE PRICE BETWEEN 35000 AND 50000;
(iii) SELECT SCODE, SNAME, QTY*PRICE as ‘TOTAL PRICE’ FROM STOCK
WHERE BRAND=’NEC’ OR BRAND=’HP’ ORDER BY QTY*PRICE ASC;
(iv) SELECT STOCK.TCODE, TNAME, CITY, SUM(QTY) FROM STOCK JOIN TRADERS
ON STOCK.TCODE=TRADERS.TCODE GROUP BY TCODE; (4)
(1 mark for each correct query. ½ mark if the query is right partially)
(½ 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) (½ mark for correct creation of first query)
(½ mark for correctly executing the first query with commit)(½ mark for correctly
executing the second query)
(½ mark for correctly displaying the data)
Page: 8/10
Q No. SECTION E (2 X 5 = 10) Marks
36. (a) Any one point of difference (1 mark for the difference) (5)
import pickle
def AddStudents():
F= open("STUDENT.DAT",'wb')
while True:
Rno = int(input("Rno :"))
Name = input("Name : ")
Percent = float(input("Percent :"))
L = [Rno, Name, Percent]
pickle.dump(L,F)
Choice = input("enter more (y/n): ")
if Choice in "nN":
break
F.close()
def GetStudents():
Total=0
Countrec=0
Countabove75=0
with open("STUDENT.DAT","rb") as F:
while True:
try:
R = pickle.load(F)
Countrec+=1
Total+=R[2]
if R[2] > 75:
print(R[1], " has percent =",R[2])
Countabove75+=1
except:
if Countabove75==0:
print("No student has percentage more than 75")
print("average percent of class = ", Total / Countabove75)
AddStudents()
GetStudents()
Page: 9/10
37. i) Development because it contains more number of computers (
ii) Surajpur centre has multiple blocks and firewall ensures security. So it is required. 5
It allows or block unwanted attacks. )
Firewall prevents unauthorized access to or from a private network. (Any correct answer)
iii)
iv) a) Switch/Hub – In every block to interconnect the devices within every block
b) Router -In development block because server is going to be placed here
v) (A) Satellite
OR
(B) LAN
Page: 10/10