Class 12 Computer Science 083 Sample Practice Paper Set-1 with Marking Scheme
SAMPLE PRACTICE PAPER – SET 1
CLASS XII – COMPUTER SCIENCE (SUBJECT CODE: 083)
CBSE Board Examination 2027 (Academic Session 2026–27)
| Time Allowed: 3 Hours | Maximum Marks: 70 |
General Instructions:
(i) This question paper contains 37 questions.
(ii) All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions.
(iii) The paper is divided into 5 Sections – A, B, C, D and E.
(iv) Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
(v) Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
(vi) Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
(vii) Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
(viii) Section E consists of 2 questions (36 and 37). Each question carries 5 Marks.
(ix) All programming questions are to be answered using Python Language only.
(x) In case of MCQs, text of the correct answer should also be written.
| SECTION – A (21 × 1 = 21 Marks) |
Q1. Which of the following is a reserved keyword in Python? [1]
(A) define
(B) pass
(C) include
(D) switch
Q2. State True or False:
In Python, the augmented assignment expression x *= 2 + 3 is equivalent to x = x * 2 + 3. [1]
Q3. Predict the output of the following Python snippet: [1]
text = “algorithm2027”
print(text.isalnum(), text.isalpha())
(A) True True
(B) False False
(C) True False
(D) False True
Q4. What will be printed when the following Python statement executes? [1]
print(2 ** 3 ** 2 // 64 + 9 % 4)
(A) 9
(B) 2
(C) 9.0
(D) 1
Q5. Identify the output of the following Python code: [1]
seq = [100, 200, 300, 400]
val = seq.pop(1)
seq.append(val)
print(seq)
(A) [200, 300, 400, 100]
(B) [100, 300, 400]
(C) [100, 200, 400, 300]
(D) [100, 300, 400, 200]
Q6. What will be the output of the following Python code? [1]
profile = {“Name”: “Kabir”, “City”: “Pune”}
print(profile.setdefault(“Role”, “Analyst”), len(profile))
(A) None 2
(B) Analyst 3
(C) KeyError
(D) Analyst 2
Q7. Which function from Python’s statistics module returns the most frequently occurring value in a dataset? [1]
(A) mean()
(B) median()
(C) mode()
(D) freq()
Q8. What possible output is expected to be displayed when the following Python program runs? [1]
import random
codes = [“X10”, “Y20”, “Z30”, “W40”]
a = random.randint(1, 2)
b = random.randrange(0, 1)
print(codes[a] + “-” + codes[b])
(A) Z30-X10
(B) X10-Y20
(C) Y20-Z30
(D) W40-X10
Q9. Predict the output of the following Python code: [1]
def power_val(base, exp=3):
return base ** exp
print(power_val(2) + power_val(3, 2))
(A) 15
(B) 14
(C) 18
(D) 17
Q10. In Python file handling, which file mode opens a text file for appending and reading, creating a new file if it does not exist, with the file pointer positioned at the end? [1]
(A) r+
(B) a+
(C) w+
(D) rb+
Q11. Which method of a csv.writer object writes multiple rows (a 2D list/iterable of rows) to a CSV file in a single call? [1]
(A) writerows()
(B) writerow()
(C) writelines()
(D) dumpall()
Q12. In a relational database, an attribute (or combination of attributes) in one table that refers to the Primary Key of another table is known as a: [1]
(A) Super Key
(B) Alternate Key
(C) Composite Key
(D) Foreign Key
Q13. State True or False:
In SQL, the Cartesian Product of two tables produces every possible combination of rows from both tables. [1]
Q14. Which SQL command is used to rename an existing column or change its data type/constraints in a MySQL table? [1]
(A) UPDATE TABLE
(B) RENAME COLUMN DATA
(C) ALTER TABLE
(D) MODIFY SCHEMA
Q15. Which MySQL query correctly retrieves all records from the table STAFF where the Department column has no value stored? [1]
(A) SELECT * FROM STAFF WHERE Department IS NULL;
(B) SELECT * FROM STAFF WHERE Department = NULL;
(C) SELECT * FROM STAFF WHERE Department == NULL;
(D) SELECT * FROM STAFF WHERE ISNULL(Department) = FALSE;
Q16. Which cursor method in mysql.connector retrieves only the next single row of a query result set as a tuple? [1]
(A) fetchall()
(B) fetchone()
(C) fetchrow()
(D) nextrow()
Q17. Which network topology uses a single central backbone cable to which all computers and devices are connected via drop lines and terminators? [1]
(A) Star Topology
(B) Mesh Topology
(C) Tree Topology
(D) Bus Topology
Q18. Which protocol is used by web browsers and web servers to transfer hypertext documents securely over an encrypted connection? [1]
(A) HTTPS
(B) FTP
(C) POP3
(D) TELNET
Q19. Expand the following networking and web abbreviations: (i) NSFNET (ii) RJ45 [1]
Q20 and Q21 are Assertion (A) and Reason (R) based questions. Mark the correct choice as:
(A) Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation of Assertion (A).
(B) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A).
(C) Assertion (A) is true, but Reason (R) is false.
(D) Assertion (A) is false, but Reason (R) is true.
Q20. Assertion (A): In Python, the math.sqrt() function and the random.randint() function belong to two different standard library modules.
Reason (R): Both math and random modules must be imported before calling their respective functions in a Python script. [1]
Q21. Assertion (A): In SQL, the aggregate function COUNT(*) counts all rows in a table, including rows containing NULL values.
Reason (R): COUNT(column_name) also includes NULL values present in that specific column when computing the count. [1]
| SECTION – B (7 × 2 = 14 Marks) |
Q22. (A) Differentiate between Text Files and Binary Files in Python. Give any two points of difference. [2]
— OR —
Q22. (B) Differentiate between l-value and r-value in Python assignment statements with a suitable example. [2]
Q23. The following Python function is written to calculate and return the average of all numbers in a non-empty list values. However, it contains syntax and logical errors. Rewrite the corrected code and underline all corrections made. [2]
def calc_avg(values):
total = 0
for x in values
total =+ x
avg = total // len(values)
return Average
Q24. (A) Write single-line Python statements using built-in functions/methods ONLY for each of the following: [2]
(i) Given a string s = ‘ Welcome to Python ‘, remove only the trailing spaces from the right end of s.
(ii) Given a tuple nums = (18, 42, 18, 75, 18, 90), find the index of the first occurrence of 18.
— OR —
Q24. (B) Predict the output of the following Python code: [2]
line = “Learn*Code*Grow”
items = line.split(“*”)
print(“#”.join(items))
print(line.startswith(“Learn”), line.endswith(“grow”))
Q25. (A) Write a Python function count_above_avg(marks_list) that accepts a list of numeric marks and returns the count of students who scored strictly above the average marks of the list.
Example: If input is [60, 80, 70, 90, 50], average is 70.0 and output is 2. [2]
— OR —
Q25. (B) Write a Python function invert_dict(D) that accepts a dictionary D with unique values and returns a new dictionary where keys and values are swapped. [2]
Q26. Predict the output of the following Python code: [2]
def mask_text(txt):
res = “”
for i in range(len(txt)):
if txt[i].isdigit():
res += str(9 – int(txt[i]))
elif txt[i].islower():
res += txt[i].upper()
else:
res += “_”
return res
print(mask_text(“Ab2#Cd7”))
Q27. Meera is designing a database table named EMPLOYEES in MySQL with columns: Emp_ID (CHAR(5)), Emp_Name (VARCHAR(30)), Dept (VARCHAR(20)), and Salary (FLOAT). [2]
(i) (a) Write an SQL command to create the table EMPLOYEES with Emp_ID as Primary Key and Emp_Name as NOT NULL.
OR
(i) (b) Give two reasons why Dept cannot be designated as the Primary Key of the EMPLOYEES table.
(ii) (a) Assuming the table EMPLOYEES already exists, write an SQL command to add a column Join_Date of type DATE.
OR
(ii) (b) Assuming the table EMPLOYEES already exists, write an SQL command to remove the column Dept from the table.
Q28. (A) Differentiate between LAN and WAN. Give two points of comparison. [2]
— OR —
Q28. (B) What is a Gateway in computer networking? State one key difference between a Gateway and a Repeater. [2]
| SECTION – C (3 × 3 = 9 Marks) |
Q29. (A) Write a user-defined function display_long_words() in Python that reads a text file ‘PARAGRAPH.TXT’ and displays all words having 7 or more characters, along with the total count of such words. [3]
— OR —
Q29. (B) Write a user-defined function count_e_lines() in Python that reads a text file ‘DIARY.TXT’ and counts how many lines end with the vowel ‘e’ or ‘E’ (ignoring trailing newline/spaces). [3]
Q30. (A) A list Book_Catalog stores book records as tuples in the format (BookID, Title, Price). For example:
Book_Catalog = [(201, ‘Python Basics’, 350), (202, ‘DBMS Concepts’, 620), (203, ‘Computer Networks’, 580), (204, ‘Web Design’, 290)]
Write the following user-defined functions to manage a global stack list CostlyStack: [3]
(i) push_costly(Book_Catalog): Pushes the tuples of books whose Price is greater than 500 onto CostlyStack.
(ii) pop_costly(): Pops and displays the topmost book record from CostlyStack. If empty, display ‘Stack Underflow’.
(iii) display_costly(): Displays all records in CostlyStack from top to bottom. If empty, display ‘Costly Stack Empty’.
— OR —
Q30. (B) Write a Python program that inputs 6 integers from the user and pushes all multiples of 3 onto a stack list Mult3Stack. After reading all 6 integers, pop and display all elements from Mult3Stack in LIFO order. If none qualify, display ‘No Multiples of 3 Entered’. [3]
Q31. (A) Predict the output of the following Python code: [3]
def modify_arr(L):
for idx in range(len(L)):
if L[idx] % 5 == 0:
L[idx] = L[idx] + 5
elif L[idx] % 2 == 0:
L[idx] = L[idx] // 2
else:
L[idx] = L[idx] * 3
print(L[1::2])
data = [10, 6, 3, 15, 8, 5]
modify_arr(data)
— OR —
Q31. (B) Predict the output of the following Python code: [3]
def sync_scores(p1, p2):
temp = {}
for k in p1:
if k in p2:
temp[k] = p1[k] + p2[k]
else:
temp[k] = p1[k]
p2.update(temp)
return sum(p2.values())
P1 = {“R1”: 10, “R2”: 20, “R3”: 30}
P2 = {“R2”: 15, “R4”: 25}
ans = sync_scores(P1, P2)
print(ans)
print(P2)
| SECTION – D (4 × 4 = 16 Marks) |
Q32. Consider the table LIBRARY_BOOKS given below maintained by a central library: [4]
| Acc_No | Title | Genre | Author | Price | Copies |
| L01 | Digital Logic | Computing | M. Mano | 550 | 12 |
| L02 | Clean Code | Programming | R. Martin | 750 | 8 |
| L03 | Database Systems | Computing | R. Elmasri | 680 | NULL |
| L04 | Python Crash Course | Programming | E. Matthes | 620 | 15 |
| L05 | Modern Physics | Science | A. Beiser | 490 | 10 |
| L06 | Organic Chemistry | Science | M. Chouhan | 530 | 6 |
Q32 (contd.). (A) Write SQL queries for the following tasks: [4]
(i) Display Genre and total Copies available for each Genre where total Copies is greater than 15.
(ii) Display Title, Author, and Price of all books priced between 500 and 700 (both inclusive), sorted in ascending order of Price.
(iii) Reduce the Price by 50 for all ‘Science’ genre books.
(iv) Display all records where Title starts with ‘Digital’ or ends with ‘Course’.
— OR —
Q32 (contd.). (B) Write the output on execution of the following SQL queries on table LIBRARY_BOOKS: [4]
(i) SELECT Genre, AVG(Price) FROM LIBRARY_BOOKS GROUP BY Genre;
(ii) SELECT DISTINCT Genre FROM LIBRARY_BOOKS;
(iii) SELECT Title, Author FROM LIBRARY_BOOKS WHERE Copies IS NULL;
(iv) SELECT COUNT(*), MAX(Price) FROM LIBRARY_BOOKS WHERE Genre = ‘Programming’;
Q33. A CSV file named ‘SALES.CSV’ stores retail sales records with columns:
[Invoice_No, Customer, City, Bill_Amount]
Note: The first row of ‘SALES.CSV’ contains the column headers.
Write user-defined functions in Python for the following: [4]
(i) add_invoice(): Accepts Invoice_No, Customer, City, and Bill_Amount from the user and appends the record to ‘SALES.CSV’.
(ii) metro_sales(): Reads ‘SALES.CSV’ (skipping the header row) and displays all records where City is ‘Mumbai’ or ‘Delhi’, along with the total Bill_Amount of these metro sales.
Q34. Consider the two tables COACHES and TRAINEES in a sports academy database ACADEMY_DB: [4]
Table: COACHES
| Coach_ID | Coach_Name | Game | Experience_Yrs |
| CH01 | Vikram Rathore | Cricket | 12 |
| CH02 | Anjali Verma | Athletics | 8 |
| CH03 | Suresh Raina | Cricket | 15 |
| CH04 | Pooja Sharma | Badminton | 10 |
Table: TRAINEES
| Tr_ID | Tr_Name | Coach_ID | Age | Fee_Status |
| T101 | Rohan Das | CH01 | 16 | Paid |
| T102 | Sneha Gill | CH02 | 15 | Pending |
| T103 | Karan Kapoor | CH03 | 17 | Paid |
| T104 | Neha Joshi | CH04 | 14 | Paid |
| T105 | Amit Kumar | CH01 | 18 | Pending |
Q34 (contd.). Write SQL queries for the following: [4]
(i) Display Tr_Name, Coach_Name, and Game for all trainees whose Fee_Status is ‘Paid’ using Equi-Join.
(ii) Display Game and count of coaches in each game from the COACHES table.
(iii) Delete all records from TRAINEES where Fee_Status is ‘Pending’.
(iv) (a) Display Tr_Name, Age, and Coach_Name for all trainees using Natural Join.
OR
(iv) (b) Display all records from COACHES sorted in descending order of Experience_Yrs.
Q35. A MySQL database named COLLEGE_DB contains a table HOSTEL with the following structure:
• Room_ID : INT
• Student_Name : VARCHAR(30)
• Block : VARCHAR(10)
• Mess_Due : FLOAT
Write a Python program using mysql.connector to connect to the database and:
(i) Set Mess_Due to 0 for all students residing in Block ‘B’.
(ii) Fetch and display all records from the HOSTEL table along with the total number of rows fetched.
Use the following connection parameters:
• Host: localhost | User: root | Password: Hostel@2027 | Database: COLLEGE_DB [4]
| SECTION – E (2 × 5 = 10 Marks) |
Q36. A binary file ‘PRODUCTS.DAT’ stores warehouse product records as dictionaries with the structure:
{‘ProdID’: str, ‘Name’: str, ‘Category’: str, ‘Stock’: int}
Write user-defined functions in Python for the following: [2 + 3 = 5]
(i) add_item(): Inputs details of a product from the user and appends the dictionary record to ‘PRODUCTS.DAT’.
(ii) restock_category(cat, add_qty): Reads all records from ‘PRODUCTS.DAT’ and increases Stock by add_qty for all products matching Category (cat). Rewrite the updated records back into ‘PRODUCTS.DAT’ and display the count of updated records.
Q37. Astra Biotech Laboratories is setting up a new Genome Research Campus in Lucknow with four blocks: GENOMICS, BIOINFO, LABS, and ADMIN. Its Corporate Headquarters is located in Bengaluru (approx. 1,900 km away). As a Network Architect, examine the parameters below and answer questions (i) to (v): [5 × 1 = 5]
| Block From | Block To | Distance (in Metres) |
| GENOMICS | BIOINFO | 50 m |
| GENOMICS | LABS | 125 m |
| GENOMICS | ADMIN | 85 m |
| BIOINFO | LABS | 60 m |
| BIOINFO | ADMIN | 115 m |
| LABS | ADMIN | 140 m |
| Block Name | Number of Computers |
| GENOMICS | 185 |
| BIOINFO | 110 |
| LABS | 75 |
| ADMIN | 35 |
Q37 (contd.). Based on the details provided above, answer the following: [5]
(i) Identify the most suitable block to house the central Server of the Lucknow Campus. Justify your answer.
(ii) Draw the most economical cable layout (Star/Bus topology) to efficiently connect all four blocks within the Lucknow Campus.
(iii) Suggest the placement of:
(a) Switch (b) Repeater
Justify each placement.
(iv) Identify the type of network (PAN, LAN, MAN, WAN) formed when the Lucknow Campus is linked to the Corporate Headquarters in Bengaluru.
(v) (a) Scientists in Lucknow and Bengaluru hold live interactive video-conferencing sessions over IP networks. Which protocol is primarily used for transmitting voice and video over IP?
OR
(v) (b) Suggest the most suitable guided transmission medium to connect the blocks within the Lucknow Campus for high-speed, interference-free data transfer.
MARKING SCHEME – SAMPLE PRACTICE PAPER (SET 6)
CLASS XII – COMPUTER SCIENCE (SUBJECT CODE: 083) • SESSION 2026–27
| SECTION – A: MARKING SCHEME (21 × 1 = 21 Marks) |
Q1. [1 Mark]
(B) pass
Q2. [1 Mark]
False. (x *= 2 + 3 evaluates the right-hand expression first, so it is equivalent to x = x * (2 + 3) = x * 5.)
Q3. [1 Mark]
(C) True False
Q4. [1 Mark]
(A) 9 [Evaluation: 2 ** (3 ** 2) = 2 ** 9 = 512; 512 // 64 = 8; 9 % 4 = 1; 8 + 1 = 9]
Q5. [1 Mark]
(D) [100, 300, 400, 200]
Q6. [1 Mark]
(B) Analyst 3
Q7. [1 Mark]
(C) mode()
Q8. [1 Mark]
(A) Z30-X10 [a can be 1 (‘Y20’) or 2 (‘Z30’); b is always 0 (‘X10’). Only Z30-X10 is valid.]
Q9. [1 Mark]
(D) 17 [power_val(2) = 2**3 = 8; power_val(3, 2) = 3**2 = 9; 8 + 9 = 17]
Q10. [1 Mark]
(B) a+
Q11. [1 Mark]
(A) writerows()
Q12. [1 Mark]
(D) Foreign Key
Q13. [1 Mark]
True.
Q14. [1 Mark]
(C) ALTER TABLE
Q15. [1 Mark]
(A) SELECT * FROM STAFF WHERE Department IS NULL;
Q16. [1 Mark]
(B) fetchone()
Q17. [1 Mark]
(D) Bus Topology
Q18. [1 Mark]
(A) HTTPS
Q19. [1 Mark]
(i) NSFNET: National Science Foundation Network (½ Mark)
(ii) RJ45: Registered Jack 45 (½ Mark)
Q20. [1 Mark]
(B) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A).
Q21. [1 Mark]
(C) Assertion (A) is true, but Reason (R) is false.
| SECTION – B: MARKING SCHEME (7 × 2 = 14 Marks) |
Q22. (A) [1 + 1 = 2 Marks]
1. Representation: Text files store data as human-readable ASCII/Unicode characters with EOL translation, whereas Binary files store data in raw byte/machine format without character translation.
2. Inspection/Editing: Text files can be opened and read directly in any text editor (e.g., Notepad), whereas Binary files require a specific program/module (such as pickle) to interpret.
Q22. (B) [1 Mark for difference + 1 Mark for example = 2 Marks]
• l-value: An expression representing a memory location/variable name that can appear on the left-hand side of an assignment operator.
• r-value: A literal, variable, or expression whose value is evaluated and assigned to an l-value (appears on the right-hand side).
Example: In total = 10 + 5, total is the l-value and 10 + 5 is the r-value.
Q23. [½ Mark for each of the 4 corrections = 2 Marks]
Corrected Code (with all 4 errors underlined):
def calc_avg(values):
total = 0
for x in values:
total += x
avg = total / len(values)
return avg
Q24. (A) [1 + 1 = 2 Marks]
(i) s.rstrip()
(ii) nums.index(18)
Q24. (B) [1 + 1 = 2 Marks]
Learn#Code#Grow
True False
Q25. (A) [2 Marks]
def count_above_avg(marks_list):
avg = sum(marks_list) / len(marks_list)
count = 0
for m in marks_list:
if m > avg:
count += 1
return count
Q25. (B) [2 Marks]
def invert_dict(D):
inv = {}
for k, v in D.items():
inv[v] = k
return inv
Q26. [2 Marks]
Output:
_B7__D2
Trace: ‘A’->’_’, ‘b’->’B’, ‘2’->’7′, ‘#’->’_’, ‘C’->’_’, ‘d’->’D’, ‘7’->’2′.
Q27. [1 + 1 = 2 Marks]
(i)(a) CREATE TABLE EMPLOYEES (
Emp_ID CHAR(5) PRIMARY KEY,
Emp_Name VARCHAR(30) NOT NULL,
Dept VARCHAR(20),
Salary FLOAT
);
(i)(b) 1. Multiple employees work in the same Dept (violates uniqueness).
2. A newly recruited employee may not have a Dept assigned initially (NULL).
(ii)(a) ALTER TABLE EMPLOYEES ADD Join_Date DATE;
(ii)(b) ALTER TABLE EMPLOYEES DROP COLUMN Dept;
Q28. (A) [1 + 1 = 2 Marks]
1. Geographical Coverage: LAN (Local Area Network) covers a small area such as a single room, building, or campus, whereas WAN (Wide Area Network) spans cities, countries, or continents.
2. Speed & Ownership: LAN offers higher data transfer speeds and is privately owned/managed; WAN generally has lower speeds and relies on public/leased telecommunication infrastructure.
Q28. (B) [1 + 1 = 2 Marks]
• Gateway: A network device that serves as an entry/exit point between two dissimilar networks using different protocols and performs protocol conversion.
• Difference from Repeater: A Repeater operates at the physical layer to amplify/regenerate weak signals within the same network, whereas a Gateway connects different networks and translates protocols.
| SECTION – C: MARKING SCHEME (3 × 3 = 9 Marks) |
Q29. (A) [3 Marks]
def display_long_words():
count = 0
with open(“PARAGRAPH.TXT”, “r”) as f:
for word in f.read().split():
if len(word) >= 7:
print(word)
count += 1
print(“Total words with 7 or more characters:”, count)
Q29. (B) [3 Marks]
def count_e_lines():
count = 0
with open(“DIARY.TXT”, “r”) as f:
for line in f:
clean = line.strip()
if clean and clean[-1].lower() == “e”:
count += 1
print(“Lines ending with e or E:”, count)
Q30. (A) [1 + 1 + 1 = 3 Marks]
CostlyStack = []
def push_costly(Book_Catalog):
for book in Book_Catalog:
if book[2] > 500:
CostlyStack.append(book)
def pop_costly():
if len(CostlyStack) == 0:
print(“Stack Underflow”)
else:
print(CostlyStack.pop())
def display_costly():
if len(CostlyStack) == 0:
print(“Costly Stack Empty”)
else:
for i in range(len(CostlyStack) – 1, -1, -1):
print(CostlyStack[i])
Q30. (B) [3 Marks]
Mult3Stack = []
for _ in range(6):
num = int(input(“Enter an integer: “))
if num % 3 == 0:
Mult3Stack.append(num)
if not Mult3Stack:
print(“No Multiples of 3 Entered”)
else:
while Mult3Stack:
print(Mult3Stack.pop())
Q31. (A) [3 Marks]
Output:
[3, 20, 10]
Trace: Modified L becomes [15, 3, 9, 20, 4, 10]. Slice L[1::2] picks indices 1, 3, 5 -> [3, 20, 10].
Q31. (B) [1 + 2 = 3 Marks]
Output:
100
{‘R2’: 35, ‘R4’: 25, ‘R1’: 10, ‘R3’: 30}
| SECTION – D: MARKING SCHEME (4 × 4 = 16 Marks) |
Q32. (A) [1 × 4 = 4 Marks]
(i) SELECT Genre, SUM(Copies) FROM LIBRARY_BOOKS GROUP BY Genre HAVING SUM(Copies) > 15;
(ii) SELECT Title, Author, Price FROM LIBRARY_BOOKS WHERE Price BETWEEN 500 AND 700 ORDER BY Price ASC;
(iii) UPDATE LIBRARY_BOOKS SET Price = Price – 50 WHERE Genre = ‘Science’;
(iv) SELECT * FROM LIBRARY_BOOKS WHERE Title LIKE ‘Digital%’ OR Title LIKE ‘%Course’;
Q32. (B) [1 × 4 = 4 Marks]
(i)
| Genre | AVG(Price) |
| Computing | 615 |
| Programming | 685 |
| Science | 510 |
(ii)
| Genre |
| Computing |
| Programming |
| Science |
(iii)
| Title | Author |
| Database Systems | R. Elmasri |
(iv)
| COUNT(*) | MAX(Price) |
| 2 | 750 |
Q33. [2 + 2 = 4 Marks]
import csv
def add_invoice():
inv = input(“Enter Invoice No: “)
cust = input(“Enter Customer Name: “)
city = input(“Enter City: “)
amt = float(input(“Enter Bill Amount: “))
with open(“SALES.CSV”, “a”, newline=””) as f:
writer = csv.writer(f)
writer.writerow([inv, cust, city, amt])
def metro_sales():
total_metro = 0
with open(“SALES.CSV”, “r”, newline=””) as f:
reader = csv.reader(f)
next(reader) # Skip header row
for row in reader:
if row[2] in (“Mumbai”, “Delhi”):
print(row)
total_metro += float(row[3])
print(“Total Metro Sales:”, total_metro)
Q34. [1 × 4 = 4 Marks]
(i) SELECT Tr_Name, Coach_Name, Game
FROM COACHES C, TRAINEES T
WHERE C.Coach_ID = T.Coach_ID AND Fee_Status = ‘Paid’;
(ii) SELECT Game, COUNT(*) FROM COACHES GROUP BY Game;
(iii) DELETE FROM TRAINEES WHERE Fee_Status = ‘Pending’;
(iv)(a) SELECT Tr_Name, Age, Coach_Name
FROM COACHES NATURAL JOIN TRAINEES;
(iv)(b) SELECT * FROM COACHES ORDER BY Experience_Yrs DESC;
Q35. [4 Marks]
import mysql.connector
con = mysql.connector.connect(
host=”localhost”,
user=”root”,
password=”Hostel@2027″,
database=”COLLEGE_DB”
)
cur = con.cursor()
cur.execute(“UPDATE HOSTEL SET Mess_Due = 0 WHERE Block = ‘B'”)
con.commit()
cur.execute(“SELECT * FROM HOSTEL”)
rows = cur.fetchall()
for r in rows:
print(r)
print(“Total rows fetched:”, cur.rowcount)
con.close()
| SECTION – E: MARKING SCHEME (2 × 5 = 10 Marks) |
Q36. [2 + 3 = 5 Marks]
import pickle
def add_item():
pid = input(“Enter Product ID: “)
name = input(“Enter Product Name: “)
cat = input(“Enter Category: “)
stock = int(input(“Enter Stock: “))
rec = {“ProdID”: pid, “Name”: name, “Category”: cat, “Stock”: stock}
with open(“PRODUCTS.DAT”, “ab”) as f:
pickle.dump(rec, f)
def restock_category(cat, add_qty):
records = []
updated = 0
with open(“PRODUCTS.DAT”, “rb”) as f:
while True:
try:
rec = pickle.load(f)
if rec[“Category”].lower() == cat.lower():
rec[“Stock”] += add_qty
updated += 1
records.append(rec)
except EOFError:
break
with open(“PRODUCTS.DAT”, “wb”) as f:
for rec in records:
pickle.dump(rec, f)
print(“Number of records updated:”, updated)
Q37. [1 × 5 = 5 Marks]
(i) GENOMICS Block is the most suitable block to house the central Server because it contains the highest number of computers (185), minimizing network traffic and latency.
(ii) Most economical Star/Bus cable layout (Minimum Spanning Tree = 50 m + 60 m + 85 m = 195 m):
[ADMIN] <— 85m —> [GENOMICS] <— 50m —> [BIOINFO] <— 60m —> [LABS]
(iii) (a) Switch: Should be placed in each block (GENOMICS, BIOINFO, LABS, ADMIN) to interconnect all computers within each block.
(b) Repeater: Not required in the optimal layout above since all inter-block cable segments (50 m, 60 m, 85 m) are under 100 metres. (Required only if any single cable run exceeds 100 m.)
(iv) WAN (Wide Area Network), because Lucknow and Bengaluru are ~1,900 km apart across different cities/states.
(v) (a) VoIP (Voice over Internet Protocol)
OR
(v) (b) Optical Fiber Cable (provides high bandwidth, low signal attenuation, and immunity to electromagnetic interference).
By Anjeev Kr Singh – Computer Science Educator
Published on : December 1, 2026 | Updated on : December 1, 2026



