CLASS XII – COMPUTER SCIENCE (083)
Sample Question Paper – 2025–26
Time Allowed: 3 Hours Maximum Marks: 70
SECTION – A (21 × 1 = 21 Marks)
1. State True or False:
round( [Link]([4, 9, 12, 15]) ) will return 10 if the statistics module is
imported.
2. What will be the output?
T = ("Alpha", "Bravo", "Charlie")
print(T[2][1] + T[0][-1])
a) hl b) le c) hr d) ha
3. print(25 > 10 or 8 > 20 and not (15 == 15))
a) True b) False c) None d) Error
4. In SQL, which join always produces a Cartesian product when no condition is
given?
5. s = "ComputerScience"
print(s[-2::-4])
a) enot b) eieC c) enCm d) ccto
6. Predict the output:
for i in range(6, 35, 7):
print(i, end="-")
7. Predict the output:
print(50/5 + 2**3**1 - 25)
8. Correct the SQL query:
SELECT dept, AVG(salary) HAVING AVG(salary)>60000 FROM staff;
9. What will be printed?
try:
d = int("xyz")
except ValueError:
print("Invalid")
except Exception:
print("General")
[Link] possible output:
info = {"name": "Rita", "city": "Goa"}
print([Link]("age", 25))
a) None b) 25 c) age d) 0
11. Predict possible output:
import random
L = [5, 15, 25, 35]
a = [Link](1,1)
b = [Link](1,3)
for i in range(a, b+1):
print(L[i], end="#")
a) 15#25# b) 25#35# c) 15# d) 15#25#35#
12. Predict the output:
x=3
print(x,end='**')
def calc():
global x
x = x*4
print(x,end='@@')
calc()
print(x)
13. SQL command that affects cardinality of a table:
a) INSERT b) UPDATE c) ALTER d) RENAME
14. Predict the output
st="Look into the book"
print([Link]("o"))
a) ['L', '', 'k int', ' the b', '', 'k']
b) ['L', 'ok int', ' the b', 'ok']
c) Error
d) ['', '']
15. A relation has (9 columns, 10 rows). If 3 columns are added and 4 rows inserted,
updated degree =
a) 9 b) 12 c) 13 d) 14
16. Which SQL command removes an attribute?
a) DELETE b) ALTER c) DROP d) UPDATE
17. __________ is a protocol used to send emails.
a) FTP b) SMTP c) POP3 d) TCP
18. Identify the correct statement:
a) Switch forwards frames using MAC address; hub broadcasts to all.
b) Hub filters frames; switch broadcasts always.
c) Both do the same job.
d) Both are used for wireless networks.
19. A webpage structure is created using:
a) CSS b) HTML c) XML d) HTTP
20 Assertion–Reason
Assertion (A): A list is mutable but a tuple is immutable.
Reason (R): Tuple elements can be modified only through indexing.
a) A & R true; R explains A
b) A & R true; R does not explain A
c) A true; R false
d) A false; R true
21 Assertion-Reason questions.
Assertion (A): A foreign key may have repeated values.
Reason (R): A foreign key refers to a primary key of another table.
a) A & R true; R explains A
b) A & R true; R doesn’t explain A
c) A true; R false
d) A false; R true
SECTION – B (7 × 2 = 14 Marks)
22. A Differentiate between local and global variables in Python using an example.
OR
B. Explain default parameters and keyword parameters with code.
23. The function is intended to reverse a string but contains errors. Rewrite the
corrected code and underline corrections.
def rev(s):
for i in range(len(s)-1,0):
news=news+s[i]
return news
print(rev("Hello"))
24. A. Write Python statements:
I. Count occurrences of substring "the" in a string para.
II. Remove all elements from list L2 and extend it with list L3.
OR
B. Predict output:
t="Coding in Python"
print([Link]("in"))
print([Link]("on"))
25. A. Write update_price() that receives a dictionary products, and an item name.
If the item exists, increase its price by 10%; otherwise display "Not Found".
OR
B. Write merge_dicts() to combine two dictionaries such that values of common keys
are stored in a list.
26. Predict output
D={"A":(12,18),"B":(20,10),"C":(15,30),"D":(25,20)}
res=[]
for k in D:
total=D[k][0]+D[k][1]
if total%5==0:
[Link](k)
print(sorted(res))
27. A. Write SQL commands:
I. Display all table names in the database.
II. Remove table orders permanently.
OR
B. Differentiate between PRIMARY KEY and UNIQUE with examples.
28. A. Define:
I. Packet Switching
II. TCP/IP
OR
B. I. Expand: SMTP, XML
II. Differentiate: Router vs Gateway
SECTION – C (3 × 3 = 9 Marks)
29. A. Write a Python function to count the number of three-letter words in a text
file "[Link]".OR
B. Write a function to read "[Link]" and display only those lines that contain no
digits.
30. Given stack S = ["Ava","Mia","Noah","Liam","Zoe"]
Write user-defined functions:
I. push_item() – push an element onto stack
II. pop_item() – pop and return top element; display “Stack Empty” when needed
31. A. Predict output:
s="CS-2025"
t=""
for ch in s:
if [Link]():
t = t + str(int(ch)+2)
elif [Link]():
t = t + [Link]()
else:
t = t + "*"
print(t)
Or
cities=["Jaipur","Pune","Kochi","Indore","Mysuru"]
op=[]
for c in cities:
if c[1] in 'aeiouAEIOU':
[Link](c[-1].upper())
print(op)
SECTION – D (4 × 4 = 16 Marks)
32. A. Consider table EMPLOYEE: (fields: EmpID, Name, Dept, Salary)
EmpID Name Dept Salary
1 Helen Marketing 50000
2 Keb IT 25000
3 Jonathan Marketing 55000
4 Martin IT 30000
5 Mic HR 75000
Write SQL queries to:
I. Display total salary for each department where total salary > 200000
II. Show all records sorted by Name descending
III. Display unique department names
IV. Display all names ending with 'a'
OR
32 B. Predict output:
I. SELECT COUNT(*) FROM Employee WHERE Salary>50000;
II. SELECT Name FROM Employee WHERE Dept LIKE '_t%';
III. SELECT SUM(Salary) FROM Employee WHERE Dept IN ('IT','HR');
IV. SELECT Name,Dept FROM Employee WHERE Salary BETWEEN 30000 AND
60000;
33. A CSV file "[Link]" stores: Roll, Name, Subject, Marks.
Create functions:
I. AddRecord() – append a new record and set the newline argument as well
II. HighestScore() – return highest marks from file
34. Two tables are given:
CUSTOMERS(CustID, CustName, City)
ORDERS(OrderID, CustID, Amount, OrderDate)
Write SQL queries:
I. Display names of customers who placed an order above 15000.
II. Display details of orders placed in ‘Delhi’, ‘Chennai’, or ‘Kochi’.
III. Delete all orders older than '2024-11-30'.
IV. A. Show Cartesian product of both tables. OR
B. Display CustName with corresponding OrderID.
35. Write a Python program using MySQL connectivity to update the Amount of
order with OrderID=505 to 9600 in database SalesDB.
ORDERS(OrderID - Int, Amount - Int, OrderDate - String)
Credentials:
Host = "localhost"
User = "admin"
Password = "sales2024"
SECTION – E (2 × 5 = 10 Marks)
36. A binary file "[Link]" stores Employee_ID, Name, Dept, Salary.
Write Python functions:
I. Add new employee data to file.
II. Increase salary by 15% for all employees in "Finance" department.
37. Company “TechVille” has three blocks in Delhi: Admin, Research, Support, with
distances:
Admin–Research: 60m
Admin–Support: 120m
Research–Support: 90m
Computers:
Admin – 30
Research – 80
Support – 40
I. State the best server location with justification
II. Placement of:
a) Switch b) Repeater
III. Draw the most efficient cable layout
IV. Recommend cable for a high-speed link to Chennai HQ
V. A. State one use of HTTPS
OR
B. Identify network type when connecting two cities