0% found this document useful (0 votes)
58 views172 pages

Computer Science

The document is a model question paper for Class XII Computer Science for the academic year 2025-26, structured into five sections with a total of 37 questions. Each section varies in the number of questions and marks, covering topics such as Python programming, SQL, and data types. The paper includes multiple-choice questions, programming tasks, and theoretical questions, all requiring answers in Python language.

Uploaded by

vyshali074
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views172 pages

Computer Science

The document is a model question paper for Class XII Computer Science for the academic year 2025-26, structured into five sections with a total of 37 questions. Each section varies in the number of questions and marks, covering topics such as Python programming, SQL, and data types. The paper includes multiple-choice questions, programming tasks, and theoretical questions, all requiring answers in Python language.

Uploaded by

vyshali074
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION

MODEL QUESTION PAPER 2025-26-1


ककककक CLASS : XII ककक TIME : 03 HOURS
कककक SUBJECT : COMPUTER SCIENCE कककककक ककक MAX. MARKS:
70
General 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 case of MCQ, text of the correct answer should also be written.

Q No. Section-A (21 x 1 = 21 Marks) Marks

1. Why is the finally block important in Python exception handling?


(1)
a) To catch all types of exceptions
b) To skip error handling
c) To ensure essential cleanup code always runs
d) To convert errors into warnings
2. Identify the output of the following code snippet:
text = "PYTHONROCKS"
text = [Link]('RO', '#')
print(text) (1)

(A) PY#CKS (B) PY#KS (C) PYTHON#CKS (D) PYTH#KS

3. Which of the following expressions evaluates to False?


(A) not(False) or False
(B) True and not(False) (1)
(C) not(True and False)
(D) False and not(False)
In SQL what is the purpose of distinct clause
4. (1)

5. What will be the output of the following code snippet?


(1)
message = "Knowledge Base"
print(message[-3::-3])
(A) 'aeeo' (B) 'aewo' (C) 'sego' (D) 'esdg'
What will be the output of the following code? (1)
6.
list_a = [10, 20, 30]
list_b = list_a
list_a.append(40)
print(list_a == list_b)

Page: 1/11
(A) True (B) False (C) list_a (D) Error

7. If dict_sample is a dictionary as defined below, then which of the following


statements will raise an exception?
dict_sample = {'a': 10, 'b': 20, 'c': 30}
(1)
(A) dict_sample.get('b') (B) print(dict_sample['a', 'b'])
(C) dict_sample['c'] = 300 (D) print(str(dict_sample))
8. Which of the following statements is true regarding a primary key?
(A) A table can have multiple primary keys
(B) A primary key can contain NULL values (1)
(C) A primary key uniquely identifies each row in a table
(D) A primary key must be a numeric value
What will be the output of the following Python code?
9. (1)
try:
even_numbers = [2,4,6,8]
print(even_numbers[5])

except ZeroDivisionError:
print("Denominator cannot be 0.")

except IndexError:
print("Index Out of Bound.")
a) Division by zero error! b) Denominator cannot be 0
c) ZeroDivisionError d) Index out of Bound
10. What will be the output of the following Python code?
dict = {"name": "Alicia", "age": 27, "city": "DELHI"}
print([Link]("name"))
a) Alicia b)DELHI c)None d)Not Specified (1)
11. What possible output is expected to be displayed on the screen at the time of
execution of the Python program from the following code?
import random (1)
L=[10,30,50,70]
Lower=[Link](1,2)
Upper=[Link](1,3)
for K in range(Lower, Upper+1):
print(L[K], end="@")
a) 30@50@70@ b) 90@ c) 10@30@50@ d) 10@30@50@70@

Page: 2/11
12. What will be the output of the following code?
x=8
def multiply():
global x
x *= 3
print(x)
multiply() (1)

(A) 24 (B) 8 (C) Error (D) None

13. Which SQL command can be used to delete all records from a table without deleting (1)
the table itself?
(A) SELECT (B) DROP (C) DELETE (D) REMOVE
14. What is the output of the given Python code?
st='Waterskiing is thrilling!'
print([Link]())
a) ['Watersk', 'ng ', 's thr', 'll', ‘ng!'] b) ['Watersk', '', 'ng ', 's thr', 'll', 'ng!'] (1)
c) ['Watersk', 'i', 'ng ', 's thr', 'll', ‘ng!'] d) [“waterskiing”,”is”,”thrilling”]

15. Which datatype is padded with spaces to match a specified length?


(A) DATE (B) CHAR (C) FLOAT (D) VARCHAR
(1)
16. Which aggregate function calculates the number of rows in a table?
(A) SUM() (B) COUNT() (C) AVG() (D) MAX() (1)

17. Which protocol is used to access email messages stored on a server without
(1)
downloading them?
(A) SMTP (B) IMAP (C) POP3 (D) FTP
18 Which network device connects multiple devices within a network and sends data to (1)
the correct destination?
(A) Router (B) Switch (C) Hub (D) Repeater
19 Which switching technique establishes a dedicated communication path before data (1)
transmission?
(A) Packet Switching (B) Message Switching
(C) Circuit Switching (D) Hybrid Switching
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Markthe
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 explanationfor A
(C) A is True but R is False
(D) A is False but R is True
20 Assertion (A): Default arguments in Python functions must be defined after all (1)
required arguments.
Reasoning (R): Default arguments provide a fallback value when no argument is
provided.
21 Assertion (A): An SQL SELECT statement can have both WHERE and ORDER BY
clauses.
Reasoning (R): WHERE filters data, and ORDER BY sorts it. (1)
Page: 3/11
Q No Section-B ( 7 x 2=14 Marks) Marks

22. Differentiate between mutable and immutable data types. Identify one mutable
and one immutable type from: (10, 20), [10, 20], {'key': 'value'}, 'string'.
(2)
OR
Explain about “ Dynamic typing Feature of python” with
(2)
23. Correct the following code. Rewrite it after removing all errors. Underline all the
corrections made.
chars = "Education"
strt = 1
nd = 10
totl = 0
for i in range(strt, nd + 1)
if i % 2 = 0:
totl += i
print(totl)
24. A. Answer using python built in methods/functions only
Given L1 = [10, 20, 10, 30, 40] and L2 = [50, 60, 70],
i. Write a statement to remove the first occurrence of 10 from L1. (2)
ii. Write a statement to merge L1 and L2.
OR
B,Predict tbe output of the following python code:
Text=” Python programming”
i. print(Text,split(‘m’))
ii. print([Link](‘ing’))
A. Write a function insert_element() in Python that accepts a list L (2)
25
and a number n. If the number n exists in the list, it should display a
message “Duplicate element”. If it does not exist, insert element at the
given index
OR
B. Write a Python function remove_contact() that accepts a dictionary
phone_book, a name, and a phone number. The function should
remove the name and phone number from the dictionary. If the name
does not exists, print "No such contact exists".
Predict the output of the Python code given below : (2)
26
Mylist=[1,5,5,5,5,1]
Max=mylist[0]
indexofmax=0
for i in range(1,len(mylist)):
if mylist[i]> max:
max=mylist[i]
indexofmax=i
Page: 4/11
print(indexofmax)

(2)
27 (I)
A) What SQL constraint ensures that a column must always have a unique value and
cannot be NULL?
B) Write an SQL command to add a UNIQUE constraint to an existing column named
`email` in the `students` table.
(OR)
(II)
A) Write an SQL command to remove the NOT NULL constraint from a column
named `phone_number` in the `employees` table.
B) Write an SQL command to add the NOT NULL constraint to a column named
`salary` in an existing table called `jobs`.
28 (A) Mention one advantage and one disadvantage of using bus topology. (2)
(OR)
(B) Expand IMAP and FTP? What is the use of FTP?
Q No. Section-C ( 3 x 3 = 9 Marks) Marks
(A) Write a Python function that reads all lines from a text file [Link] containing
29. (3)
the word 'data' and display them
OR
(B) Write a Python function that counts the number of occurrences of the word 'data'
in the text file [Link].
(A) You have a stack named BookStack containing dictionaries representing (3)
30. books. Write user defined functions in python to perform the specified
operations on the stack BookStack:

(i) Add a book to the stack push_book


(ii) Remove the top book from the stack and display it and display underflow
if stack is empty
(iii) Display the top book without removing it (peek)

OR
(B) Write the definition of a user-defined function `push_index(N)` which
accepts a list of integers in a parameter `N` and pushes all the indexes of those
numbers which are even from the list `N` into a Stack named `EvenNumbers`.
Write function pop_index() to pop the topmost number from the stack and
returns it. If the stack is already empty, the function should display "Empty".
Write function Disp_index() to display all element of the stack without
deleting them. If the stack is empty, the function should display 'None'.
31 (A) Predict the output of the following code:

fruits = {"apple": 7, "banana": 3, "cherry": 10}

result = ""

for fruit, count in [Link]():

result += fruit + str(count) + “!”+"\n"


Page: 5/11
(3)
print(result)
(OR)
(B) Predict the output of the following code:

numbers = [3, 7, 5, 8,10]

for n in numbers:

for i in range(1, n % 4):

print(i, '*', end="")

print()
Q No Section-D ( 4 x 4=16 Marks) Marks

32 Consider the following tables PRODUCTS AND ORDERS given below: 4

Table: PRODUCTS
ProductID ProductName Quantity Price
1 Laptop 15 50000
2 Mouse 25 500
3 Keyboard 10 1000
4 Monitor 8 7000
5 Printer 5 12000

Table: ORDERS
OrderID CustomerID ProductID Quantity Price
101 C001 1 2 100000
102 C002 3 1 1000
103 C003 5 1 12000
104 C004 2 5 2500
105 C005 4 1 7000
Write SQL queries for the following:
(A)
(I) Display the total quantity of products excluding those with a quantity
less than 4.
(II) Display orders sorted by price in descending order.
(III) Display unique customer IDs.
(IV) Display Sum prices of all non-null quantity orders.
OR

Write outputs for the following queries:


(B)
(I) SELECT ProdName,Quantity from PRODUCTS where Quantity>
10;
(II) SELECT * FROM PRODUCTS ORDER BY Quantity desc;
Page: 6/11
(III) SELECT DISTINCT ProdID from ORDERS;
(IV) SELECT AVG (price)FROM PRODUCTS where Quantity is NOT
NULL;
33 A CSV file [Link] contains data of countries, population, number of cities, 4
and average temperature.
For example, a sample record of the file may be:
[ India,1380000000,100,29.4 ]
Write functions to:
(i) Display records with populations greater than 50 million
(ii) Count all records

34 Consider TEACHERS and COURSES tables. 4

Table: TEACHERS

TeacherID Name Salary


T1 Mr. Sharma 20000
T2 Ms. Gupta 18000
T3 Mr. Verma 22000
T4 Ms. Reddy 17000
T5 Mr. Khan 25000

Table: COURSES

CourseID TeacherID CourseName Fees


101 T1 Mathematics 20000
102 T2 Physics 18000
103 T3 Computer Science 25000
104 T4 Chemistry 15000
105 T5 Data Structures 30000

Write SQL queries to:


(i) Display details of teachers with salary greater than 15,000
(ii) Display CourseName,Teacher name along with fees between 15,000 and
40,000
(iii) Increase fees of course by 500 for courses containing 'data' in their name.
(iv) (A) Display the Teacher name teaching 'Chemistry'.
OR
(B) To display the cartesian product of these two tables
35 A Table, named ITEMS, in ITEMDB database, has the following: 4

Field Type
ItemNo int(11)
ItemName varchar(15)
Price Float
Page: 7/11
Qty int(11)
Write the following Python function to perform the specified operation:

AddAndDisp(): To input details of an item and store it in the table ITEMS. The function
should then retrieve and display all records from the ITEMS table where the Price is
greater than 80.

Assume the following for Python-Database connectivity:


Host: localhost, User: root, Password: Pencil
Q No Section-E ( 2 x 5=10 Marks) Marks
36 Assume Employee Record Structure as following: 2+3
[ID, Name, Salary, Department]
# Example:
employee = [1, 'John Doe', 20000, 'IT']
Write functions to manage employee records in a binary file [Link]:
(i) Append new employee data
(ii) Update department for employees with salaries less than 25,000 to 'Support'

37 The Hyderabad campus will have four blocks/buildings - ADMIN, FOOD, MEDIA, 5
DECORATORS. You, as a network expert, need to suggest the best network-related
solutions for them to resolve the issues/problems mentioned in points (I) to (V),
keeping in mind the distances between various blocks/buildings and other given
parameters.

Block to Block distances (in Mtrs.)

From To Distance
ADMIN FOOD 42 m
ADMIN MEDIA 96 m
ADMIN DECORATORS 48 m
FOOD MEDIA 58 m
FOOD DECORATORS 46 m
MEDIA DECORATORS 42 m

Distance of Delhi Head Office from Hyderabad Campus = 1500 km

Number of computers in each of the blocks/Center is as follows:

Block Number of Computers


ADMIN 30
FOOD 18
MEDIA 25
DECORATORS 20
DELHI HEAD OFFICE 18
An office in Hyderabad has three departments: Admin, HR, and Logistics.
(i) Suggest an optimal server location in Hyderabad campus
Page: 8/11
(ii) Suggest a device to connect computers within each department.
(iii) Propose a method to ensure data security between the three departments.
(iv) Is there a need for a repeater? Justify
(v) (A) Recommend a communication method between Hyderabad and Delhi
head offices.
OR
(B) What type of network is formed between Hyderabad and Delhi Head
office.

Page: 9/11
Page: 10/11
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER 2025-26-2
ककककक CLASS : XII ककक TIME : 03 HOURS
कककक SUBJECT : COMPUTER SCIENCE कककककक ककक MAX.
MARKS: 70

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 21 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 03 Short Answer type questions carrying 03 marks each.
6. Section D has 04 Long Answer type questions carrying 04 marks each.
7. Section E has 02 questions carrying 05 marks each.
8. All programming questions are to be answered using Python Language only.

SECTION-A
S. Question Marks
No
1 State True or False. 1
“In a Python program, if a break statement is given in a nested loop, it terminates the execution
of all loops in one go."
2 Select the correct output of the code: 1

s = "Python is fun"
p = [Link] ()
s_new = "_".join([p[0].upper(), p[1], p[2].capitalize()])
print(s_new)
(a) PYTHON-IS-Fun
(b) PYTHON-is-Fun
(c) Python-is-fun
(d) PYTHON-IS-Fun
3 What will be the output of the following statement: 1
Print(3-2**2**3+99/11)
(a) 244
(b) 244.0
(c) -244.0
(d) Error
4 In a table in the MYSQL database, an attribute A of datatype varchar(20) has the value 1
"Keshav". The attribute B of datatype char(20) has the value "Meenakshi". How many
characters are occupied by attribute A and attribute B?
(a) 20,6
(b) 6,20
(c) 9,6
(d) 6,9
5 Consider the statements given below and then choose the correct output from the given 1
options:
pride="#G20 Presidency"
print(pride [-2:2:-2])
(a) ndsr
(b) ceieP0
(c) ceieP
(d) yndsr
6 Find and write the output of the following python code: 1
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
7 Which of the following will delete key-value pair for key = "Red" from a dictionary 1
D1?
(a) delete D1 ("Red")
(b) del D1 ["Red"]
(c) del.D1 ["Red"]
(d) [Link]["Red"]
8 In MYSQL database, if a table, Alpha has degree 5 and cardinality 3, and another table, Beta 1
has degree 3 and cardinality 5, what be the degree and cardinality of the Cartesian product of
Alpha and Beta?
(a) 5,3
(b) 8, 15
(c) 3, 5
(d) 15, 8
9 What will be the output of the following Python code? 1
try:
numerator = 10
denominator = 0
result = numerator/denominator
print(result)
except:
print("Error: Denominator cannot be 0.")
finally:
print("This is finally block.")
a) Division by zero error! b) Some other error!
c) ZeroDivisionError d) Error: Denominator cannot be 0.
This is finally block. This is finally block.
10 Which of the following statements) would give an error during the execution of the following 1
code?
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3] + 50) #Statement 2
print(max(tup)) #Statement 3
tup [4]=80 #Statement 4
(a) Statement 1
(b)Statement 2
(c)Statement 3
(d)Statement 4
11 import random 1
AR=[20,30,40,50,60,70]
FROM=[Link](1,3)
TO=[Link](2,4)
for K in range(FROM,TO+1):
print(AR[K],end="#")

(a) 10#40#70# (b) 30#40#50# (c) 50#60#70# (d) 40#50#70#


12 Consider the code given below: 1
b=100
def test(a):
_____________# missing statement
b=b+a
print (a,b)
test (10)
print (b)
Which of the following statements should be given in the blank for #missing statement, if the
output produced is 110?

(a) global a
(b) global b=100
(c) global b
(d) global a=100
13 State whether the following statement is True or False: 1
An exception may be raised even if the program is syntactically correct.
14 Which of the following statements is FALSE about keys in a relational database? 1
(a) Any candidate key is eligible to become a primary key.
(b) A primary key uniquely identifies the tuples in a relation.
(c) A candidate key that is not a primary key is a foreign key.
(d) A foreign key is an attribute whose value is derived from the primary key of another
relation.
15 Which of the following attributes can be considered as a choice for the primary key ? 1
(a) Name
(b) Street
(c) RollNo
(d) Subject
16 Which SQL command is used to remove a table from a database in MySQL? 1
a) UPDATE b) ALTER c) DROP d) DELETE
17 The modem at the sender's computer end acts as a 1
(a) Model
(b) Modulator
(c) Demodulator
(d) Convertor
18 Riya wants to transfer pictures from her mobile phone to her laptop. She uses Bluetooth 1
Technology to connect two devices. Which type of network will be formed in this case?
(a) PAN
(b) LAN
(c) MAN
(d) WAN
19 In case of ______switching, before a communication starts, a dedicated path is identified 1
between the sender and the receiver.
(a) Message
(b) Packet
(c) Circuit
(d) Data
Directions:Q.17 and Q.18 are ASSERTION(A) and REASONING( R) based questions
20 Assertion(A): List is an immutable data type. 1
Reasoning(R): When an attempt is made to update the value of an immutable variable, the
old variable is destroyed and a new variable is created by the same name in memory.
(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.
21 Assertion(A): Python standard library consists of number of modules. 1
Reasoning(R): A function in a module is used to simplify the code and avoids repetition.
(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.
SECTION-B
22 Predict the output of the Python code given below:
Text1=" IND-23" 2
Text2=""
I=0
while I<len (Text1) :
if Text1[I]>="0" and Texti [I]<="9":
Val = int (Text1[I])
Val = Val + 1
Text2=Text2 + str(Val)
elif Text1[I]>="A" and Text1[I]<="Z”:
Text2=Text2 + (Text1 [I + 1])
else:
Text2=Text2 + “*”
I+=1
print (Text2)

(OR)

A list named studentAge stores age of students of a class. Write the Python command to import
the required module and built-in function to display the most common age value from the
given list.
23 The code given below accepts a number as an argument and returns the reverse number. 1+1
Observe the following code carefully and rewrite it after removing all syntax and logical
errors. Underline all the corrections made.
define revNumber (num) :
rev = 0
rem = 0
While num › 0:
rem ==num %10
rev = rev*10 + rem
num = num/ /10
return rev
print (revNumber(1234))
24 A. (Answer using Python built-in methods/functions only): 2
I. Write a statement to count the occurrences of the substring "good" in a string named
review.
II. Write a statement to sort the elements of list L1

(OR)
B. Predict the output of the following Python code:
text="Learn Python with fun and practice"
print([Link]("n"))
print([Link]("a"))

25 (a)Write a function countNow (PLACES) in Python, that takes the dictionary, PLACES as an 2
argument and displays the names (in uppercase) of the places whose names are longer than 5
characters.
For example, Consider the following dictionary
PLACES={1: "Delhi"', 2: "London", 3: "Paris" ,4: "New York", 5: "Doha" }
The output should be:
• LONDON
• NEW YORK
(OR)
(b) Write a function, lenWords(STRING), that takes a string as an argument and returns a
tuple containing length of each word of a string.
For example, if the string is "Come let us have some fun", the tuple will have (4, 3, 2, 4, 4, 3)

26 def swap(P ,Q): 2


P,Q=Q,P
print( P,"#",Q)
return (P)
R=100
S=200
R=swap(R,S)
print(R,"#",S)
27 A. 2
Ms Shalini has just created a table named "Employee" containing columns Ename,
Department and Salary. After creating she realized that she has forgotten to add a primary key
column in the table.
I. Help her in writing an SQL command to add primary key column Empld of integer
type to the table Employee.

II. Help her in adding Not Null constraint to the column Ename.
(OR)
B.
Zack is working in a database named SPORT, in which he has created a table named "Sports"
containing columns Sportid, SportName, no_of_players, and category.
After creating the table, he realized that the primary key constraint of the table Sportid to be
removed
I Help him in removing primary key constraint from the column Sportid
[Link] him writing query to add the column UID to the table and make it as unique and not
null
28 (a) 2
(i)Expand the following in the context of Internet Protocol:
РОРЗ
Expand the following:
URL
(ii) Write two points of difference between XML and HTML.
(OR)
(b)
(i) Define the term Bandwidth with respect to Networks.
(ii)How is http different from https?
SECTION-C
29 (a)Write a function in Python to read a text file, [Link] and displays those lines which begin 2+1
with the word 'You'.
(OR)
(b) Write a function, vowelCount() in Python that counts and displays the number of vowels
in the text file named [Link].
30 A list, List contains following record as list elements: 3
[City, Country, distance from Delhi]
Each of these records are nested together to form a nested list. Write the following user defined
functions in Python to perform the specified operations on the stack named travel.
i. Push_element(NList): It takes the nested list as an argument and pushes a list object
containing name of the city and country. which are not in India and distance is less than 3500
km from Delhi.
ii. Pop_element(): It pops the objects from the stack and displays them. Also, the function
should display "Stack Empty" when there are no elements in the stack.
For example: If the nested list contains the following data:

NList=[["New York", "U.S.A.", 11734], ["Naypyidaw", "Myanmar", 3219],


["Dubai", "UAE", 2194],["London", "England", 6693],["Gangtok", "India", 1580],
["Columbo", "Sri Lanka", 3405]]
The stack should contain:
['Naypyidaw', 'Myanmar'],
['Dubai', 'UAE'],
['Columbo', 'Sri Lanka']
The output should be:
['Columbo', 'Sri Lanka' ]
['Dubai', 'UAE']
['Naypyidaw', 'Myanmar']
Stack Empty
(OR)
Write the definition of a user-defined function `push_even(N)` which accepts a list of integers
in a parameter `N` and pushes all those integers which are even from the list `N` into a Stack
named `EvenNumbers`.Write function pop_even() to pop the topmost number from the stack
and returns it. If the stack is already empty, the function should display "Empty".
Write function Disp_even() to display all element of the stack without deleting them. If the
stack is empty, the function should display 'None'.
For example:
If the integers input into the list `VALUES` are:
[10, 5, 8, 3, 12]
Then the stack `EvenNumbers` should store:
[10, 8, 12]
31 (a)Predict the output of the following code: 3
S = "LOST"
L = [10, 21, 33, 4]
D={}
for I in range(len(S)) :
if I%2==0:
D[[Link]()] = S[I]
else:
D[[Link]()] = I+3
for K, V in [Link]() :
print (K,V, sep="*"*)

(OR)
Predict the output of the following code:
line=[4,9,12,6,20]
for I in line:
for j in range(1,I%5):
print(j,’#’,end=””)
print()
SECTION-D
32 Consider the tables PRODUCT and BRAND given below: 4

Table: PRODUCT
PCode PName UPrice Rating BID
P01 Shampoo 120 6 M03
P02 Toothpaste 54 8 M02
Р0З Soap 25 7 M03
P04 Toothpaste 65 4 M04
P05 Soap 38 5 M05
Р06 Shampoo 245 6 M05
TABLE:BRAND
BID BName
M02 Dant Kanti
M03 Medimix
M04 Pepsodent
M05 Dove
Write SQL queries for the following:
i. Display product name and brand name from the tables PRODUCT and BRAND.
ii. Display the structure of the table PRODUCT.
iii. Display the average rating of Medimix and Dove brands.
iv. Display the name, price, and rating of products in descending order of rating
(OR)
Consider the table ORDERS as given below

Note: The table contains many more records than shown here.

A) Write the outputs of following queries:


(I) SELECT C_Name, Quantity as Total_Quantity from ORDERS where quantity <5;
(II) SELECT * FROM ORDERS ORDER BY PRICE ;
(III) SELECT DISTINCT C_Name from ORDERS;
(IV) SELECT MAX(PRICE) FROM ORDERS;
33 Vedansh is a Python programmer working in a school. For the Annual Sports Event, he has 4
created a csv file named [Link], to store the results of students in different sports events.
The structure of [Link] is:
[St_Id, St_Name, Game_Name, Result]
Where
St_Id is Student ID (integer)
ST_name is Student Name (string)
Game_Name is name of game in which student is participating (string).
Result is result of the game whose value can be either 'Won','Lost' or 'Tie'.
For efficiently maintaining data of the event, Vedansh wants to write the following user
defined functions:
Accept - to accept a record from the user and add it to the file
[Link]. The column headings should also be added on top of the cs file.
wonCount - to count the number of students who have won any event.
As a Python expert, help him complete the task.
34 Consider the table Personal given below: 4
Table: Personal
P_ID Name Desig Salary Allowance
P01 Rohit Manager 89000 4800
P02 Kashish Clerk NULL 1600
P03 Mahesh Superviser 48000 NULL
P04 Salil Clerk 31000 1900
P05 Ravina Superviser NULL 2100

Based on the given table, write SQL queries for the following:
i. Increase the salary by 5% of personals whose allowance is known.
ii. Display Name and Total Salary (sum of Salary and Allowance) of all personals. The
column heading 'Total Salary' should also be displayed.
iii. Delete the record of Supervisors who have salary greater than 25000.
iv. (A) To display average of salary from the table personal designation wise.
(OR)
(B) To Display designation and sum of salary designation wise
35 Kabir wants to write a program in Python to insert the following record in the table named 4
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 Python and MySQL:
• Username - root
• Password - tiger
• Host - localhost
The values of fields rno, name, DOB and fee has to be accepted from the user. Help Kabir to
write the program in python. The function should also display all records in the table.
SECTION-E
36 A Binary file, [Link] has the following structure 2+3
[MNO,MNAME,MTYPE]
Where
• MNO - Movie Number
• MNAME - Movie Name
• MTYPE is Movie Type
(i) Write a user defined function to insert details of movies in the binary file [Link]
(ii)Write a user defined function, findType(mtype), that accepts mtype as parameter and
displays all the records from the binary file [Link], that have the value of Movie
Type as mtype.
37 Meticulous EduServe is an educational organization. It is planning to setup its India campus at 5
Chennai with its head office at Delhi.
The Chennai campus has 4 main buildings - ADMIN, ENGINEERING, BUSINESS and
MEDIA.

DELHI CHENNAI
Head Office Campus
ADMIN ENGINEERING

BUSINESS MEDIA

Block to Block distances (in Mtrs.)

From To Distance
ADMIN ENGINEERING 55 m
ADMIN BUSINESS 90 m
ADMIN MEDIA 50 m
ENGINEERING BUSINESS 55 m
ENGINEERING MEDIA 50 m
BUSINESS MEDIA 45 m
DELHI HEAD OFFICE CHENNAI CAMPUS 2175 km

Number of computers in each of the blocks/Center is as follows:


ADMIN 110
ENGINEERING 75
BUSINESS 40
MEDIA 12
DELHI HEAD 20

i. Suggest and draw the cable layout to efficiently connect various blocks of buildings
connecting the digital devices.
ii. Which network device will be used to connect computers in each block to form a local area
network.
iii. Which block, in Chennai Campus should be made the server? Justify your answer.
[Link] fast and very effective wireless transmission medium should preferably be used to
connect the head office at DELHI to the campus in CHENNAI?
v. (A)Suggest a device/software to be installed in the CHENNAI Campus to take care of data
security.
(OR)
(B) What type of network (PAN, LAN, MAN, or WAN) will be set up
among the computers connected in the CHENNAI campus?
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER-3
2025-26

ककककक CLASS: XII ककक TIME:03 HOURS


कककक SUBJECT: COMPUTER SCIENCE कककककक ककक Maximum Marks: 70
General 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 case of MCQ, text of the correct answer should also be written.
Q. No. Section – A (21 x 1 = 21 Marks) Marks
1 State True or False:
1
An exception(error) in Python will stop the program from executing further unless it is handled.
2 Identify the output of the following code snippet:
text = "Kendriya Vidyalaya"
text = text[1:].upper() + text[0].lower()
text = [Link]('A', '@').replace('C', '3') 1
print(text)
A. ENDRIY@ VIDY@L@Y@ B. KENDRIY@ VIDY@L@Y@
C. END@IY@ VIDY@L@Y@ D. KENDRIYA VIDYALAYA
3 Evaluate the following expression
print(10 + 3 * 2**3 // 4 - 5 or 7 and 9) 1
A. 9 B. 11 C. 15 D. 7
4 Given the following table structure, how many candidate keys can be identified?
ProductID ProductName Price Stock
1 Laptop 800 20
2 Mouse 20 100 1
3 Keyboard 30 80
A. 1 B. 2
C. 3 D. 4
5 What will be the output of the following code snippet?
string = "PROGRAMMING" 1
print(string[3:10:2])
6 What will be the output of the following code?
tup = (10)
print(tup * 4) 1
A. (10, 10, 10, 10)) B. (40)
C. (10) D. (40,)
7 What will be the output of the following code?
my_dict = {'x': 5, 'y': 10}
my_dict['z'] *= 2 1
A. {'x': 5, 'y': 10, 'z': 0} B. KeyError
C. {'x': 5, 'y': 10} {'x': 5, 'y': 10} D. TypeError

[1]
8 Consider the given SQL Query:
SELECT department, COUNT(*) FROM employees GROUP BY department; 1
What is the purpose of this SQL statement.
9 What will be the output of the following Python code?
try:
x = int("str")
inv = 1 / x

except ValueError: 1
print ("Not Valid!")

except ZeroDivisionError:
print ("Zero has no inverse!")
a) Division by zero error! b) Some other error! c) Not Valid! d) Zero has no inverse!
10 What is the output of the expression?
string = "LearnPython123"
string = [Link]('1', 'One').replace('2', 'Two')
result = string[2:] + string[:2] 1
print(result)
A. arnPythonOne23Le B. arnPythonOneTwo3Le
C. arnPythonOneTwo23Le D. arnPython123Le
11 What will be the output after the following statements?
import random as rd
print([Link](4,7))
a) A random float value between 4 and 7, including 4 and 7 1
b) A random float value between 4 and 7, excluding 4 and 7
c) A random integer value between 4 and 7, excluding 4 and 7
d) A random integer value between 4 and 7, including 4 and 7
12 What will be the output of the following code?
x=5
def multiply():
global x
x *= 2
print(x, end='!')
1
multiply()
x = 10
print(x)
A. 10!10 B. 10!20
C. 20!10 D. 20!20
13 A table has initially 6 columns and 12 rows. Consider the following sequence of operations
performed on the table –
i. 4 rows are added
ii. 2 columns are added
iii. 5 rows are deleted 1
iv. 3 columns are deleted
What will be the cardinality and degree of the table at the end of the above operations?
A. 8, 4 B. 10, 5
C. 6, 8 D. 8, 10

[2]
14 Predict the output of the following code fragments:
c=0
for x in range(10):
for y in range(5): 1
c += 1
print (c)
A. 50 B.40 C.70 D. 60
15 Which function is used to count the number of rows in a table?
A. total() B. count() 1
C. rows() D. sum()
16 Which SQL function is used to find the maximum value in a column?
A. MAXIMUM() B. highest() 1
C. MAX() D. greatest()
17 The __________ is a protocol used to send emails from a client to a server.
A. POP3 B. IMAP 1
C. SMTP D. HTTP
18 Unique physical address of each NIC card is called __________.
A. IP address B. MAC address 1
C. HOME address D. STATIC address
19 The device used to connect different networks and route data between them is known as a
_________.
1
A) Hub B) Switch
C) Router D) Repeater
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 Consider the following code:
y = 10
def update():
global y
y *= 5 1
print(y)
update()
Assertion (A): 50 will be the output of above code.
Reason (R): Because the variable y used inside the function update() is of global scope.
21 Assertion (A): The GROUP BY clause in SQL is used to group rows that have the same values
in specified columns. 1
Reasoning (R): The GROUP BY clause is used to filter rows before the result set is returned.
Q. No. Section – B (7 x 2 = 14 Marks) Marks
22 Explain any two of the following operators with examples 2
A. Comparison operators

OR
B. Arithemetic Operators

[3]
23 The code provided below is intended to find the factorial of a given number. However, there are 2
syntax and logical errors in the code. Rewrite it after removing all errors. Underline all the
corrections made.
define factorial(n)
result = 1
for i in range(1, n+1):
result * = i
return result
print("Factorial of 5 is"factorial(5))
24 A) Write the Python state ment for each of the following tasks using BUILT-IN 2
functions/methods only:
(i) To convert a first letter of each word of string named text to uppercase.
( ii) To find the length of a list named items
(OR)
B) Write the python statement to import the required module and (using built-in function) to
perform following tasks
(i) To calculate the square root of a variable named number
(ii) To generate a random integer between 1 and 100

25 Write a function char_count(text) that takes a string as input and returns a dictionary where the 2
keys are the unique characters from the string and the values are the number of times each
character appears. For example, if the input is "hello", the function should return {'h': 1, 'e': 1,
'l': 2, 'o': 1}.
OR
Define a function find_largest(lst) that takes a list of numbers as input and returns the largest
number in the list.
26 Predict the correct output of the following code. Also write the minimum and the maximum 2
possible values of the variable b.
import random
text = "Learn Python and explore new opportunities"
words = [Link]()
n = [Link](2, 5)
for i in range(n):
print(words[i][1], end='-')
27 (I) 2
A) What type of constraint is used to ensure that a value in a column must be unique across all
rows in a table?
B) Which SQL keyword is used to remove a constraint from an existing table?
(OR)
II)
A) Write an SQL command to modify the data type of the column "phone_number" to
VARCHAR(15) in the employee table.
B) Write an SQL command to rename the column "address" to "location" in the employee table.
28 (I)Differentiate between HTML and XML. 2
OR
(II)
A. Expand the following:
(i) DNS (ii) HTTP
B. Give one advantage of using a Star topology.
Q. No. Section – C (3 x 3 = 9 Marks) Marks

[4]
29 Write a Python function that counts and displays the number of words in a text file called
"[Link]".
OR 3
Write a Python function that reads a text file "[Link]" and displays all the lines that contain
the word "success".
30 You have a list BookList where each element represents a book record in the format
Title,Author,PagesTitle, Author, PagesTitle,Author,Pages.
Write Python functions to operate on the stack FavBooks.
(i) Push_element(BookList, FavBooks): Push the titles and authors of the books that have more
than 300 pages onto the stack. 3
(ii) Pop_element(FavBooks): Pop and display the titles until the stack is empty, then print
"Stack Empty".
(iii) peek(FavBooks): This function displays the topmost element of the stack without deleting
it. If the stack is empty, the function should display 'None'.
31 Predict the output of the following code:
data = {"cat": 3, "dog": 5, "bird": 2, "cat": 7}
result_str = ""
for key, value in [Link]():
result_str += str(key) + ":" + str(value) + " "
result_str = result_str.strip()
print(result_str)
OR
Predict the output of the following code: 3
values = [5, 2, 8]
for i in values:
for j in range(1, i + 1):
if j > 3:
print(j, '#', end=" ")
else:
print(j, '*', end=" ")
print()
Q. No. Section – D (4 x 4 = 16 Marks) Marks

[5]
32 Riya is responsible for maintaining the Student Records Database. She needs to access some 4
information from the STUDENTS table for an upcoming report. Help her extract the following
information by writing the desired SQL queries as mentioned below.

Student_ID Name Course Enrollment_Date Marks City


1001 Priya Computer Science 2022-07-15 85 Mumbai
1002 Aman Business 2021-08-20 78 Delhi
1003 Neha Arts 2023-01-05 92 Bangalore
1004 Rohan Engineering 2020-11-12 88 Chennai
1005 Anaya Medical 2022-03-18 73 Hyderabad

A)
Write the output of the following queries:
(I) SELECT Course, COUNT(Student_ID) AS Total_Students FROM Students GROUP BY
Course;
(II) SELECT Name, City FROM Students WHERE City LIKE 'B%';
(III) SELECT Student_ID, Name, Enrollment_Date FROM Students ORDER BY
Enrollment_Date ASC;
(IV) SELECT Name, Marks FROM Students WHERE Marks > (SELECT AVG(Marks) FROM
Students);
OR
B) Write the following queries:
(I) To display the average marks of students in each course.
(II) To display students who enrolled after January 1, 2022.
(III) To display the details of students sorted by their marks in ascending order while
calculating a 5% scholarship for each student and displaying the total marks (marks +
scholarship) as Total_Marks_With_Scholarship.
(IV) To find the students whose city is either Mumbai or Chennai.

33 A CSV file "[Link]" contains the data collected from various weather stations. Each
record in the file includes the following data:Name of the city

 Average temperature (in Celsius)


 Humidity percentage
 Rainfall (in millimeters)
 For example, a sample record in the file might look like: ['Rainford', 32, 75, 120] 4
Write the following Python functions to perform the specified operations on this file:

1. Read all the data from the file in the form of a list and display all those records where
the average temperature is above 30 degrees Celsius.
2. Calculate and display the average rainfall across all records in the file.

[6]
34 Write the outputs of the SQL queries (a) to (d) based on the relations Teacher and Placement
given below:

a) Write an SQL query to calculate the average salary of teachers in each department
b) Write an SQL query to find the maximum and minimum dates of joining for teachers in
the Teacher table.
c) Write an SQL query to retrieve the names, salaries, departments, and placement
locations of teachers who earn more than 20,000.
d) i) Write a SQL query to list the names and placement locations of female teachers.
OR

ii)Write a SQL query to count the number of female teachers in each department
35 Sonia wants to write a program in Python to display some records from the MOVIES table of
the ENTERTAINMENT database. The MySQL server is running on LOCALHOST and the
login credentials are as follows:
Host: localhost
Username: root
Password: entertainment
The columns of the MOVIES table are described below: 4
● movie_id (Movie ID) – integer
● title (Movie Title) – string
● release_year (Release Year) – integer
● rating (Rating) – float
● box_office (Box Office Earnings) – float
Help her write a program to display the titles of movies that have a rating greater than 8.0.
Q. No. Section – E (2 x 5 = 10 Marks) Marks
36 Consider a binary file [Link] containing a dictionary with multiple elements. Each 2+3
element is in the form
PID:[PNAME, CATEGORY, PRICE] as a key pair where:
● PID – Product ID
● PNAME – Product Name
● CATEGORY – Product Category
● PRICE – Product Price
(I) Write a function to input the data of a product and append it to the binary file.
(II) Write a user-defined function, find_products(price), that accepts a price value as a
parameter and displays all records from the binary file [Link] where the product's
price is less than the price value passed as a parameter.

[7]
37 ABC Educational Institute has a campus in Mumbai with three blocks named A1, A2, and 5
A3. The tables below show the distances between different blocks and the number of computers
in each block.
Block A1 to A2 100m
Block A1 to A3 70m
Block A1 to A4 50m

Block Number of Computers


A1 150
A2 200
A3 250
The institute is planning to form a network by connecting these blocks.
i. Out of the three blocks on campus, suggest the location of the server that will provide the
best connectivity. Explain your response.
ii. For efficient connections between various blocks within the campus, suggest a suitable
topology and draw the same.
iii. Suggest the placement of the following devices with justification:
a. Repeater
b. Hub/Switch
iv. VoIP technology is to be used, which allows one to make voice calls using a broadband
internet connection. Expand the term VoIP.
v. A) The ABC Educational Institute intends to link its Mumbai and Pune centres. Out of LAN,
MAN, or WAN, what kind of network will be created? Justify your answer.
OR
A) Which hardware device will you suggest to connect all the computers within each building?

[8]
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2025-26
कक्षा CLASS: XII समय TIME:03 HOURS
विषयSUBJECT: COMPUTER SCIENCE अधिकतमअं कMAX. MARKS: 70
General 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-case of MCQ, text of the correct answer should also be written.

QNO SECTION-A (21x1=21 Marks) Marks


1 Which of the following is a keyword in Python? 1
a) true b) For c) pre-board d) False
2 What is printed by the following statements? 1
ANIMAL={"dog":10,"tiger":5,"elephant":15,"Cow":3}
print("Tiger" not in ANIMAL)
a) True b)False c)Error d) None
3 What will be the output for the following Python statement? 1
print(20//3*2+(35//7.0))
a) 17.0 b) 17 c) 8.5 d) 8
4 The SQL command that deletes the contents with the structure of the table. 1
(a) ALTER (b) DELETE (c) DROP (d) REMOVE
5 Consider the following statements and choose the correct output from the given options : 1
EXAM="COMPUTER SCIENCE"
print(EXAM[:12:-2])
a) EN b) CI c )SCIENCE d) ENCE
6 Select the correct output of the code: 1
for i in "QUITE":
print([Link](), end="#")
a. q#u#i#t# b. quite# c. quite d. q#u#i#t#e#
7 State whether the following statement is TRUE or FALSE : 1
The value of the expression 4/3*(2-1) and 4/(3*(2-1)) is the same
8 All aggregate functions except ignore null values in their input collection. 1
(a) Count(attribute) (b) Count(*) (c) Avg (d) Sum

9 State whether the following statement is True or False: 1


try catch block is used to handle exceptions in Python .
10 What will be the output of the following code ? 1
Tuple1=(10,)
Tuple2=Tuple1*2
print(Tuple2)
a) 20 b) (20,)c) (10,10) d) Error
11 What possible output is expected to be displayed on screen at the time of execution of the 1
program from the following code?
import random
AR=[20,30,40,50,60,70]
FROM=[Link](1,3)
TO=[Link](2,4)
for K in range(FROM,TO+1):
print(AR[K],end=”#“ )

(i)10#40#70# (ii)30#40#50# (iii)50#60#70# (iv)40#50#70#

12 Which of the following function header is correct? 1


a) def fun(a=1,b):
b) def fun(a=1,b,c=2):
c) def fun(a=1,b=1,c=2):
d) def fun(a=1,b=1,c=2,d):
13 The structure of the table/relation can be displayed using __________ command. 1
(a) view (b) select (c) show (d) describe
14 What will the following code display? 1
name = “Neha”
print(type (name))
(a) Invalid function <type>
(b) <class ‘str’>
(c) <class ‘int’>
(d) <class ‘float’>
15 Which of the following constraint is used to prevent a duplicate value in a record? 1
(a) Empty (b) check (c) unique (d) not null
16 ________________is a candidate key which is not selected as a primary key. 1
a. Primary Key b. Foreign Key c. Candidate Key d. Alternate Key
17 Which of the following is NOT a guided communication medium? 1
a) Twisted pair cable b) Microwave
c) Coaxial cable d) Optical fiber
18 Select the network device from the following, which connects, networks with different protocols 1
a) Bridge b)Gateway c)Hub d) Router
19 What is “ C “ stands in TCP/IP ? 1
a) Common b) Centre c)Control d) Coordinate
Q20 and 21 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A 4
(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):-The default arguments can be skipped in the function call. 1
Reason (R):-The function argument will take the default values even if the values are not
supplied in the function call
21 Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses. 1
Reasoning (R): WHERE and HAVING clauses are used to check conditions, therefore, these can
be used interchangeably
SECTION-B (2x7=14 Marks)
22 Predict the output of the following code: 2
lst=[2,4,6,8,10]
for i in range(1,5):
lst[i-1]=lst[i]
for i in range(0,5):
print(lst[i],end=' ')
OR
Find and write the output of the following python code:
x = "abcadeafa"
i = "a"
while i in x:
print(i, end = "@")
23 Rahul has written a code to input a number and return its reverse. His code is having errors. 2
Rewrite the correct code and underline the corrections made.
def reverse()
n=int(input("Enter number::’)
rev=0
while(num>0):
r=num%10
rev=rev*10+r
num=num//10
return rev

24 If M=”ANIL KUMAR” and N = “KIRAN KUMAR” 2


i)
A) Write a Python statement to check whether both the strings have same length or not.
B) Write a string slice statement to print substring “KUMAR” from string M
OR
ii)
A) Write a Python statement to check whether both the strings are same or not.
B) Write a Python statement to check whether string N have only upper case alphabets or not.

25 A. Write a function add_element() in Python that accepts a list L and a number n. If the number n 2
exists in the list, it should print “Element already exists”. If it does not exist, add the element at
the end of the list.
OR
B. Write a Python function update_contact() that accepts a dictionary phone_book, a name, and a
phone number. The function should add the name and phone number to the dictionary and if the
name already exists, update the existing contact.
26 (A) Given is a Python string declaration: 2
myexam="RussiaUkrain"
Write the output of :
print(myexam[-2:2:-2])

(B) Write the output of the code given below:


D1={"sname":"Aman","age":26}
D1['age']=27
D1['address']="Delhi"
print([Link]())
27 A) Satheesh has created a database “school” and table “student” and help him to write SQL 2
queries for the following
i) To view all the databases. .
ii) To view the structure of the table student.
OR
B)
i) To add the new column PhoneNo of datatype integer to the table student
ii) To find the cardinality of the table student.
28 Define the following terms 2
A) (i) PPP (ii) SMTP
OR
B) (i) VoIP (ii) TCP/IP
SECTION-C(3X3=9 Marks)
29 Write a function in Python to count the number of lines in a text fie ‘[Link]’ which start with 3
an alphabet ‘T’ .
OR
Write a function in Python that count the number of “can” words present in a text file
“[Link]” .
30 Thushar received a message(string) that has upper case and lower case alphabets. He want to 3
extract all the upper case letters separately .Help him to do his task by performing the
following user defined function in Python:
a) Push the upper case alphabets in the string into a STACK
b) Pop and display the content of the stack.
For example:
If the message is “All the Best for your Pre-board Examination”
The output should be : E P B A
c) Peek() -Display the top most element of the stack..

31 Predict the output of the following code: 3

D = {1: 'One', 2: 'Two', 3: 'Three'}


L=[]
for K, V in [Link]():
if V[0] == 'T':
[Link] (K)
print(L)
OR
Predict the output of the following code:

def Display(l):
L2=[]
for n in l:
if n % 2 ==0:
[Link](n)
return L2
print(Display([100, 228, 333, 432, 509, 60, 787, 800, 967]))

SECTION-D (4x4=16 Marks)


32 Consider the following table DOCTOR given below and write the output of the SQL Queries 4
that follows :
D_ID D_NAME D_DEPT GENDER EXPERIENCE
101 JOSEPH ENT MALE 10
104 GUPTA MEDICINE MALE 12
106 SUMAN ORTHO FEMALE 7
111 HANEEF ENT MALE 12
123 DEEPTI CARDIOLOGY FEMALE 6
132 VEENA SKIN FEMALE 12
i) SELECT D_NAME FROM DOCTOR WHERE GENDER=’MALE ‘AND
EXPERIENCE=12 ;
ii) SELECT DISTINCT(D_DEPT) FROM DOCTOR ;
iii) SELECT D_NAME , EXPERIENCE FROM DOCTOR ORDER BY EXPERIENCE ;
iv) SELECT COUNT(*) FROM DOCTOR WHERE GENDER=’MALE’;
OR
i) Write a query to how many doctors in each department
ii) Write a query to display the names of doctors who have more 10 Years experience.
iii) Write a query to display the details of Female Doctors.
iv) Write a query to change [Link] department to ENT
33 Rama is managing a student gradebook for a school, and the grade data is stored in a CSV file 4
named "[Link]". The student data consists the following data : Name, Subject, Grade
Help her to write the Python program using the csv module to read and update student grades.
Implement functionalities such as adding new grades, calculating average grades for each subject,
and generating individual progress reports.
34 Consider the table PRODUCT and CLIENT given below: 4
PRODUCT
PR_ID PR_NAME MANUFACTURER PRICE QTY
BS101 BATH SOAP PEARSE 45.00 25
SP210 SHAMPOO SUN SILK 320.00 10
SP235 SHAMPOO DOVE 455.00 15
BS120 BATH SOAP SANTOOR 36.00 10
TB310 TOOTH COLGATE 48.00 15
BRUSH
FW422 FACE WASH DETOL 66.00 10
BS145 BATH SOAP DOVE 38.00 20

CLIENT

C_ID C_NAME CITY PR_ID


01 DREAM COCHIN BS101
MART
02 SHOPRIX DELHI TB310
03 BIG BAZAR DELHI SP235
04 LIVE LIFE CHENNAI FW422

Write SQL Queries for the following:


i) Display the details of those clients whose city is DELHI
ii) Increase the Price of all Bath soap by 10
iii) Display the details of Products having the highest price
iv) A) Display the product name, price, client name and city with their corresponding
matching product Id.
OR
B) Display the cardinality of the cartesian join of product & client tables
35 4
Maya has created a table named BOOK in MYSQL database, LIBRARY to establish
connectivity between Python and MySQL: (Username – root, Password – writer,Host –
localhost.)

BNO(Book number )- integer


B_name(Name of the book) - string
Price (Price of one book) –intege
Help Maya to define following functions in python
AddData() - To input details of N Books and store it in the table BOOK
Disp() -To display the records of books whose price is more than 250.

SECTION-E (5 x 2 =10 Marks)

36 5
A binary file “[Link]” has structure [admission_number, Name, Percentage].

i) Write a function, ReadData(), that reads contents of N users and write to binary file
[Link]
ii) Write a function Show() in Python that would read contents of the file
“[Link]” and display the details of those students who score more than 90%
iii) Write a function countrec() in Python that should return no of students scored less
than 50%.
37 Oxford college, in Delhi is starting up the network between its different wings. There are four 5
Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as shown below:

The distance between various building is as follows:

ADMIN TO SENIOR 200 m


ADMIN TO JUNIOR 150 m
ADMIN TO HOSTEL 50 m
SENIOR TO JUNIOR 250 m
SENIOR TO HOSTEL 350 m
JUNIOR TO HOSTEL 350 m

Number of computer in each building is :


SENIOR 130
JUNIOR 80
ADMIN 160
HOSTEL 50

i) Suggest the cable layout of connections between the buildings.


ii) Suggest the most suitable place (i.e., building) to house the server of this college,
provide a suitable reason.
iii) Is there a requirement of a repeater in the given cable layout? Why/ Why not?
iv) Suggest the placement of hub/switch with justification.
v) A)The organisation also has inquiry office in another city about 50-60 km away in
hilly region. Suggest the suitable transmission media to interconnect to college and
inquiry office out of the following:
a. Fiber optic cable
b. Microwave
c. Radiowave
OR
B) The company wants to conduct an online video conference between employees of
the Patna andNew Delhi branches. Name the protocol which will be used to send voice
signals in this
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER 2025-26
कक्षा CLASS: XII समय TIME:03 HOURS
विषयSUBJECT: COMPUTER SCIENCE अधिकतमअं कMAX. MARKS: 70
General 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-case of MCQ, text of the correct answer should also be written.

[Link]. Section-A (21 x 1 = 21 Marks) Marks


1. State True of False 1
In Python, keys of a dictionary must be of mutable type
2. What would be the value of A in the following statement 1
A = "hello"+4+'4'
a) "hello44" b) "hello4+4" c) Raises Syntax Error d) None of these
3. The ____ operator tells if an element is present in a sequence or not. 1
a) exists b) inside c) in d) into
4. --------------data of MySql allocates fixed size of memory to a String type of column 1
a) VARCHAR b) CHAR c) STRING d) INTEGER
5. What type of value is return by the split() function when it is used on string value? 1
a) String b) Tuple c) List d) dictionary
6. What would be the output of the following code? 1
w=[10,20,30,40]
w[0],w[1],w[2],w[3]=w[1],w[0],w[3],w[2]
print(w)
a) [40,30,20,10] b) [30,20,40,10] c) [20,10,40,30] d) [10,30 20 ,40]
7. A Dictionary d={'sprint':'autumn','autumn':'fall','fall':'spring'} is created. Which of the 1
following statement prints output as fall
a) d['autumn'] b) d.'autumn' c) d['sprint'] d) d. 'sprint'
8. Identify the odd one out of the following. 1
a) AVG () b) COUNT() c) MIN() d) ROUND().
9. Exception handling has try block, except block and —------------------ 1
a) No such block b) end: c) final: d) finally:
10. Observe the following code 1
A=[]
B=[10]
[Link](B)
what the above code does?
a) it appends a value 10 to list A b) it appends a value 10 to list B
c) it makes list A as nested list d) None of these
11. Identify the correct output(s) of the following code. 1
import random
AR=[20,30,40,50,60,70];
FROM=[Link](1,3)
TO=[Link](2,4)
for K in range(FROM,TO+1):
print (AR[K],end="#")
(i) 10#40#70# (ii) 30#40#50# (iii)50#60#70# (iv) 40#50#70#
12. Predict the output of the following 1
def calculate(n1,n2=7):
n1=n1%n2
print(n1)
calculate(3%2,9%2)
a)1 b)0 c)2 d)3
13. SELECT * FROM EMP WHERE ENO=NULL; 1
a) Selects all employees whose employee number does not exist
b) Selects all employees with employee number
c) Select all employees with or without employee number
d) The select command raises error.
14. What is the output of the following code 1
T=(10,)
print(T*2)
a) Raises Error b) (20,) c) (10, 10) d) (20)
15. SQL data type that is suitable to store non-numerical data with efficient memory 1
usage.
a) CHAR b) VARCHAR c) CHARACTER d) INTEGER
16. Write SQL query to increase salaries of all employees by 10% to existing salary. 1
(Table name : EMP , column name : SAL)
17. TCP stands for 1
a) Transfer Control Protocl b) Transferred Control Protocol
c) Transmission Control Protocol d) Transmitted Control Protocol
18. A network device that connect dissimilar networks is-------- 1
a) Modem b) Switch c) Bridge d) Gateway
19. Which of the following is/are true in the case of IP address? 1
i) IP address can be used to trace the actual physical location of a device in the network.
ii) A printer connected to a network will also have an IP Address.
iii) Two devices can have same IP Address.
iv) The IP Address can be formed of any number.
a) Only 1 is trueb)Only 1 & 2 are truec) Options 1, 2 and 4 are true d). All are true.
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): Dictionary is an unordered collection of data values that stores the key value 1
pair.
Reason (R): Immutable means they cannot be changed after creation.
21. Assertion(A): SQL commands are classified into three categories namely DDL, DML and 1
TCL
Reason\(R) : INSERT and UPDATE commands are of DDL category as they define data that
is to be stored in the table.
[Link]. Section-B (7 x 2 = 14 Marks) Marks
22. A list named studentAge stores age of students of a class. Write the Python command to 2
import the required module and (using built-in function) to display the most common age
value from the given list
OR
Write the Python statement for each of the following tasks using BUILT-IN
functions/methods only:
(i) To insert an element 200 at the third position, in the list L1.
(ii) To check whether a string named, message ends with a full stop / period or not
23. Rewrite the following code after removing syntax error(s), if any, and underline each 2
correction made.
Tup = eval(enter("input a tuple"))
Ln = length(Tup)
Num = [Link](Tup[ 0 ])
if Num = Ln :
print("Tuple contains all the same elements. ")
else :
print("Tuple contains different elements. "
24. Let TUPLE T=('DELHI','HYDERABAD','CHENNAI','KERALA') 2
Write Python Statements for the following.
i) a) To print the reverse of the tuple.
b) Sort the tuple in descending order.
OR
ii) a) To print the city ‘DELHI’ from tuple T
b) To get the index of 'KERALA'
25. Write a function countNow(PLACES) in Python, that takes the dictionary, PLACES as an 2
argument and displays the names (in uppercase)of the places whose names are longer than 5
characters. For example, Consider the following dictionary
PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"} The output should be:
LONDON NEW YORK
OR
Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple
containing length of each word of a string. For example, if the string is "Come let us have
some fun", the tuple will have (4, 3, 2, 4, 4, 3)
26. Predict the output of the following code: 2
d = {"apple": 15, "banana": 7}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “, ”
str2 = str1[:-1]
print(str2)

27. i) a) Write any two important features of Foreign key 2


b) Write SQL command to remove the EMPLOYEE table entirely from the database.
OR
ii) a) Differentiate WHERE clause and HAVING clause which is used in SQL.
b)Write SQL Command to add NOT NULL constraint to column MobileNo of an
existing table named EMPLOYEE
28. a) Write any one advantage and disadvantage of Optical Fibre cable. 2
OR
b) What do you mean by PAN in Computer Networks
[Link]. Section-C (3 x 3 = 9 Marks) Marks
29. a) Write a program to read contents of a text file named [Link], count and display total 3
number of Upper Case alphabets exists.
OR
b) Assume a text file [Link] exists and write Python statements for the following.
i) move file pointer 20 bytes from beginning
ii) read 10 characters and display it
iii) display the current position of the file pointer
30. i) Windows operating system maintains a stack of jobs to be completed. Various jobs initiated 3
are maintained in the form of a list that contains the time in mille seconds to complete. For
example JOB=[90,15,25,30] are the time limits of four jobs initiated. Write the user defined
functions as per the following.
a) Pushjob(JobStack,JOB) – which pushes all the jobs from the list JOBS that can be
completed within 30 mille seconds of time
b) JobPop(JobStack) – pop out a job and display the job that has been popped out (completed
job). If the stack is already empty, the function should display "Underflow"
c) JobPeep(JobStack) – to display the top most job from the stack. If the stack is empty, the
function should display 'None'.
31. Predict output the following code 3
M=[10,20,30,40,50,60]
x=len(M)
for i in range(x-1,-1,-2):
M[i-1]=M[i]
for i in range(0,6):
print(M[i],end=' ')
OR
L = ["I", "am", "the", ["winner", "success"], "follows", "me", "it", "will"]
print(L[3:4])
print(L[3:4][0][1][2])
print([L[1]] + L[3])
[Link]. Section-D (4 x 4 = 16 Marks) Marks
32. Consider the following SQL table and write SQL Queries 4

TABLE : ROUTE
actyp
Routeid from busno Capacity enroll AnnFee
e
R1 ECIL TS09 AB1234 57 52 35000 NAC
R2 RAMPALLY AP22 B5687 52 52 58000 AC
R3 SECUNDERABAD KA04 X5874 24 20 35000 NAC
R4 BEGUMPET TS07AB5689 27 18 45000 AC
R5 ALWAL TS09 XF6352 46 40 32000 AC
R6 KOMPALLY TS01 AB4215 56 50 31000 AC
R7 BOWENPALLY TS08 H5555 50 50 33000 NAC
i)Display all routes with seating capacity either 52,24 or 48
ii)Display all routes running with AC type of buses
iii)Display number of buses of non ac type.
iv) Display busno,capacity of all buses running from Secunderabad.
OR

Write the output of the following queries.


i) SELECT FROM,BUSNO,ANNFEE/12 FROM ROUTE;
ii) SELECT FROM,BUSNO,CAPACITY FROM ROUTE WHERE BUSNO LIKE ‘KA%’;
iii) SELECT COUNT(DISTINCT ACTYPE) FROM ROUTE;
iv)SELECT AVG(ANNFEE) FROM ROUTE WHERE ANNFEE <35000;
33. A mobile store “SANGEET” has a CSV file named [Link]. Each record of the 4
file contains the following data
[Brand, Model, RAM, ROM,Price]
For example [SAMSUNG, A20,8GB,520GB,32000]
Write the following Python functions to perform the specified operations on
this file:
(i) Read all the data from the file in the form of a list and display all those records for which
price is more than 50000.
(ii) Count the number of records in the file belongs to Apple Brand.
34. Consider the following PATIENT and ADMISSION tables. 4

Table: PATIENT Table: ADMISSION


pid pname city Pcat room type cat pid
P01 PAWAN HYD OPD 201 SPECIAL AC P05
P02 KEERTI DLH IN-P 103 SHARE AC P02
P03 MAYURI MUM IN-P 208 GENERAL NAC P03
P04 CHARAN BNG OPD
P05 ESHWAR PUN IN-P
Write SQL Queries for the following.
i) Display all patients who got admitted in special ward
ii) Display patient category and number of patients exist for each patient type.
iii) Display patient name, category of all patients who live in HYD city.
iv) a) To add a new row in Patient table with (P06,SHYAM,CHN,OPD)
OR
iv) b) To set Pcat value as NULL to all patients whose category is IN-P
35. A table, named STAFF, in KVSRO database, has the following Structure 4
Field Data tye
name
empno int(5)
ename Varchar(20)
desig Varchar(20)
presentkv Varchar(20)
subject Varchar(20)
Write the following Python function to perform the specified operation:
GestStaffList(): To input one staff member details and add it to MySql table named SAFF. It
also should display all staff members whose designation is PGT and subject is Computer
Science.
Assume the following for Python-Database connectivity:
Host: localhost, User: root, Password: kvsro
[Link]. Section-E (5 x 2 = 10 Marks) Marks
36. Your School is maintaining entire school students’ data in a binary file named 5
[Link] in which each student data is stored in the form of a list as [admission no,
class, sec, rollno, name, gender]. Being a computer science student help your school by
writing user defined functions for the following.
i) NewAdmisison() which inputs one student data and appends to binary file.
ii) ClassList() which inputs student’s class and section and displays all the students
of that particular class and section.
iii) Backup2023() which reads all students who has admission number between 5000 to 8000
and stores in a separate file named [Link].
37. Osmania University in Hyderabad as Four blocks named Arts, Science Law and Admin. 5
Distances between blocks and no. of computers available in each block is as following.

Distance between blocks [Link] computers


From To distance Block [Link] Computers
Admin Science 200 mts Admin 125
Arts Law 80 mts Science 60
Admin Arts 50 mts Arts 96
Law Science 40 mts Law 50
You, as a network expert, need to suggest the best network-related solutions for them to
resolve the issues/problems mentioned in points (I) to (V), keeping in mind the distances
between various blocks/buildings and other given parameters.
i) Suggest the most appropriate location/block to host the server with justification.
ii) At present, the university is using Hub to connect computers at each block. Do you suggest
continuing with the same or any other new device? Justify.
Iii) University wants to have high speed data transmission. Which guided transmission
medium you suggest?
iv) Name the device/software to be installed to prevent unauthorised into University’s
network from any outside network.
v) a) What type of network is formed in this University campus?
OR
b) A professor would like to connect his Laptop to the University’s Network
through the Ethernet Cable, but unable to do it? What could be the problem
in his /her laptop?
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2025-26
कक्शाCLASS XII समय TIME :3 HRS
विशय SUBJECT: COMPUTER SCIENCE(083) अविथ्तम अं क Maximum Marks: 70
General 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 case of MCQ, text of the correct answer should also be written.

प्र.सं Question अंक


Q No. Section-A (21 x 1 = 21 Marks) Marks
State True or False:
1. “In a Python program, if a break statement is given in a nested loop, it (1)
terminates the execution of all loops in one go.”
Identify the output of the following code snippet:
2. subject='computer science' (1)
print(subject. title())
(A)Computer science (B) Computer Science
(C) COMPUTER SCIENCE (D) computer science
Consider the given expression:
3. not True and False or True (1)
Which of the following will be correct output if the given expression is evaluated?
(A) True (B)False (C) NONE (D) NULL
Which of the following statements is FALSE about keys in a relational (1)
4. database?
(A) Any candidate key is eligible to become a primary key.
(B) A primary key uniquely identifies the tuples in a relation.
(C) A candidate key that is not a primary key is a foreign key.
(D) A foreign key is an attribute whose value is derived from the
primary key of another relation.
What will be the output of the following code? (1)
5.
msg= "foundation"
print(msg[1:7:2])
What will be the output of the following code?
6. tp1=(2,4,3)
tp3=tp1*2 (1)
print(tp3)
(A) (4,8,6) (B) (2,4,3,2,4,3) (C) (2,2,4,4,3,3) (D) Error
Page: 1/8
What will be the output of the following code fragment? (1)
7.
dict={"jo":1,"ra":2}
[Link]({"ph":2})
print(dict)
(A) {“jo”:1, “ra”:2,”ph”:2} (B) {“jo”:1,”ra”:2} (C) {“jo”:1,”ph”:2}(D) Error
In MYSQL database, if a table, Alpha has degree 5 and cardinality 3, and another
8. table, Beta has degree 3 and cardinality 5, what will be the degree and cardinality of (1)
the Cartesian product of Alpha and Beta?
(A) 5,3 (B) 8,15 (C) 3,5 (D)15,8
What is the output of the expression?
9.
txt = “I enjoy working in Python” (1)
print=([Link](“enjoy”))
(A) (‘I enjoy’ , ‘working’, ‘in Python’) (B) (‘I’ , ‘enjoy’ , ‘working in Python’)
(B) (‘I enjoy’ , ‘working’, ‘in Python’) (D) ( I enjoy working in Python)
State whether the following statement is True or False: (1)
10.
An exception may be raised even if the program is syntactically correct
Identify the correct output(s) of the following code. (1)
11. import random
signal= [‘RED’,’YELLOW’,’GREEN’]
for k in range (2, 0,-1):
R=[Link](k)
print(signal[R], end=’#’)
A)RED#GREEN# B) YELLOW#GREEN#
C) YELLOW # RED # D) GREEN#RED#
What is the scope of the variable defined outside the function
12. (1)
(A) LOCAL (B) GLOBAL (C) MODULE (D) FUNCTION

13. Which command is used to remove a relation from an SQL? (1)


(A) Drop table (B) Delete (C) Purge (D) Remove
Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?
14.
(A) 5 (B) 4 (C) None (D)Error (1)

Which of the following is not a data type in MYSQL?


15. (1)
(A) List (B) Varchar (C) Char (D) date
What SQL statement do we use to display the record of all students whose last
16. name contains 5 letters ending with “A”? (1)
a) SELECT * FROM STUDENTS WHERE LNAME LIKE ‘_ _ _ _A’;
b) SELECT * FROM STUDENTS WHERE LNAME LIKE ‘ _ _ _ _ _’;
c) SELECT * FROM STUDENTS WHERE LNAME LIKE ‘ ????A’;
d) SELECT * FROM STUDENTS WHERE LNAME LIKE ‘*A’;
Which protocol is commonly used to retrieve email from a mail server?
17 (A) FTP (B) IMAP (C) HTML (D) TELNET (1)
The protocol suit that is the main communication protocol over the internet (1)
18.
(A) HTTP (B) FTP (C) TCP/IP (D)PPP
Which switching technique is a network configuration that establishes a physical (1)
19.
path between two endpoints for the duration of a connection

Page: 2/8
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

Assertion(A): Python standard library consists of number of modules. (1)


20. Reasoning(R): A function in a module is used to simplify the code and
avoids repetition.
Assertion. SQL SELECT's GROUP BY clause is used to divide the result in
21. groups.
(1)
Reason. The GROUP BY clause combines all those records that have identical
values in a particular field or in group by fields.

Q No Section-B ( 7 x 2=14 Marks) Marks


How is a mutable object different from an immutable object in Python? (2)
22. Explain with an example?
OR
What is the difference between default arguments and keyword arguments? Explain
with an example code
Observe the following code carefully and rewrite it after (2)
23. removing all syntax and logical errors.
n=int(input("Enter number:"))
temp=n
rev=0
While(n>0):
dig=n%10
rev==rev*10+dig
n=n//10
if(temp=rev):
print("The number is a palindrome!")
else
print("The number isn't a palindrome!")
Consider the following list myList.
24. (2)
myList = [10,20,30,40,60,80,30,50,40,90]
(Answer using built in functions only)
(I)A) Write statement to count the number of elements in the list myList
B) Write a statement to count the occurrences of 40 in myList
OR
(II)A) Write a statement to remove last element of the list myList.
B) Write a statement to create a shallow copy of the list myList
25 Write a function letter_count(lst) that takes a list of string and returns a dictionary
where the keys are the letters from lst and the values are the number of times that letter
appears in the lst. For example: if the passed list, lst is : lst=list(“apple”) Then it
should return a dictionary as {‘a’:1,’p’:2,’l’:1,’e’:1}

OR

Page: 3/8
Write a function max_length( ) ,that takes a list of string as argument and display the
longest string from the list.
Predict the output of the Python code given below:
26. for i in x: (2)
if str[i].isupper():
text+=str[i]
elif str[i].islower():
text+=str[i+1]
else:
text+='@'
print(text)
(2)
27. A) What constraint should be applied on a table column so that duplicate values
and NULL values are not allowed.
B) Write an SQL command to remove the Primary Key constraint from a table,
named student admno is the primary key of the table.
OR
A) What constraint should be applied on a table column so that NULL is
allowed in that column, but duplicate values are not allowed.
B) Write an SQL command to make the column empno as the Primary Key of an
already existing table, named Teacher.

28. (A) Write the difference between Message Switching and Packet Switching?
(2)
OR
(B) What is Star Topology? Explain the advantages of Star Topology.

Q No. Section-C ( 3 x 3 = 9 Marks) Marks


(A) Write a Python function that displays all the lines containing the words (3)
29.
“you/YOU” from a text file "[Link]"

OR
(B)Write a program to get roll numbers, names and marks of the students of a class
and store these details in a file called “[Link]”.

A ) list, NList contains following record as list elements: (3)


30. [City, Country, distance from Delhi]
Each of these records are nested together to form a nested list. Write the following
user defined functions in Python to perform the specified operations on the stack
named travel.
• Push_element(NList): It takes the nested list as an argument and pushes a list object
containing name of the city and country, which are not in India and distance is less
than
3500 km from Delhi.
• Pop_element(): It pops the objects from the stack and displays them. Also, the
function should display “Stack Empty” when there are no elements in the stack.

Page: 4/8
Predict the output of the following code: (3)
31. d = {"mango": 15, "banana": 7, "apple": 9}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2)
OR
Predict the output of the following code:
dct={}
dct[1]=1
dct[‘1’]=2
dct[1.0]=4
sum=0
for k in dct:
print(k, sum)
Sum += dct[k]
Print (sum)

Q No. Section-D ( 4 x 4 = 16 Marks) Marks

Consider the following table CLUB . (4)


32.
COACH ID COACH NAME AGE SPORTS DATEAPP PAY SEX
1 KUKREJA 35 KARATE 27/03/1996 1000 M
2 RAVINA 34 KARATE 20/01/1998 1200 F
3 KARAN 34 SQUASH 19/02/1998 2000 M
4 TARUN 33 BASKETB 31/01/1998 1500 M
ALL

(A) Write the output of the following SQL statements:


(i)SELECT COUNT (DISTINCT SPORTS) FROM Club;
(ii) SELECT MIN(Age) FROM CLUB WHERE Sex=’F’;
(iii) SELECT AVG(Pay) FROM CLUB WHERE Sports = ‘KARATE’
(iv) SELECT SUM(Pay) FROM CLUB WHERE Datofapp >’31/01/98’;
OR
(B) Write the queries for the following :
(i) To display the minimum salary and maximum salary from the table club
(ii) To display the sum of total salary for male and female employees separately
(iii) To display the distinct sport name from the table club
(iv)To display the club table sorted by age in descending order

Rohit, a student of class 12, is learning CSV File Module in Python. During (4)
33.
examination, he has been assigned an incomplete python code (shown below) to
create a CSV File '[Link]' (content shown below). Help him in completing the
code which creates the desired CSV File.

CSV FILE
1,AKSHAY,XII,A
2,ABHISHEK,XII,A
3,ARAVIND,XII,A
4,RAVI,XII,A
5,ASHISH,XII,A

Page: 5/8
Incomplete Code
import csv
fh = open(_____, _____, newline='') #Statement-1
stuwriter = csv._____ #Statement-2
data = [ ]
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
[Link](header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ")
rec = [roll_no,name,Class,section ]
[Link](_____) #Statement-3
stuwriter. _____ (data) #Statement-4
[Link]()
Consider the tables PRODUCT and BRAND given below: (4)
34
Table: PRODUCT
PCode PName UPrice Rating BID
P01 Shampoo 120 6 M03
P02 Toothpaste 54 8 M02
P03 Soap 25 7 M03
P04 Toothpaste 65 4 M04
P05 Soap 38 5 M05
P06 Shampoo 245 6 M05

Table : Brand
BID BName

M02 Dant Kanti

M03 Medimix

M04 Pepsodent

M05 Dove

Write SQL queries for the following:


(i) Display product name and brand name from the tables PRODUCT and
BRAND.
(ii) Display the structure of the table PRODUCT.
(iii) Display the average rating of Medimix and Dove brands
(iv) (A) Display the name, price, and rating of products in descending order of
rating.
OR
(B) Display the cartesian product of these two tables

Page: 6/8
A table, named ITEMS, in ITEMDB database, has the following structure: (4)
35
Itemno-int(11)
Itemname varchar(15)
Price float
Qty int(11)
Write the following Python function to perform the specified operation:
AddAndDisplay(): To input details of an item and store it in the table ITEMS. The
function should then retrieve and display all records from the ITEMS table where
the Price is greater than 120.
Assume the following for Python-Database connectivity: Host: localhost, User:
root, Password: Pencil
SECTION E (2 X 5 = 10 Marks) Marks
[Link].

Mayank is a manager working in a retail agency. He needs to manage the records (5)
36.
of various customers. For this, he wants the following information of each
candidate to be stored:
- Customer_ID – integer
- Customer_Name – string
- Address – string
- Receipt no-integer
You, as a programmer of the company, have been assigned to do this job for
Mayank.
(I) Write a function to input the data of a customers and append it in a
binary file.
(II) Write a function to update the data of customers whose receipt no is 101
and change their address to "Secunderabad".
(III)Write a function to read the data from the binary file and display the data of all
those candidates who are not belong to Secunderabad.
Logistic Technologies Ltd. is a Delhi based organization which is expanding its (5)
37.
office set-up to Ambala. At Ambala office campus, they are planning to have 3
different blocks for HR, Accounts and Logistics related work. Each block has a
number of computers, which are required to be connected to a network for
communication, data and resource sharing.

As a network consultant, you have to suggest the best network related solutions for
them for issues/problems raised in (i) to (v), keeping in mind the distances between
various block/locations and other given parameters. Distances between various
blocks/locations :

Page: 7/8
Number of computers installed at various blocks are as follows :

(i) Suggest the most appropriate block/location to house the SERVER in the
Ambala office. Justify your answer.
(ii) Suggest the best wired medium to efficiently connect various blocks within the
Ambala office compound.
(iii) Draw an ideal cable layout (Block to Block) for connecting these blocks for
wired connectivity.
(iv) The company wants to schedule an online conference between the managers of
Delhi and Ambala offices. Which protocol will be used for effective voice
communication over the Internet?
(v) (A) Which kind of network will it be between Delhi office and Ambala office?
OR
(B) Is there a requirement of a repeater in the given cable layout? Why/ Why not?

Page: 8/8
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER - 1
2025-26

कक्षा CLASS: XII समय TIME:03 HOURS

विषयSUBJECT: COMPUTER SCIENCE अविकतम अंकMAX. MARKS: 70

General 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 case of MCQ, text of the correct answer should also be written.

SECTION-A
1 State True or False: 1
A tuple T1 is declared as T1 = (“AB”,”CD”,”EF”,”GH”)
if a statement T1[2]=”XY” is written then it changes value of 3 rd element of T1 as “XY”.
2 What will be the output of the following python code? 1
t=(10)
t1=t*2
print(t1)
a) (10,10) b) 20 c) (100) d) (10),(10)
3 Select the correct output of the code: 1
kv="PM Shree KVs "
print(kv[0].lower()+kv[1:-1]+kv[-1].upper())
4 Which of the following statements is true about an equi join? 1
A) The columns used for joining must have different names.
B) The columns used for joining must have the same name.
C) The join condition must use the "greater than or equal to" operator.
D) The join condition must use the equality operator (=).
5 Given the lists VOWELS=[“A”,”E”,”I”,”O”,”U”] , write the output of following statement 1
print(VOWELS[-2:4])

6 Which of the following statement will generate error : 1


a) print("10"+20) b) print(“10+20”) c) print(10+20) d) None of the above
7 What will be the output of the following statement: 1
print(4**2-2**1**3//5*2+2)
a) 20 b) 18 c) 16 d)22

8 1
Which clause is used to group rows in a result set that have the same values in one or more
columns?
a) ORDER BY b) WHERE c) GROUP BY d) HAVING

9 What will be the output of the following Python code if the input are given as num1 : 120 1
num2 : 30 ?
try:
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
quotient = (num1 / num2)
print(quotient)
print("Both numbers entered were correct")
except ValueError:
print("Please enter only numbers")
except ZeroDivisionError:
print("Number 2 should not be zero")
finally:
print("JOB OVER... GO GET SOME REST")

a) 4.0
Both numbers entered were correct
JOB OVER... GO GET SOME REST
b) 4
Both numbers entered were correct
JOB OVER... GO GET SOME REST

c) 4.0
Both numbers entered were correct

d) JOB OVER... GO GET SOME REST

10 Which of the following statements cause an error:


M = (5,6,7,8)

a) len(M) b)print(M[2]) c)M[3]= 4 d)M=(6,7,80)


11 What possible output is expected to be displayed on the screen at the time of execution of the 1
Python program from the following code?
import random
L=[10,30,50,70]
Lower=[Link](1,2)
Upper=[Link](2,3)
for K in range(Lower, Upper+1):
print(L[K], end="@")
a) 50@ b) 30@ c) 30@50@ d)30 50

12 What will be the output of the following Python code? 1


marks = 50
def Result(marks):
print('marks are', marks)
marks= 75
print('Changed marks are', marks)
Result(marks)
print('Now marks are', marks)
a) marks are 50 b) marks are 50
Changed marks are 75 Changed marks are 50
Now marks are 50 Now marks are 50

c) marks are 50 d) marks are 50


Changed marks are 75 Changed marks are 50
Now marks are 75 Now marks are 50

13 Which key helps us to establish the relationship between two tables? 1


a) Candidate key b) Foreign key c) Primary key d) Unique key
14 What is the output of the given Python code? 1
st= learning python is thrilling!'
print([Link]("i"))
a) (‘learn’, ‘i’, ‘ng python is thrilling!’) b) (‘learn’, 'i', 'ng python’, ‘i’ ,’s thr’,
‘I’,’ll’,’I’,’ng!')
c)_((‘learn’, ‘ng python is thrilling!’) d) (‘learn’, ‘ng python’, ‘s thr’,’lling!')

15 What is the best data type definition for MySQL when a field is alphanumeric and has a fixed 1
length?
a) VARCHAR b) CHAR c) INT d) DECIMAL
16 A relational database consists of a collection of ________ 1
a) Attributes b) Tuples c) Keys d) Relations
17 Which protocol is used for the transfer of hypertext content over the web? 1
(a) HTML (b) HTTP (c) TCP/IP (d) FTP

18 A repeater takes a weak and corrupted signal and ________ it. 1


a) Reroutes b) Resembles c) Removes d) Amplifies
19 In a............topology, the nodes have direct connection with other nodes 1
a) Bus b) Star c) Fully-Connected d) Ring
Q20 and 21 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A 4
(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) - If the arguments in the function call statement match the number and order of 1
arguments as defined in the function definition, such arguments are called positional arguments.
Reasoning (R) - During a function call, the argument list first contains default argument(s)
followed by the positional argument(s).

21 Assertion (A): In SQL, the aggregate function Avg() calculates the average value on a set of 1
values and produces a single result.

Reasoning ( R): The aggregate functions are multirow functions work on a group of rows and
return one result.

SECTION-B
22 Give two examples on 2
i. Logical operators ii. Membership operators
OR
Explain the difference between syntax errors and semantic errors in Python with a suitable
example.
23 Rewrite the following code in Python after removing all syntax error(s). Underline each 2
correction done in the code.
x=int(“Enter value for x:”))
for y in range[0,11]:
if x==y:
print x+y
else:
Print(x-y)

24 A) If L=[1,2,3,3,3,3,4,2,5] 2
i. Write a statement to add element 6 at end of list L.
ii. Write a statement to delete last element from the list L
OR
B) Predict the output of the following Python code:
text="Learn Python with fun and practice"
print([Link]("with"))
print([Link]("a"))
25 A. Write a function add_element() in Python that accepts a list L and a number n. If the number 2
n does not exist in the list, it should be added. If it exists, print a message saying "Element
already exists".
OR
B. Write a Python function update_contact() that accepts dictionary phone_book, a name, and a
phone number. The function should update the dictionary if the name already exists else print
"Contact does not exist" .
26 Predict the output of the Python code given below : 2
test = {1:'A', 2:'B', 3:'C'}
del test[1]
test[1] = 'D'
del test[2]
print(len(test))
27 i. Hanshika has created a table “FRUITS”. Help her to do the following by writing correct 2
MySQL commans/queries:
(a) She wants to display the column “FruitName” without duplicate entry.
(b) She wants to see the structure of the table
OR
ii. Differentiate between Alter and Update query in SQL with a suitable example.
28 (A) Write one difference between circuit switching and packet switching. 2
OR
(B) Write one difference between SMTP and POP.

SECTION-C
29 (A) Write a function Count() in Python, which should read each character of a text file 3
[Link], should count and display the occurrence of alphabets A and M (including
small cases a and m too).
OR
(B) Write a function in Python that counts the number of "The" or “Who" words present in a
text file "[Link]".
30 A) Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Book and 3
delete a Book from a list of Book titles, considering them to act as push and pop operations of
the Stack data structure.
i) PushOn(Book,New) – This function takes new book as parameter and push to stack
ii) PopOn(Book) - This function pops the top most book records from the stack. If
stack is empty display appropriate message.

31 What output will be generated when the following Python code is executed? 3

dic = {}
dic [(1, 2, 4)] = 8
dic [(4, 2, 1)] = 10
dic [1, 2)] = 24
sum = 0
for i in dic :
sum = sum + dic[i]
print (sum)

OR
What output will be generated when the following Python code is executed?
l =[ ]
l1=[ ]
l2=[ ]
for i in range(1, 10):
[Link](i)
for i in range(10, 1, –2):
[Link](i)
for i in range(len (l1)):
[Link](l1[i] + l[i])
[Link] (len(l)– len(l1))
print(l2)
SECTION-D
32 Consider the table TRANSACTION given below: 4

TABLE : TRANSACTION
TRNO ANO AMOUNT TYPE DOT

T001 101 2500 Withdraw 2017-12-21

T002 103 3000 Deposit 2017-06-01


T003 102 2000 Withdraw 2017-05-12
T004 103 1000 Deposit 2017-10-22
T005 101 6000 Deposit 2017-11-06
i) Based on the given table, write SQL queries for the following:
a) Change the amount as 1500 of all those transactions where amount is less than or equal to
2000.
b) Display all details of transactions which happened before 01-12-2007.
c) Display sum of amount of those having ANO as 103.
d) Delete the tranactions which contains amount less than 3000.
OR
ii) Write the output of following Queries
a) Select * from TRANSACTION where AMOUNT between 2000 and 3000;
b) Select TYPE, sum(AMOUNT) from TRANSACTION group by TYPE;
c) Select count(*) from TRANSACTION where TYPE=”Deposit”;
d) Selct distinct(ANO) from TRANSACTION;

33 Deepak is a Python programmer working for election commission For the coming election he 4
has created a csv file “[Link]”.
The structure of [Link] is : [Party_Id, Party_Name, Candidate_Name, TotalVote]

Where Party_Id is Party ID (integer)


Party_name is Party Name (string)
Candidate_Name is name of candidate(string)
TotalVote is total vote received by the candidate

For efficiently maintaining data of the event, Deepak wants to write the following user defined
functions:

Input() – to accept a record from the user and add it to the file [Link].
The column headings should also be added on top of the csv file.

Winner() – to read TotalVotes of each record and display the record which has got maximum
number of votes.

As a Python expert, help him complete the task.


34 Consider the tables GARMENT and FABRIC given below: 4

Table : GARMENT

GCODE Description Price FCODE READYDATE


10023 PENCIL SKIRT 1150 F03 19-DEC-08
10001 FORMAL SHIRT 1250 F01 12-JAN-08
10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TULIP SKIRT 850 F02 31-MAR-07
10019 EVENING GOWN 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08
10017 FORMAL PANT 1350 F01 09-MAR-08
10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 31-OCT-08

Table :FABRIC

FCODE TYPE
F04 POLYSTER
F02 COTTON
F03 SILK
F01 TERELENE

Write SQL queries for the following:


(I) Display Garment Description, Price and Type of fabric from above tables.
(II) Display maximum price of SILK garments.
(III) Display Description , Price of all garments where description 2 nd character is “N” and Price
is greater than 1525.
(IV) (A)Insert the following record in table GARMENT for the columns Description and price.
(“POLYSTER” , 980 )
OR
(B) Insert the following record in table FABRIC.
(F05,”LINEN”)
35 Raman has created table named NATIONALSPORTS in MYSQL database, SPORTS : 4
Each record contains the following fields:
∙ GameID(Game number )- integer
∙ Gamename(Name of game) - string
∙ DOG(Date of Game) – Date
∙ Venue(Venue of game) – decimal
Note the following to establish connectivity between Python and MySQL:
∙ Username - root
∙ Password – KVR@321
∙ Host – localhost

Raman , now wants to display all records of venue “Hyderabad”. Help him to write the python
program.
SECTION-E
36 Consider the Binary file [Link] contains information about formal event participant and 2+
record structure in [Link] is as follows: [eventname,teamname,no_players] 3
A) Write a function, ReadData(), that reads contents of N users and write to binary file [Link]
B) Write a user defined function CopyData() that would read contents from [Link] and creates
a file named [Link] copying only those records from [Link] where event name is
Atheltics .
Record structure in [Link] is as follows: [eventname, teamname, no_players]
37 CITY CABLE NETWORK has set up its new centre at HYDERABAD for its office and web 5
based activities. It has four buildings as shown in the diagram below:
A B

C D
Number of Computers Center to center distances
Block A 25
Block B 50 Black A to Block B 50 m
Block C 125 Block B to Block C 150 m
Block D 10 Block C to Block D 25 m
Block A to Block D 170 m
Block B to Block D 125 m
Block A to Block C 90 m

(i) Which type of network is this 1


a)LAN b)PAN c)WAN d)TAN
(ii) Suggest a cable layout of connections between the blocks. 1
(iii) Suggest the most suitable place (i.e. block) to house the server of this organisation with a suitable 1
reason.
(iv) Suggest the placement of the following devices with justification 1
▪ Repeater
▪ Hub/Switch

(v) A)The organization is planning to link its front office situated in a far city in a hilly region where 1
cable connection is not feasible, suggest a way to connect it with reasonably high speed?
OR
B) Suggest a protocol that shall be needed to provide Video Conferencing solution between
Hyderabad and front office?

-------------------
KENDRIYA VIDYALAYA SANGATHAN:: HYDERABAD REGION
MODEL QUESTION PAPER 2025-26
ककककक CLASS : XII ककक TIME : 03 HOURS
कककक SUBJECT : COMPUTER SCIENCE कककककक ककक MAX.
MARKS: 70
General 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 case of MCQ, text of the correct answer should also be written.

Mark
[Link]. Section-A (21 x 1 = 21 Marks)
s
1. State True or False: 1
In Python, the identifiers Salary and salary are treated alike.

2. What will be the value of the expression 16%15/16? 1


a) 0.0 b) 0.625 c) 0.0625 d) 0.00625

3. Chose the correct option to fill in the blank which prints the output as “end” from the 1
string s?
s="KENDRIYA"
print(----------------)
a) s[1:4].lower() b) [Link]()[1:4] c) [Link](1:4) d) Both a and b

4. _____ command is used to display unique values from a column. 1


a) UNIQUE b) ONLY c) DISTINCT d) all three a,b and c
5. What does the following code print? 1
s="VIDYALAYA"
print(s[::-1][::-6], end=" ")
print(s[::-1][-1]+s[len(s)-1])
a) AV VA b) VA VL c) VA LV d) VA VA

6. Which of the function will delete any value exists at any index from the list 1
a) remove() b) delete() c) pop() d) None of these

7. What will be the effect of the statement T=(10)? 1


a) Creates a tuple with one element 10 b) Assigns value 10 to T
c) Raises Error d) None
8. Which of the following SQL command will delete the table entirely? 1
a) delete table b) drop table c) remove table d) drop from table
9. What will be the output of the following Python code? 1
import math
result=None
try:
result = [Link](2, 3, 4, 5)
except TypeError:
print("TypeError occurred with [Link]()")
finally:
print("Result:", result)

a) TypeError occurred with [Link]() b) Result : 8


Result: None
c) TypeError occurred with [Link]() d) None of the above

10. Which of the following function will return key, value pairs of a dictionary? 1
a) keys() b) values() c) elements() d) items()
11. Identify the incorrect output(s) of the following code. 1
import random
for i in range(4):
a=100+[Link](5,10)
print(a, end=" ")
a) 102 105 104 105 b) 110 108 106 105
c) 105 107 105 110 d) 110 105 105 110

12. Select the correct output of the code: 1


a = "Year 2022 at All the best"
a = [Link]('2')
b = a[0] + " # " + a[1] + " @ " + a[3]
print (b)

a) Year # 0 @ at All the best b) Year 0. at All the best


c) Year @ 022 # at All the best d) Year 0 @ at all the best
13. In SQL,---------------- key accepts either existing values or null values only. 1
a) Primary Key b) Foreign Key c) Unique d) No such key exists.

14. Adithya is confused in finding which of the following conditional statements will NOT 1
execute. Help him in finding the suitable option.
a) if not "yes" != "no": b) if not "yes" != "yes":
print("Reached") print("Reached")
c) if not "yes" == "no" : d) if "yes" == "yes":
print("Reached") print("Reached")
15. The data types CHAR(n) and VARCHAR(n) are used to create----and---length of strings. 1
a) fixed, equal b) equal, variable c) fixed, variable d) variable, equal

16. Which of the following is not an aggregate function in SQL? 1


a) round() b) count() c) sum() d) All of these.
17. Which protocol is used for remote login 1
a) TCP b) IP c) TELNET d) REMOTE

18. ______network device is essential to connect a desktop or laptop to a network using 1


cable .
a) MAC b) NIC c) MODEM d) ROUTER

19. ______________ is not a switching technique in Networks? 1


a) Circuit Switching b) Packet Switching c) Message Switching d) Route Switching

Q20 and Q21 are ASSERTION AND REASONING based questions. Mark the correct choice
(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. str1= " Class" + " Work" 1
ASSERTION: Value of str1 will be " Class+Work"
REASONING: Operator ‘+’ adds the operands if both are numbers & concatenates if both
the operands are strings.
21. Assertion: In SQL, only the drop command removes entire data as well as the table too. 1
Reason : delete command of SQL will remove the data, but keeps the table intact.

[Link]. Section-B (7 x 2 = 14 Marks) Mark


s
22. Give two examples on 2
i. Relational operators ii. Identity operators
OR
Explain the difference between “=” and “==” in Python with a suitable example.
23. Observe the following program and rewrite it after removing syntax error(s), if any. Under 2
line each correction.
x=[10,"vidya',40,50]
0=A
for i in x:
if i=10:
A=+20
print(A,X)
24. a) Observe the following code 2
myno=[10,20,30,40]
yourno=[111,222]
myno.__________________ # statement 1
print(myno)
myno.__________________ # statement 2
print(myno)
Fill in the blanks with suitable python code for the following.
1. Statement-1-- Insert 333 at index 3 so that it should become
[10, 20, 30, 333, 40]
2. Statement-2--- Merge 2 lists so that it should become
[10, 20, 30, 333, 40, 111,222]
(OR)
b) What is the output of the following code
t=(9,99)
print(t*2)
print(t+(100,))

25. A. Write a function update_list() in Python that accepts a list L and a number n. If the 2
number n does not exist in the list, it should be added. If it exists, print a message
saying "Element already exists".
OR
B. Write a Python function delete_contact() that accepts dictionary phone_book, a
name, and a phone number. The function should delete the dictionary if the name
already exists else print "Contact does not exist" .
26. What will be the output?
dict = {}
dict[1] = 11
dict['1'] = 20
dict[1]= dict[1]+1
count = 0
for i in dict:
count += dict[i]
print(count)
27. a) Categorise the following commands into DDL and DML Category. 2
INSERT, CREATE, DROP, DELETE
(OR)
a)
EMPNO ENAME DESIG SAL GEN

1001 PRAMOD KUMAR PGT 90000 M

1005 THENDRAL PRT 35500 F

2005 AISHWARYA TGT 49500 F

8090 SRINIVAS ASO 35000 M

7890 ASHOK JSA 28000 M

With respect to the STAFF table assume that one column is removed and a row is
added then what is the cardinality and degree of STAFF table.
b) Write two importance characteristics or features of Primary Key
28. Expand the terms a) MAC b) NIC 2
(OR)
Identify the Network topology as per the following:
a) In which every node is connected to one main cable.
b) In which every node is connected to a central device through independent cable.

[Link]. Section-C (3 x 3 = 9 Marks) Mark


s
29. Assume a text file named “[Link]” file exists. Write Python function to display only 3
those lines which contains word ‘the’.
(OR)
Write Python function to copy all lines that begin with Upper Case vowel from
[Link] and store them into a new file named [Link].

30. Krishna has created a dictionary containing names and marks as key value pairs of 6 3
students. defined functions to perform the following operations:
i) stpush(d) : Push the keys (name of the student) of the dictionary into a stack,
where the corresponding value (marks) is greater than 75.
ii) dispop() : pop and display the topmost element of the stack.
For example:
If the sample content of the dictionary is as follows:
R={"OM":76, "JAI":45, "BOB":89, "ALI":65, "ANU":90, "TOM":82}

The output from the program should be:


TOM ANU BOB OM
31. Find output program 3
msg = "I am the Winner@2025"
n = len(msg)
M = '’
for i in range(0,n,2):
if not msg[i].isalpha():
if msg[i] == '':
M = M + '#'
else:
M = M + '&'
else:
M= M + msg[i-1]
return M
(OR)
What will be the output of the following code snippet:
my_dict = { }
my_dict [(1,2,4)] = 8
my_dict [(4,2,1)] = 10
my_dict [(1,2)] = 12
sum = 0
for k in my_dict:
sum += my_dict[k]
print (sum)
print (my_dict)

[Link]. Section-D (4 x 4 = 16 Marks) Mark


s
32. Consider the following STAFF table: 4

empno ename desig sal Gen

1001 PRAMOD KUMAR PGT 90000 M

1005 THENDRAL PRT 35500 F


2005 AISHWARYA TGT 49500 F

8090 SRINIVAS ASO 35000 M

7890 ASHOK JSA 28000 M

Write SQL Queries for the following assuming all kinds of data exist in the table.
a) Display name, designation of all staff members.
b) Display all staff members whose salary is between 50000 to 100000
c) Display name and gender of all PGTs
d) Display all staff members whose salary is not yet fixed.
(OR)
Write the output of the following queries as per the data contained in the above table.
a) SELECT MAX(SAL), AVG(SAL) FROM STAFF;
b) SELECT SAL*0.1 AS “COMM” FROM STAFF WHERE GEN=’F’;
c) SELECT ENAME FROM STAFF WHERE ENAME LIKE ‘%I%’
d) SELECT COUNT(DISTINCT GEN) FROM STAFF;

33. A CSV file named “[Link]” contains list of KVs data in the form of [KVNo, KVName, 4
Sector, Year]. For example, [5898,’PM SHRI KV HYDERABAD’,’DEFENSE’,1983].
Write Python functions for the following.
a) Input one record and store into CSV file.
b) Read data from CSV and display only those KV details which belong to CIVIL Sector.

34. Consider the following tables STUDENT and ST-HOUSE. 4

Table : STUDENT Table : ST-HOUSE

Clas Se Rn Sname Hous Hid Hname HMaster


s c o e

3 A 1 ROHAN H03 H0 GANGA VACHASPATH


1 I

12 C 5 PALLAVI H04 H0 YAMUNA MADHURI


2

9 D 12 KIRAN H03 H0 NARMAD MURALI


3 A

11 A 6 SAMPAT H02 H0 KAVERI SRIHARI


H 4

Write SQL Queries for the following.


i) Display class, section and name of all students belong to NARMADA house.
ii) Display the number of students present in the student table.
iii) Display names of students in the descending order of names.
iv) a) Remove all students of section A

(OR)
b) Write SQL query to add a new column to ST-HOUSE table named Hmember of
Varchar type with size 20.

35. A table named WORKER available in a database named “BUILDER” with the following 4
structure.

Table : WORKER

Field name Type

WID Integer(5)

WNAME Varchar(20
)

SKILL Varchar(20
)

Rate Integer(2()

Write a Python program to input worker details and store the input data in MySQL table
named WORKER. At the end Program should also display all the workers from worker
table using Python-MySQL connectivity.
(MySQL : username = root , Password=kvs123, database=BUILDER)

[Link]. Section-E (5 x 2 = 10 Marks) Mark


s
36. Your vidalaya needs to store Stock details of computer department like COMPUTER, 2+3
KEYBOAD, MOUSE, SCANNER, PRINTER etc. Data of each stock item is maintained in the
form of a dictionary named Item with keys StockId, ItemName, Quantity,’Brand’
a) Define a function AddStock() that will input one Item details and append to a
binary file [Link].
b) Define a function getScanner() which will display the details of all scanners exist
in [Link].
37. Your Vidyalaya building has blocks named ‘Primary’ , ‘Secondary’ and ‘Senior’. 5
The distances and no. of computers is as following.

Distance between blocks [Link] computers

From To distance Block [Link] Computers

Primary Secondary 40 mts Primary 25

Secondary Senior 200 mts Secondary 36


Primary Senior 90 mts Senior 96

a) Suggest the most appropriate block to house the server. Justify your reason.
b) Draw the cable layout to connect all the blocks. Suggest the type of cable for this
connectivity.
c) Which block requires the placement of Switch/Hub?
d) Whether any repeater is required for the given cable layout? Justify your answer.
e) i) The KVS Regional office is located 150 KM away from your Vidyalaya. Suggest
the type of communication/transmission media to be used between your
Vidyalaya and the Regional office.
OR
ii) Identity What type of network (PAN, LAN, MAN, or WAN) will be set up among
the computers connected in your Vidyalaya.
KENDRIYA VIDYALAYA SANGATHAN:: HYDERABAD REGION
MODEL QUESTION PAPER 2025-26
कक्षा CLASS : XII समय TIME : 03 HOURS
विषय SUBJECT : COMPUTER SCIENCE अधिकतम अ
ं क MAX. MARKS: 70

General 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 case of MCQ, text of the correct answer should also be written.

Section A
1 State true or false: 1
The value of the expressions 4/(3*(2 - 1)) and 4/3*(2 - 1) is the same.
2 What will be the output of the following code?
names = ['Freya', 'Mohak', 'Mahesh', 'Dwivedi']
print(names[-3][:2]+names[2][0])

a) MoM b) MaM c) mom d) Mom

3 Which of the following evaluates to False?


(a) not(False) (b) True and False (c) True or False (d) not(True)
4 In MYSQL database, if a table, STUDENT with attributes (admno, name, address, 1
phone, scode) and another table, REGS with attributes (scode, sub1, sub2, sub3,
sub4, sub5, sub6, sub7, regfee). Which of the following attribute can be used for
join operation through NATURAL JOIN clause?
a. name b. admno c. regfee d. scode
5 What is the output of the following code snippet? 1
text = "HELLO"
text = [Link]('L', 'Z')
print(text)
(a) HEZZO (b) HELLO (c) HELO (d) HZZLO

6 Write the output of the following Python code : 1


for i in range(‘a’,’z’,2):
print ( k, '-' )

7 What will be the output of the following Python statement: 1


print(float(5 + int(4.39 + 2.1) % 2))

8 Consider the given SQL Query: 1


SELECT Author, Max(Price) FROM LIBRARY GROUP BY AUTHOR WHERE
Max(PRICE)>5000;
Sameer is executing the query but not getting the correct output. Write the
correction.
9 What will be the output of the following Python code? 1
try:
value = int("abc")
except ZeroDivisionError:
print("ZeroDivisionError occurred.")
except ValueError:
print("ValueError occurred.")
except: # Generic catch-all except block
print("Some other exception occurred.")

10 a) What will be the output of the following code? 1


dict = {“Jo”: 1, “Ra ”:2 }
[Link]({“Pho”:3 })
print(dict)
a. {“Jo ”:1, “Ra ”:2, “ Pho ”:2} b. {“Jo”: 1, “Ra”:2 } c. {“Jo” :1, “Pho”:3 }
d. Error
11 Identify the correct output(s) of the following code. Also write the minimum and 1
maximum possible values of the variable b
import random
a = "Python"
b = [Link](2, 5)
for i in range(1, b):
print(a[i], end='')
(a) y (b) yt c) yth (d) ython

What is the output of following program: 1


12 g=0
def fun1(x,y):
global g
g=x+y
return g
def fun2(m,n):
global g
g=m-n
return g
k=fun1(2,3)
fun2(k,7)
print(g)
(A) 2 (B) -2 (C) 12 (D) 5 b
13 Which SQL command is used to remove a row from an existing relation? 1
a) Insert b) Delete c) Both a) & b) d) Drop
14 What is the output of the following expression?
text = 'Explanation'
print([Link]('a'))

(a)['Expl', 'n', 'tion'] (b)['Expl', 'nation'] (c)('Expl', 'n', 'tion') (d) Error
15 In SQL, a relation consists of 6 columns and 9 rows. If 2 columns and 3 rows are 1
removed from the existing relation, what will be the updated cardinality of a
relation?
a) Cardinality: 4 b) Cardinality: 8 c) Cardinality: 9 d) Cardinality: 6
16 Which aggregate function can be used to find the total number of records in a 1
table?
(A) SUM() (B) COUNT() C) MAX() D) AVG()
17 Which protocol is used to send emails over the Internet? 1
(A) HTTP (B) FTP (C) SMTP (D) HTTPS
18 Which device is used to amplify and regenerate signals in a network? 1
(A) Modem (B) Gateway C) Repeater D) Router
19 Which switching technique establishes a dedicated communication path between 1
two endpoints for the duration of the transmission?
A) Packet switching B) Circuit Switching C) Both D) None of the above
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 of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true
20 Assertion (A): Python allows us to divide a large program into the basic building 1
blocks known as a function.
Reason (R): The function contains the set of programming statements enclosed by
()
21 Assertion (A): The primary key in a database table ensures that all values in a 1
column are unique.
Reasoning (R): A primary key is used to identify records uniquely within a table,
which allows for efficient data retrieval.
Section-B
22 Explain the difference between mutable and immutable objects with examples 2
from Python.
OR
Differentiate between == and is operators in Python with examples.
23 Rewirte the code after removing syntactical error and underline each correction :
Def A_func (x=10, y=20):
x =+1
y=y-2
return (x+y)
print(A_func(5) A_func())
24 A) Write the Python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
(i) To append the value 100 to a list L
(ii) To convert the string word to all uppercase characters.
OR
B) Predict the output of the following Python code:
str1 = ('HelloWorld!')
str2 = '-' #separator
print([Link](str1))
print([Link]('Hello',10,20))
25 Write a function HowMany(ID, VALUE) to count and display number of times the 2
VALUE is present in the list ID.
For example, if the ID contains [115, 25, 65, 59, 74, 25, 110, 250] and the VALUE
contains 25, the function should print: 25 found 2 times.
OR
Write a Python function add_record() that accepts a dictionary student,an
admn_no and a name. The function should add the admn_no and name to the
dictionary. If the admn_no already exists, print "Record already exists" instead of
updating it.

26 What will be the output of the following Python code? 2


d1 = {'a':10,'b':20,'c':3}
str1 = ''
for i in d1:
str1 = str1 + str(d1[i]) + ' '
str2 = str1[:-1]
print(str2[::-1])

3 02 01
27 A. Write suitable commands to do the following in MySQL. 2
I. to show the table list.
II. Drop a database named SQP
OR
B. Differentiate between char and varchar in SQL with a suitable example.
28 (i) Expand the following terms: SMTP , TCP /IP
(ii) Give one difference between HTML and XML.
OR
(i) Define network device Gateway with respect to computer networks.
(ii) How is ARPANET different from NSFNET?
SECTION –C (3x3=9)
29 Write the definition of a function Count_Line() in Python, which should read each 3
line of a text file "[Link]" and count total number of lines present in text file.
For example, if the content of the file "[Link]" is as follows:

Shivaji was born in the family of Bhonsle.


He was devoted to his mother Jijabai.
India at that time was under Muslim rule.

The function should read the file content and display the output as follows:
Total number of lines : 3
OR
Write the definition of a function Count_Words() in Python, which should read
each line of a text file "[Link]" and count the total number of words present
in the text file.

The history of India is very rich.


Many rulers ruled the land of India.
It is the land of diverse cultures and traditions.

The function should read the file content and display the output as follows:
Total number of words: 22
30
You have a list PatientList where each element represents a patient record in the 3
format Name, Age, Department, Charges. Write Python functions to operate on
the stack SurgeryStack.

(i) Push_patient(PatientList, SurgeryStack): Push the names and ages of the


patients whose department is 'Surgery' and charges are greater than 250 onto the
stack.

(ii) Pop_patient(SurgeryStack): Pop and display the names of the patients from the
stack until it is empty, then print "Stack Empty".

31 Predict the output of the following code:


data = [3, 5, 8]
result = "" 3
for number in data:
for i in range(1, number + 1):
result += str(i) + "!"
print(result)
OR
values = [2, 4, 6]
for v in values:
for j in range(v):
print(v, end=" ")
print()
SECTION – D
32 Consider the table CUSTOMERS as given below: 4

C_Id C_Name City Age Join_Date


1 Alice New York 30 2022-01-10
2 Bob Los Angeles 25 2021-11-15
3 Charlie Chicago 35 2023-03-12
4 David Miami 28 2020-07-22

A) Write the following queries:


(I) To display the average age of customers from each city.
(II) To display the total number of customers who joined in the year 2022.
(III) To display the distinct cities from the Customers table.
(IV) To display the maximum age of customers who are from New York.

OR

B) Write the output:


(I) SELECT C_Name, COUNT(*) AS Total_Customers FROM Customers GROUP BY
City;
(II) SELECT * FROM Customers WHERE Age > 30;
(III) SELECT C_Id, C_Name FROM Customers WHERE Join_Date BETWEEN '2022-01-
01' AND '2022-12-31';
(IV) SELECT MIN(Age) FROM Customers;
33 A CSV file "[Link]" contains the data of employees in a company. 4
Each record of the file contains the following data:
● Employee ID
● Name of the employee
● Department
● Salary
For example, a sample record of the file may be:
[101, 'Alice', 'HR', 75000]
Write the following Python functions to perform the specified operations on this
file:
(I) Read all the data from the file in the form of a list and display all those records
for which the salary is greater than ₹60,000.
(II) Count the number of records in the file.
34 Write the SQL commands for (i) to (v) on the basis of the table HOSPITAL Consider 4
the following tables ACTIVITY and COACH and answer (a) and (b) parts of this
question: Table: ACTIVITY
ACod ActivityName Stadium Participantsnu PrizeMone ScheduleDa
e m y te
1001 Relay 100 x 4 Star 16 10000 23-Jan-2004
Annex
1002 High Jump Star 10 12000 12-Dec-
Annex 2003
1003 Shot Put Super 12 8000 14-Feb-
Power 2004
1005 Long Jump Star 12 9000 01-Jan-2004
Annex
1008 Discuss Super 10 15000 19-Mar-
Throw Power 2004

Table: COACH
PCode Name ACode
1 Ahmad Hussain 1001
2 Ravinder 1008
3 Janila 1001
4 Naaz 1003

a. Write SQL commands for the following statements:


i. To display the names of all activities with their Acodes in descending order.
ii. To display sum of PrizeMoney for the Activities played in each of the Stadium
separately.
iii. Display the activity name ,total participant numbers and their coach name.
iv. A) Display the total prize amount received by each coach.
Or
B) Display the highest prize money and its Coach name

35 A table, named EMPLOYEES, in HRDB database, has the following structure: 4

Field Type
emp_id int(11)
emp_name varchar(30)
department varchar(20)
salary float

Write the following Python function to perform the specified operation:


AddAndDisplay(): To input details of an employee and store it in the table
EMPLOYEES. The function should then retrieve and display all records from the
EMPLOYEES table where the Salary is greater than 50,000.

Assume the following for Python-Database connectivity:


Host: localhost
User: root
Password: Employee123
SECTION - E
36 Consider a binary file "[Link]" containing a dictionary with multiple elements. Each 2+3
element is in the form:
SID: [SNAME, SCLASS, MARKS]
where:
SID – Student ID
● SNAME – Student Name
● SCLASS – Student Class
● MARKS – Student Marks
Perform the following tasks:
(I) Write a function to input the data of a student and append it to the binary file.
(II) Write a function to update the class to "12" for students whose marks are greater than 90
37 "Hindustan Connecting World Association" is planning to start their offices in four major 5
cities in India to provide regional IT infrastructure support in the field of Education & Culture.
The company has planned to setup their head office in New Delhi in three locations and have
named their New Delhi offices as "Sales Office", "Head Office" and "Tech Office". The
company’s regional offices are located in "Coimbatore", "Kolkata" and "Ahmedabad".

A rough layout of the same is as follows:

Approximate distance between these offices as per network survey team is as follows:
Place From Place To Distance
Head Office Sales Office 10 KM
Head Office Tech Office 70 METER
Head Office Kolkata Office 1291 KM
Head Office Ahmedabad Office 790 KM
Head Office Coimbatore Office 1952 KM

In continuation of the above, the company experts have planned to install the following
number of computers in each of their offices:

Head Office 100


Sales Office 20
Tech Office 50
Kolkata Office 50
Ahmedabad Office 50
Coimbatore Office 50
i. Based on the distance and number of computers, suggest the most suitable location for
the main server that will optimize connectivity across all offices. Explain your reasoning.
ii. For efficient communication between the various offices, suggest a suitable network
topology and illustrate it.
iii. Recommend the placement of the following devices with justifications:
a. Repeater
b. Hub/Switch
iv. VoIP technology will be implemented for voice communication over the internet. What
does the acronym VoIP stand for?
v. A) If Hindustan Connecting World Association intends to link its New Delhi head office with
the regional offices in Coimbatore, Kolkata, and Ahmedabad, which type of network (LAN,
MAN, or WAN) will be created? Justify your answer.
OR
B) Which hardware device would you recommend to connect all the computers in the head
office effectively?
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2025-26

ककककक CLASS: XII ककक TIME:03 HOURS


कककक SUBJECT: COMPUTER SCIENCE कककककक ककक Maximum
Marks: 70
General 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 case of MCQ, text of the correct answer should also be written.
Q. No. Section – A (21 x 1 = 21 Marks) Marks
1 State True or False:
State True or False: Python uses indentation to define blocks of code 1

2 Identify the output of the following code snippet:


text = "PythonExample"
text = text[::-1].replace('e', '3')
text = text[:5] + text[7:] 1
print(text)
A. PythonExampl3 B. 3lpmanohtyP
C. 3lpmax3nohtyP D. Python3xampl3
3 Evaluate the following expression
print(6//3**2 and 84%3 or 35/7+5)
A. True B. 10.0 1
C. 5.0 D. 10
4 What is the output of the expression?
string = "Code2022isFun"
string = [Link]('2')
result = string[0] + "-" + string[1] +"-" +string[2][2:] 1
print(result)
A. Code-0- B. Code-0-sFun
C. Code-0-isFun D. Code-0-is
5 What will be the output of the following code snippet?
string = "COMPUTER SCIENCE" 1
print(string[12:5:-2])
6 What will be the output of the following code? 1

[1]
tup = (5)
print(tup * 3)
A. (5,5,5) B. (15)
C. (5,) D. (15,)
7 What will be the output of the following code?
my_dict = {'a': 1, 'b': 2}
my_dict['c'] += 1 1
A. {'a': 1, 'b': 2, 'c': 1} B. KeyError
C. {'a': 1, 'b': 2, 'c': 2} D. TypeError
8 What does the [Link](x, y) method do in Python?
A. Inserts the value y at the end of the list.
B. Inserts the value x at index y in the list. 1
C. Inserts the value y at index x in the list, shifting elements to the right.
D. Replaces the element at index x with the value y.
9 Given the following table structure, how many candidate keys can be identified?
ID NAME USERNAME Mobile
101 Alisha Al12 8741455878
102 Anaya Ana09 8741455456 1
103 Alisha Ali21 8741455432
A. 1 B. 2
C. 3 D. 4
10 What will happen if a return statement is not used in a function?
A) The function returns 0
B) The function returns None 1
C) The function returns False
D) The function will throw an error
11 State whether the following statement is True or False:
A try block in Python can exist without an except block as long as a finally block is 1
present.
12 What will be the output of the following code?
c = 10
def increment():
global c
c += 5
print(c, end='#')
1
increment()
c = 30
print(c)
A. 15#15# B. 15#15
C. 15#30 D. 15#30#
13 A table has initially 10 columns and 5 rows. Consider the following sequence of
operations performed on the table –
i. 5 rows are added
ii. 3 columns are added
1
iii. 4 rows are deleted
iv. 5 columns are deleted

What will be the cardinality and degree of the table at the end of above operations?

[2]
A. 8, 10 B. 8, 6
C. 18, 14 D. 6, 8
14 Which SQL statement correctly calculates the average age of students grouped by
gender?
A. SELECT gender, AVG(age) FROM students GROUP BY gender;
1
B. SELECT gender, AVG(age) FROM students HAVING gender;
C. SELECT gender, AVG(age) WHERE age > 18;
D. SELECT gender, AVG(age) FROM students GROUP BY age;
15 Which function is used to display the unique values of a column of a table?
A. sum() B. unique() 1
C. distinct() D. return()
16 Which SQL aggregate function is used to count the number of unique values in a
column?
1
A. COUNT(*) B. COUNT(DISTINCT)
C. DISTINCT(COUNT) D. COUNT(UNIQUE)
17 The __________ is a mail protocol used to retrieve mail from a remote server to a
1
local email client.
18 Unique physical address of each NIC card is called __________.
A. IP address B. MAC address 1
C. HOME address D. STATIC address
19 The IP (Internet Protocol) of TCP/IP transmits packets over Internet using ________
switching. 1
a) Circuit b) Message c) Packet d) All of the above
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 Consider the following code:
x = 25
def study( ):
global x
x+ = 50 1
print(x)
study()
Assertion (A): 75 will be the output of above code.
Reason (R): Because the x used inside the function study( ) is of global scope
21 Assertion (A): The GROUP BY clause in SQL is used to group rows that have the same
values in specified columns.
1
Reasoning (R): The GROUP BY clause is used to filter rows before the result set is
returned.
Q. No. Section – B (7 x 2 = 14 Marks) Marks
22 Write a function word_count(sentence) that takes a sentence (string) as input and 2
returns a dictionary where the keys are the unique words from the sentence and the
values are the number of times each word appears. For example, if the input is "hello
world hello", the function should return {'hello': 2, 'world': 1}
23 Give two examples of each of the following: 2
A. Logical operators B. Membership operators
24 A) Write the python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
[3]
(i) To remove an element at index 2 in a list L
OR

(ii) To check whether a string named text ends with ‘ce’.

B) Write the python statement to import the required module and (using built-in
function) to perform following tasks
(i) To calculate the cosine of variable angle
OR
(ii) To generate a random integer between 1 and 100
25 Write a function countNow (PLACES) in Python, that takes the dictionary, PLACES as 2
an argument and displays the names (in uppercase) of the places whose names are
longer than 5 characters.
For example, Consider the following dictionary
PLACES={1: "Delhi"', 2: "London", 3: "Paris" ,4: "New York", 5: "Doha" }
The output should be:
• LONDON
• NEW YORK
26 The code provided below is intended to generate and print the Fibonacci series for 2
the first 10 elements. However, there are syntax and logical errors in the code.
Rewrite it after removing all errors. Underline all the corrections made.
define fibonacci()
first=0
second=1
print(“first no. is”, first)
print(“[Link],second)
for a in range (1,9):
third=first+second
print(third)
first,second=second,third
fibonacci()
27 (I) 2
A) Which key constraint is used to establish a link between two tables.
OR
B) What type of constraint must be applied to a column to ensure that
every entry in that column must contain a value (i.e., no NULL values
are allowed)?

(II)
A) Write an SQL command to add a column “email” in customer table.

OR
B) Write an SQL command to delete the column C_Name from the customer
table.

28 (I)Differentiate between HTML and XML. 2


OR
(II)
A. Expand the following:
(i) SMTP (ii) VoIP

[4]
B. Give one disadvantage of Star topology.
Q. No. Section – C (3 x 3 = 9 Marks) Marks
29 Write a Python function that finds and displays all the lines that end with a question
mark (?) from a text file "[Link]".
OR 3
Write a Python function that reads a text file "[Link]" and displays all the lines
that do not contain the word "error".
30 You have a list SongList where each element represents a song record in the format
[SongName, Artist, Duration]. Write Python functions to operate on the stack
FavSongs.
(i) Push_element(SongList, FavSongs): Push the songs and their artist names that
have a duration greater than 3.5 minutes to the stack.
(ii) Pop_element(FavSongs): Pop and display the songs until the stack is empty, then
print "Stack Empty"
(iii)peek(FavSongs): This function displays the topmost element of the stack without
deleting it. If the stack is empty, the function should display 'None
OR
Write a function filter_greater_than(N, threshold) that accepts a list of integers and 3
a threshold value, pushing only those integers greater than the threshold into a stack
called FilteredNumbers.
Implement following functions
pop_filtered(FilteredNumbers) - This function removes and returns the top element
from the FilteredNumbers stack. If the stack is empty then returns None.
Display(FilteredNumbers): This function displays all element of the stack without
deleting them. If the stack is empty, the function should display None.
For example:
If the integers input into the list `N` are:
N = [1, 10, 5, 8, 20, 15, 30] and threshold=10
Then the stack `FilteredNumbers` should store: [20,15,30]
31 Predict the output of the following code:
d = {"apple": 15, "banana": 7, "cherry":9,"apple":20}
str1 = ""
for key,value in [Link]():
str1 = str1 + str(key)+"@"+str(d[key]) + str(value) + "\n"
str2 = str1[:-1]
print(str2)
OR
Predict the output of the following code: 3
numbers = [3, 7, 4]
for I in numbers:
for j in range(1, I + 1):
if j % 2 == 0:
print(j, '*', end="")
else:
print(j, '#', end="")
print()
Q. No. Section – D (4 x 4 = 16 Marks) Marks
32 A) Rishi has been entrusted with the management of the Employee Database. He
4
needs to access some information from the EMPLOYEES table for a survey

[5]
analysis. Help him extract the following information by writing the desired SQL
queries as mentioned below.

Emp_ID Name Department Joining_Date Salary City

2001 Rahul IT 2021-06-15 55000 Mumbai

2002 Sneha HR 2019-08-22 48000 Delhi

2003 Arjun Marketing 2020-01-10 62000 Banglore

2004 Meena Finance 2018-11-05 71000 Chennai

2005 Vikram IT 2022-03-18 54000 Hyderabad

Note: The table contains many more records than shown here.

Write the following queries:


(I) To display the total number of employees in each department.
(II) To display employees who joined after January 1, 2020.
(III) To display the details of employees sorted by their salary in descending order
while calculating a 10% bonus for each employee and displaying the total salary
(salary + bonus) as Total_Salary_With_Bonus.
(IV) To find the employees whose city is either Mumbai or Delhi
OR
B) Write the output of the following queries:
(I) SELECT Department, SUM(Salary) AS Total_Salary FROM Employees GROUP BY
Department;
(II) SELECT Name,city FROM Employees WHERE City LIKE '_%i';
(III) SELECT Emp_ID, Name, Joining_Date FROM Employees ORDER BY Joining_Date
DESC;
(IV) SELECT Name, Salary FROM Employees WHERE Salary < (SELECT AVG(Salary)
FROM Employees);
33 A CSV file named [Link] has the structure [ModelNo, Brand, Price].

i. Write a user-defined function add_camera() to input data for a camera record


and add it to [Link]. 4
ii. Write a function in Python to read and display the details of all cameras that are
priced between 15000 and 40000 from [Link], and display the number of
cameras in this range.
34 Write the outputs of the SQL queries (a) to (d) based on the relations Teacher and
4
Placement given below:

[6]
a) Write an SQL query to calculate the average salary of teachers in each
department
b) Write an SQL query to find the maximum and minimum dates of joining for
teachers in the Teacher table.
c) Write an SQL query to retrieve the names, salaries, departments, and
placement locations of teachers who earn more than 20,000.
d) i) Write a SQL query to list the names and placement locations of female
teachers.
OR

ii)Write a SQL query to count the number of female teachers in each department
35 Keshav wants to write a program in python to display some records from the CRICKET
Table of SPORTS Database. The MySQL server is running on LOCALHOST and the login
credentials are as following:
Host: localhost
Username – root
Password – sports
The columns of the CRICKET table are described below:
4
pid (Player ID) – integer
pname (Player Name) – string
innings (Innings Played) – integer
runs (Runs Scored) – integer
wickets (Wickets taken) – integer
Help him Write a program to display the names of players who have scored more
than 5000 runs.
Q. No. Section – E (2 x 5 = 10 Marks) Marks
36 Consider a binary file [Link] containing a dictionary with multiple
elements. Each element is in the form
EID:[ENAME, EDEPARTMENT, SALARY] as a key pair where:
- EID – Employee ID
- ENAME – Employee Name 5
- EDEPARTMENT - Department
- SALARY – Employee Salary

[7]
(I) Write a function to input the data of a employee and append it in a binary file.
(II) Write a user-defined function, find_employees(salary), that accepts a salary value
as a parameter and displays all records from the binary file [Link] where
the employee's salary is greater than the salary value passed as a parameter.
(III) Write a function to update the salary to 100000 of candidates whose department
is “IT”.
37 XYZ Media house campus is in Delhi and has 4 blocks named Z1, Z2, Z3 and Z4. The
tables given below show the distance between different blocks and the number of
computers in each block.
Block Z1 to Z2 80m
Block Z1 to Z3 65m
Block Z1 to Z4 90m
Block Z2 to Z3 45m
Block Z2 to Z4 120m
Block Z3 to Z4 60m

Block
Z1 135
Z2 290
Z3 180
Z4 195

The company is planning to form a network by joining these blocks. 5


i. Out of the four blocks on campus, suggest the location of the server that will
provide the best connectivity. Explain your response.
ii. For very fast and efficient connections between various blocks within the
campus, suggest a suitable topology and draw the same.
iii. Suggest the placement of the following devices with justification

a. Repeater b. Hub/Switch
iv. VoIP technology is to be used which allows one to make voice calls using a
broadband internet connection. Expand the term VoIP.
v. A) The XYZ Media House intends to link its Mumbai and Delhi centres. Out of
LAN, MAN, or WAN, what kind of network will be created? Justify your answer.
OR
B) Which hardware device will you suggest to connect all the computers
within each building?

[8]
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2025-26
कक्षा/CLASS: XII समय/TIME : 3 Hours
विषय/ SUBJECT COMPUTER SCIENCE (083) अविकतम अं क/MAX MARKS: 70
General Instructions:

● Please check this question paper contains 35 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 case of MCQ, text of the correct answer should also be written.

प्र.क्र. अं क
Ques प्रश्न Question Marks
No
SECTION A (1 MARK QUESTIONS)
1 1
State whether the following statement is True or False
“It is difficult to identify logical errors in a program”
2 Select the correct output of the code : 1
S=”hello india"
C=[Link]()
print(C)
(a) HELLO INDIA (b) Hello india (c) Hello India (d) hello India
3 Which of the following expressions evaluates to True? 1

a) (5>10) and (12<20) b) (1<5) or (12>14)


c) not ((1<5) or (23>62)) d) not (32>41) and (25==26)
4 What is the output of the given code? 1
s1=’KVS’
s2=’@@’
print([Link](s2))
a) K@V@S b) @KVS@ c) K@@V@@S d) None of these
5 What will be the output of the following code snippet? 1
s= "Good Morning"
print(s[-3::-2])
6 Which of the following statement(s) would give an error after executing the following 1
code?
T=(10,20,30,40,50) # Statement 1
print(T) # Statement 2
T=(1,2,3,4,5) # Statement 3
T[1]= 20 # Statement 4
T=T+(60,70) # Statement 5
a. Statement 1 b. Statement3 c. Statement 4 d. Statement 5
7 1
Given the following dictionary
Day={1:"January", 2: "February", 3: "March", 4:”April”}
Which statement will return "March".
(a) [Link]() (b) [Link](2) (c) [Link](3) (d) [Link]("March")

8 What does [Link](x) do in a python program? 1


(a) Remove the element at index x from a list
(b) Removes the first occurrence of value x from the list
(c) Removes all occurrences of value x from the list
(d) Removes the last occurrence of value x from the list
9 _________ is a non-key attribute, whose values are derived from the primary key of some 1
other table.
(a) Foreign Key (b) Primary Key (c) Candidate Key (d) Alternate Key
10 1
Which of the following function header is correct?
a) def fun(a=1,b):
b) def fun(a=1,b,c=2):
c) def fun(a=1,b=1,c=2):
d) def fun(a=1,b=1,c=2,d):
11 State whether the following statement is True or False: 1
The else part of try-except-else be executed when an exception occurs.
12 What will be the output of the following code? 1
a = 20
def display():
global a
a = a *2
print(a, end='#')
display()
a=15
print(a , end='%')
(a) 15%40# (b) 15#40% (c) 40#15% (d) 40%15#
13 Which SQL keyword is used to retrieve only unique values? 1
(a) DISTINCTIVE (b) UNIQUE (c) DISTINCT (d) DIFFERENT
14 What will be the output of the query? 1
SELECT Empname, Salary FROM Employee WHERE Salary IS NOT NULL;
(a) Empname and Salary of all employees whose salary is known
(b) Details of all employees whose salary is NOT NULL
(c) Names of all employees whose salary is NOT NULL
(d)Number of employees whose salary is NOT NULL

15 Which of the following is a DML Command? 1


(a) CREATE (b) DROP (c) DELETE (d) Both a and b
16 Which clause is used to arrange the records of a table in ascending or descending order? 1
(a) ASC ORDER (b) ARRANGE (c) ORDER BY (d) BY ORDER
17 Which protocol establishes a dedicated and direct connection between two 1
communicating devices?
a) HTTP b) FTP c) PPP d) SMTP
18 Which network device is used to amplify the signals to transmit them over longer 1
distances?
(a) Modem (b) Gateway (c) Switch (d) Repeater
19 What does the acronym MAN stand for? 1
a) Metropolitan Area Network c) Multi Area Network
b) Magnetic Access Network d) Multi –Access Net
Q 20 and 21 are ASSERTION AND REASONING based questions. Mark the correct 1
choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true but 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):- If the arguments in a function call statement match the number and order 1
of arguments as defined in the function definition, such arguments are called positional
arguments.
Reasoning (R):- During a function call, the argument list first contains positional
argument(s) followed by default argument(s).
21 Assertion(A): SQL SELECT's GROUP BY clause is used to divide the result in groups. 1
Reason(R): The GROUP BY clause combines all those records that have identical values in
a particular field or in group by fields.
SECTION B (2 MARK QUESTIONS)

22 Rewrite the following code in Python after removing all syntax and logical error(s) : 2
Underline each correction done in the code.
Marks = ( 35,40,56,23,64)
For I in Marks:
if I>23
print(Failed)
else
print(Not Failed)
23 Evaluate the following Python expressions : 2
(a) 2 * 3 + 4 ** 2 + 5 // 2
(b) 6 < 12 and not (20 > 15) or (10 > 5)
24 If A=[10,20,30,40,50,60,70,…. ], and B=[2,4,6,8,2,4,6,8, . . .], then 2
(Answer using built-in functions only)
I.
a) Write a statement to find the position of the first occurrence of 4 in B.
OR
b) Write a statement to delete an elements 30 from the list A.
II.
a) Write a statement to insert an element 5 at an index 3 in the list B
OR
b) Write a statement to sort the elements of list A in descending order.

25 Write a function modifyList(L,n) in Python, which accepts a list L of numbers and n is a 2


numeric value. Function should:
• Add 5 to all the values divisible by n
• Subtract 5 from all values not divisible by n
• Display the modified list
Example:
If L= [ 10,11,13,15,20,2] and n=5 then
the function should print [15,6,8,20,25,-3]

26 Write a function DisplayMarks (Student) in python that takes the dictionary, Student as an 2
argument. Display the name of the students whose marks is more than 90
Consider the following dictionary
Student={“Rahul”:95, “Sai” : 80 ,”Satwik”:75, “Shiv” :92}
The output should be:
Rahul
Shiv
27 I. A) Write an SQL command to delete a column Marks from a table STUDENT. 2
OR
B) Write an SQL command to change the data type of marks attribute of a table
STUDENT from int to float.
II. A) Write an SQL command to delete all the records from a table EMPLOYEE.
OR
B) Write an SQL command to delete a database SCHOOL from the server
28 (a) Write the difference between hub and switch. 2
OR
(b)
i. Expand the following: FTP,TCP /IP
ii. Give one disadvantage of Bus topology.
SECTION C (3 MARK QUESTIONS)

29 Write a python function that displays all the words starting with a vowel from a text file 3
‘[Link]’.
OR
Write a python function that counts and displays the number of words starting with ‘a’ or
‘A’ in each line of a text file ‘[Link]’
30 A. Consider a Nested List ‘Stationery’ in which all the elements are lists of the format – 3
[ItemID, ItemName, Price, Quantity]. Write the following user defined functions in python
to perform the task specified on the stack named ‘items’ which is initially an empty list.
• Push_item(Stationery) – It takes nested list Inventory as argument and pushes records of
those items onto stack which have quantity > 100.
• Pop_items(Stationery) –It repeatedly pops the top element of stack and displays it.
Appropriate message should be displayed when there are no more elements left in the
stack.
• Peep_items(Stationery)- This function displays the topmost element of the stack without
deleting it. If the stack is empty, the function should display 'None'.

For example:
Stationery = [[101, ‘Pen’, 10, 120],
[102, ‘Pencil’, 10, 100],
[103, ‘Eraser’, 5, 90],
[104, ‘Notebook’, 20, 52],
[105, ‘Marker’, 30, 130],
[106, ‘Sharpener’, 5, 110]]
After execution of Push_Items(Stationery), Stack should contain:
[[101, ‘Pen’, 10, 120], [105, ‘Marker’, 30, 130], [106, ‘Sharpener’, 5, 110]]
The output after Pop_Items(Stationery) should be:
[106, ‘Sharpener’, 5, 110]
[105, ‘Marker’, 30, 130]
[101, ‘Pen’, 10, 120]
Stack Empty
OR
B. Write a function in Python Square(N) which takes a list N as the parameter and pushes
the squares of all the odd numbers and cubes of all the even numbers in a stack.
Write a popstack() to pop the topmost number from the stack and returns it. If the stack is
already empty, the function should display "Empty".
Write a function Dsiplay() which displays the elements present in the stack without
deleting them, if the stack is empty the function should display ‘None’.

31 Write the output of the following python code. 3


msg= ‘Hello World123’
n = len(msg)
new_msg = ‘’
for i in range(0,n):
if not msg[i].isalpha():
new_msg = new_msg + ‘@’
else:
if msg[i].isupper():
new_msg = new_msg + msg[i]*2
else:
new_msg = new_msg + msg[i]
print( new_msg)
OR
Write the output of the following python code.
L=[3,10,6,13]
for I in L:
for J in range(I%2,5):
print(J,'#',end='')
print()
SECTION D (4 MARKS QUESTIONS)

32 Consider the BIKES table given below: 4

BIKE_ID BIKENAME BRAND PRICE CC

B1 DUKE KTM 350000 390

B2 VERSEYS KAWASAKI 730000 650

B3 BENELLI BENELLI 630000 600

B4 NINJA KAWASAKI 7700000 1000

B5 S1000RR BMW 2000000 1000

A. Write the following queries:


i. To display the total Price of the bikes, whose price is more than 60000.
ii. To display the details of the bikes in alphabetical order of the bike names.
iii. To display the distinct brand names from the Bikes table.
iv. Display the maximum CC of all the bikes whose brand is ‘BMW’.
OR
B. Write the output:
i. Select * from bikes where cc>600;
ii. Select Bikename, Brand from bikes where price<70000;
iii. Select max(Price), min(Price) from Bikes;
iv. Select count(*) , brand from Bikes group by brand;
33 Vijay has created a csv file ‘[Link]’ to store player name, matches and goals 4
scored.
Write a program in python that defines and calls following user defined functions.
i. addPlayer(name, matches, goals) : Three parameters – name of the player, matches
played and goals scored are passed to the function. The function should create a list
object and append it to the csv file.

ii. AverageGoals( ): The function should read the csv file and display the name of the
player with their average goals (goals/matches).

34 Consider the tables COMPANY and CUSTOMER and extract the following 4
information by writing the desired SQL queries as mentioned below
COMPANY
CID NAME CITY PRODUCTNAME

101 LG KOLKATA TV
102 HP DELHI LAPTOP
103 DELL MUMBAI KEYBOARD
104 ACER DELHI LAPTOP
105 ASUS KOLKATA LAPTOP
CUSTOMER
CUSTID NAME PRICE QTY CID
100011 RAHUL 40500 10 101
100012 SAHIL 3000 20 103
100013 SATWIK 55000 3 104
100014 SARTHAK 45000 20 105

I. To display the company names whose price is less than 43000


II. To add one column totalprice with decimal (10,2) to the table customer
III. To increase the price of the customers whose name starts with ‘S’ by 200
IV. A. To display the Customer names in reverse alphabetical order
OR
B. To display the number of products available in each city.
35 A student created a table Inventory in MYSQL database, warehouse with following 4
structure:
Inv_No(Inventory Number )- integer
Inv_name(Name) – string
Inv_Entry(Date )
Inv_price – Decimal
Note the following to establish connectivity between Python and MySQL:
Username - root
Password - 12345
Host - localhost
Write the following Python function to perform the specified operation:
InsertRecord () : To accept the inventory details from user and insert a new row into the
table. The function should then retrieve and display the records.
SECTION E (5 MARK QUESTIONS)

36 Shweta had stored all her passwords in one binary file named ‘[Link]’. The 5
passwords were stored in following format:
[app_name, username, password]
i. Write a function that accepts title as a parameter and displays the username
and password for that particular app.
ii. Write a function to read the data and display all the app names which start
with ‘A’
iii. Write a function to add a new app details to the binary file.
37 5
Shalimar Solutions is setting up a campus in Mumbai. The campus have four Blocks
Alpha, Beta, Gamma and Theta. Suggest the best possible solutions for their questions (a)
to (e) based on the information given below.
Blocks Distance(m)
Alpha to Beta 25
Alpha to Gamma 75
Alpha to Theta 45
Beta to Gamma 80
Beta to Theta 125

Block No. of Computers


Alpha 120
Beta 45
Gamma 25
Theta 30
a) Suggest the most appropriate block to house the server. Justify your answer.
b) Which Hardware/Software can be installed prevent unauthorized access to server?
c) Suggest the best wired transmission medium and draw the cable layout
diagram to connect the four blocks.
d) The company doesn’t want to use any wired media for connecting the computers within
the Alpha block. Which device can be used to provide wireless access, given that all the
machines in this block are wi-fi enabled.
b) A. Which network device is used to connect all the computers present in each block?
i. Repeater ii. Router iii. Hub/Switch iv. Bridge
OR
B. Is there a requirement of repeater in the given cable layout? Justify
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2025-26
कक्षा/CLASS: XII समय/TIME:3 Hours
विषय/ SUBJECT COMPUTER SCIENCE (083) अविकतमअंक/MAX MARKS: 70
General Instructions:
 Please check this question paper contains 37 questions.
 The paper is divided into 5 Sections - A, B, C, D and E.
 Section A, consists of 21 questions (1to21). Each question carries 1 Mark.
 Section B, consists of questions (22to28). Each question carries 2 Marks.
 Section C,c onsists of 3 questions (29to31). Each question carries 3 Marks.
 Section D, consists of 4 questions (32to35). Each question carries 4 Marks.
 Section E, consists of 2 questions (36to37). Each question carries 5 Marks.
 Al programming questions are to be answered using Python Language only.
 In case of MCQ, text of the correct answer should also be written.
प्र.क्र. अंकMa
QuesN प्रश्नQuestion rks
o
SECTION A (1 MARK QUESTIONS)
1 State True or False: 1
“In python the keys of a dictionary must be of mutable type”

2 Select the correct output of the code : 1


Str="kendriyavidyalaya sangathan@2024"
A=[Link]()
print(A)
(a) KENDRIYA VIDYALAYA SANGATHAN@2024
(b) KendriyaVidyalaya Sangathan@2024
(c) Kendriyavidyalaya sangathan@2024
(d) kendriyaVidyalaya Sangathan@2024
3 Which of the following expressions evaluates to True? 1
a) not False and True b) True and False
c) not (True or False) d) not True or False
4 Select the correct output of the code : 1
S="21st Century Skills"
A=[Link](“t”)
print(A)
a) ['21s', ' Cen', 'ury Skills'] b) ['21s', 't', ' Century Skills']
c) ('21s', ' Cen', 'ury Skills') d) ('21s', 't', ' Century Skills')
5 1
What will be the output of the following code snippet?
s= "Jai Hind Jai Bharat"
print(s[:15:2])
6 What will be the output of the following code? 1
T=(1,2,3,4,5)

Page 1 of 8
T=T+(6,)
print(T[::-1])
a) (5,4,3,2,1) b) (0,1,2,3,4)
c) (6,5,4,3,2,1) d) Error
7 Which of the following Python statements will perform the same operation on the 1
dictionary, “articles” if
articles={"pencil":1, "book":3, "notebook":5}
i. [Link]("book")
ii. del articles ["book"]
iii. articles. update({"pencil ":1," notebook ":5})
a. i, ii, iii
b. i, ii
c. i, iii
d. ii, iii
8 What does extend() mehtod of a list do in a Python? 1
a) Appends the element passed as argument to the end of the given list
b) Appends each element of the list passed as argument to the end of the given list
c) Increases each element of the list by the element passed as argument
d) Changes the elements of the list with the element passed as argument
9 Choose the correct statement that better explains the term, Alternatekeys in a relational 1
database
a. The set of all attributes which are eligible to be chosen as thePrimary key
b. The set of all attributes which are eligible to be chosen as theForeign key
c. The set of all attributes in a relation, which were eligible to become a primary key, but
are not chosen as primary key
d. The set of all attributes in a relation, which were eligible to become a primary key, but
are not chosen as foreign key
10 What is the output of the following code snippet? 1
def add(a, b=10):
return a + b
print(add(5))

(a) 5 (b) 10 (c) 15 (d) Error


11 1
State whether the following statement is True or False:
One block of except statement can handle multiple exceptions.

12 What will be the output of the following code? 1


a=100
def add(a,b=5):
a = a+b
print(a, end='#')
add(25)
add(30,25)
print(a,end=’@’)
(a) 30#55#55@ (b) 55#100#30# (c) 30#55#100@ (d) 55#30#100@
13 ____________ is the number of columns in a relation 1
a) Degree b) Cardinality c) Attribute d) Domain

Page 2 of 8
14 What will be the output of the query? 1
SELECT MAX(Marks) FROM Student where class=12;
(a) Displays the highest marks scored
(b) Displays the highest marks scored by 12th class students
(c) Displays the details of the students who gets highest marks
(d) Displays the details of the students who gets highest marks in class 12
15 In a table in MYSQL database, an attribute A of datatype varchar(30) has the value 1
"KendriyaVidyalaya". The attribute B of data char (15) has "Sangathan". How many
characters are occupied by attribute A and B?
a. 30,9 b. 18,9 c. 18,15 d. 30,15
16 Which clause is used to match patterns in the data in a table? 1
(a) WHERE….LIKE(b) LIKE….WHERE
(c) PATTERN(d) MATCH LIKE
17 Which of the following is email protocol?
(a) TCP (b) IP (c) SMTP (d) POP
18 Which network device plays an important role in star topology?
(a) Modem (b) Gateway(c) Switch(d) Repeater
19 Which type of cable transmits data in the form of light signals?
Q 20 and 21 are ASSERTION AND REASONING based questions. Mark the correct 1
choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true but 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): Default arguments are related to the function calls. 1
Reason(R): Default values indicate that the function argument will take that value if no
argument value is passed during the function call.
21 Assertion(A): In SQL aggregate function Avg() calculate the average value of a set of 1
values and produce a single result.
Reason(R): The aggregate functions used to perform common arithmetic tasks are SUM(),
MAX(), MIN(), etc
SECTION B (2 MARK QUESTIONS)
22 Predict the output of the python code given below 1+1=2
N=5
if N!=1:
i=1
while i<N:
print('* '*i)
i=i+1
while N>1:
print('* '*N)
N=N-1
print('* ', end='')
else:
print('* ', end='')

Page 3 of 8
23 The following Python code is intended to calculate the sum of all even numbers in a given 2
list. Identify and correct the errors in the program. Rewrite the correct program underlining
all the corrections.

numbers = [1, 2, 3, 4, 5, 6, 7, 8]
sum even = 0
for num in numbers
if num % 2 = 1:
sum even += num
print "Sum of even numbers:", sum_even

24 I. 2
a. Why a list in Python is mutable?
OR
b. How can you create an empty list in Python?

II. a. Name two operations that can be performed on list.


OR
b. Write a function used to find the largest element from the list
25 Write a user defined function in Python named showGrades (S) which takes the 2
dictionary Sas an argument. The dictionary, S contains Name: [Eng, Math,
Science] as key:value pairs. The function displays the corresponding grade
obtained by the students according to the following grading rules-
Average of Eng, Math, Science Grade
>=90 A
<90 but >=60 B
<60 C

For example: Consider the following dictionary


S={"AMIT": [92,86,64], "NAGMA": [65,42,43], "DAVID": [92,90,88]}
The output should be:
AMIT - B
NAGMA - C
DAVID – A
26 Write a function, Words5(Str), that takes a string as an argument and returns a tuple 2
containing each word which contains 5 letters from the given string.
For example, if the string is "Once upon a time there lived a fox in a jungle”,
the tuple will have (“there”,”lived”)
27 I. A) Write an SQL command to add a column Marks of int data type to a table 2
STUDENT.
OR
B) Write an SQL command to add a record (1234,’Sahil’, 12, 40) to the table
STUDENT which has the attributes Admno-int, Sname-varchar(50), Class-int,
Marks-int
II. A) Write an SQL command to set a default value ‘M’ to an attribute Gender
(char) of a table EMPLOYEE.
OR
B) Write an SQL command to delete a table EMPLOYEE from the server

Page 4 of 8
28 (A) What is the difference between HTTP and FTP? 2
OR
(B) Expand the following: HTML, PPP

SECTION C (3 MARK QUESTIONS)

29 Write a python function that displays all the lines starting with a vowel from a text file 3
‘[Link]’.
OR
Write a python function that displays the lines which contain more than 5 words in a text
file ‘[Link]’.
30 A. i. Write a function in Python, Push(Electronics) where, Electronicsis a dictionary 3
containing the details of Electronic products– {Ename:price}.
The function should push the names of those Electronic productsin the stack whose price is
greater than 30000.
For example: If the dictionary contains the following data:
Electr = {“Mobile”:20000, "TV":30500, "Laptop":45000, "Smartwatch": 2000}

The stack should contain


Laptop
TV

ii. Write a function Pop() to pop the topmost number from the stack and returns it. If the
stack is already empty, the function should display "Empty".

iii. Write a function Peep() to display the topmost element of the stack without deleting it.
If the stack is empty, the function should display 'None'.
OR
B. i. Write a function Multiplesof5(L) which accepts a list of integers in a parameter `L`
and pushes all those integers which are divisible by 5 from the list `L` into a Stack named
`MultiplesOf5`.

ii. Write a function Popstack() to pop the topmost number from the stack and returns it. If
the stack is already empty, the function should display "Empty".

iii. Write a function Dispstack() to display all element of the stack without deleting them. If
the stack is empty, the function should display 'None'.
31 msg= 'Good Morning@KVS' 3
n = len(msg)
new_msg = ''
for i in range(0,n,2):
if not msg[i].isalpha():
new_msg = new_msg + '$'
else:
if msg[i].isupper():
new_msg = new_msg + msg[i-1]
else:
new_msg = new_msg + msg[i]

Page 5 of 8
print( new_msg)
OR
L=[1,5,7,3]
for I in L:
for J in range(1,I):
print(J*2,'#',end='')
print()
SECTION D (4 MARKS QUESTIONS)

32 Consider the table PRODUCTS given below: 4

P_ID P_NAME BRAND RATING PRICE


P0_1 MONITOR DELL 4.5 5000
P0_2 MOBILE REALME 4.4 18000
P0_3 KEY BOARED HP 4.7 700
P0_4 REFRIDGERATOR LG 4.9 61000
P0_5 LAPTOP ACER 4.6 54000

A. Write the following queries:


i. To display the Priceof theproducts, whose rating is more than 4.5.
ii. To display the details of the productsin reverse alphabetical order of the product
names.
iii. To display the brand names which start with ‘A’ from the Products table.
iv. To display the average rating of all the products.
OR
B. Write the output for the following SQL queries:
i. Select * from products where brand = ‘Dell’;
ii. Select P_Name, Brand from products where price<5000 and rating>4.4;
iii. Select sum(Price) as TOTAL from products;
iv. Select p_name, brand fromproducts where brand like’%L%;

33 Consider a CSV file ‘[Link]’ to store EmpId, Empname, Salary and Designation 4
Write the following Python functions to perform the specified operations on this file:
a) Read the data from the file and display the name of the employees whose salary is
more than 30000.
b) Count the records of the employees whose designation is PGT
34 Consider the tables EMPLOYEE and DEPARTMENT and extract the following 4
information by writing the desired SQL queries as mentioned below
EMPLOYEE

Page 6 of 8
EID E_NAME E_SALARY DOJ D_ID

E_01 PAWAN 52000 01-01-2010 100025


E_02 PARDHU 26000 03-04-2012 100030
E_03 PRASANTH 28000 05-05-2016 100035
E_04 PURNA 82000 31-08-2014 100030
E_05 GS BHARGAV 32000 12-01-2013 100035
DEPARTMENT

D_ID D_NAME
100025 ENGLISH
100030 SST
100035 SCIENCE
I. To display all the details of
the employees whose salary is between 25000 and 50000 from both the
tables.
II. To increase the salary of all the employees whose Dept ID is 100025 by
2500.
III. To delete the records of employees whose Date of joining is before 2013
IV. [Link] display the employee name along with their department names in
alphabetical order of employee names.
OR
B. To display the number of employees in each department.
35 4
A table, named PRODUCTS, in STORE database, has the following structure:

Field Type
ProdNo Int
Pname Varchar(30)
Brand Varchar(20)
Price Float
Write the following Python function to perform the specified operation:
Update (): To increase the price of all the products by 200. And then display the updated
data
Note the following are details to establish connectivity between Python and MySQL:
Username - root
Password - 12345
Host - localhost
SECTION E (5 MARK QUESTIONS)

36 The details of patients are stored in a binary file "[Link]" which has structure (PID, 5
NAME, DISEASE,VISIT_DATE).

i. Writea function in Python that would read contents of the file "[Link]" and

Page 7 of 8
display the details of those patients who have the DISEASE as 'COVID-19'.
ii. Write a function to input the data of a patient and append it to the file.
iii. Write a function to update the visit date of a patient whose name is passed as a
parameter in the given binary file.

37 5
Oxford Publications setting up an industry in New Delhi having offices at three different
locations Back Office, Maintenance Lab, Production Lab with its head office in Mumbai.
Suggest the best possible solutions for their questions (a) to (e) based on the information
given below.

Blocks Distance(km)
Block No. of
Maintenance Lab to 110 m
Computers
Production Lab
Back Office 135
Maintenance Lab to 75 m
Maintenance Lab 75
Back Office
Production Lab 25
Maintenance Lab to 1450 km
Head office 42
Head Office
Back Office to 80m
Production Lab

(i) Suggest the type of network required (out of LAN, MAN, WAN) for connecting
each of the following office units.
• Maintenance Lab and Back Office
• Head office and Production Lab.

(i) Where should be placement of hub/switch?


(ii) Which building is suitable to install the server with suitable reason?
(iii) Suggest a cable/wiring layout for connecting the industry’s local office units
located in New Delhi.
(iv) a. Which of the following communication medium will you suggest to be procured
by the industry for connecting their local office units in New Delhi for very
effective (high speed) communication?
A)Telephone cable B) Ethernet cable C)Optical fibre
OR
b. Suggest an effective method/technology for connecting the company’s office unit
located in New Delhi with other offices.

Page 8 of 8
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2024-25
CLASS: XII TIME:03 HOURS
SUBJECT: COMPUTER SCIENCE Maximum Marks: 70
General Instructions:
 This question paper contains 37 questions.
 All questions are compulsory. However, internal choices have been provided in some questions.
 The paper is divided into 5 Sections – A, B, C, D and E.
 All programming questions are to be answered using Python Language only.
[Link] Question Marks
Section – A (21 x 1 = 21 Marks)
1 Which of the following is an invalid variable in python
1
a. _val1 b. Value_1 c. true d. New@val
2 Identify the output of the following code snippet:
text = "ExploringDataScience"
N = [Link]().count('E')
text = "Data" + text[4:10] +str(N) 1
print(text)
A. DataoringD3 B. DATAORINGD3
C. DATAORINGD1 D. DataoringD1
3 Evaluate the following expression
print(not (10 // 5 ** 2) and 45.0 % 4 or 50 / 10 + 3)
A. False B. 1 1
C. 8.0 D. 1.0
4 What is the output of the expression?
s = "Learn-Python3Programming"
s = [Link]('n')
result = s[0] + "+" + s[1] + "+" + s[2][:6:-1] 1
print(result)
A. Lea+-Python+imm B. Lea+-Pytho+immar
C. Lear+-Pytho+imm D. Lea+-Pytho+
5 What will be the output of the following code snippet?
Str1= "PYTHON PROGRAMMING LANGUAGE" 1
print(Str1[-5:10:-3])
6 What will be the output of the following code?
tup = (5,)
result = [tup] * 3
print(result) 1
A. [5, 5, 5] B. (5,), (5,), (5,)
C. [(5,), (5,), (5,)] D. Error
7 What will be the output of the following code?
data_dict = {'m': 3, 'n': 7}
data_dict['o'] = 4 1
print(data_dict)
A. {'m': 3, 'n': 7, 'o': 4} B. KeyError
C. {'m': 3, 'n': 7, 'o': 11} D. ValueError
8 What does the [Link](sub) method do?
A. Returns the first occurrence of the substring in the string 1
B. Returns the last occurrence of the substring in the string
[1]
C. Replaces all occurrences of the substring with another string
D. Counts the number of occurrences of the substring in the string
9 In a library management system, consider a Books table and an Authors table. The
Books table has a foreign key Author_ID that references the primary key Author_ID in
the Authors table.
What does this foreign key relationship ensure?
1
A. Each book must have a corresponding author listed in the Authors table.
B. Authors cannot exist without having written any books.
C. Every author is required to have at least one book associated with them.
D. Books can be added to the system without linking them to an author.
10 What is the primary use of the dump() function in Python?
A. To load data from a file into memory.
B. To serialize an object and write it to a file. 1
C. To deserialize an object and write it to a file.
D. To read a file and return its content.
11 When denominator of a division expression is zero___________ Exception is raised.
a. DivideByZero b. FileNotFound 1
c. EOFError d. ValueError
12 What will be the output of the following code?
c = 10
def update_value(value):
global c
if value % 2 == 0:
c += value * 2
else: 1
c += value
print(c ,end=' | ')
update_value(4)
update_value(7)
A. 8|7| B.18|17|
C.17|18| D.18|25|
13 Which SQL command can change the cardinality of an existing relation? 1
14 In which scenario will the following SQL statement return results?
SELECT gender, COUNT(*) FROM students GROUP BY gender HAVING
COUNT(*) > 3;
A. When there are more than three students of any gender. 1
B. When the total number of students is greater than three.
C. When each gender group has more than three members.
D. When the average age of students is greater than three.
15 In SQL, which command is used to modify existing records in a table?
A. MODIFY B. UPDATE 1
C. CHANGE D. ALTER
16 Which aggregate function is used to determine the total number of rows in a table?
A. sum() B. count() 1
C. avg() D. max()
17 Which statement is used to exit a function and return a value?
A. end B. return 1
C. exit D. break
18 Which of the following cables carry data signals in the form of light?
A. Coaxial B. Fiber-optic 1
C. Twisted pair D. All of the these
19 Which switching method is commonly used in Voice over IP (VoIP) communications?
A. Circuit switching B. Packet switching 1
C. Message switching D. Store-and-forward
[2]
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct
choice as:
[Link] A and R are true and R is the correct explanation for A
[Link] 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): Hub is a broadcast device and Switch is a unicast device.
Reason(R): Hub forwards data to all devices, whereas Switch maintains a MAC 1
address table to send data only to the intended device.
21 Assertion(A): The GROUP BY clause is used to group rows that have the same values
into summary rows. 1
Reason(R): GROUP BY is always used with the ORDER BY clause
Section – B (7 x 2=14 Marks)
22 Write a function reverse_words(sentence) that takes a sentence (string) as input and 2
returns a new sentence with the words in reverse order.
For example, if the input is "Python is fun", the function should return "fun is Python"
23 Predict the output of the following code: 2
lst=[2,4,6]
a=[]
for i in range(0,3):
lst[i-1]=lst[i]
[Link](lst[i-1])
for i in range(0,3):
print(lst[i],end=' ')
print()
for i in range(0,3):
print(a[i],end=' ')
24 A) Consider the following list of elements and write the output of each question. 2
elements=['apple',200,300,'red','blue','grapes']
i) print(elements[3:5])
OR
ii) print(elements[::-1]
B) Consider the following list exam and write Python statement for the following
questions: exam=[‘english’,’physics’,’chemistry’,’cs’,’biology’]
i) To insert subject “maths” as last element
OR
ii) To display the list in reverse alphabetical order
25 Write a function longWords(L) in Python that takes a list of words L and displays all 2
the words (in upper case) whose length is greater than 5 characters.
Ex: words = ["delhi", "london", "paris", "new york", "doha"]
Output: LONDON
NEW YORK
OR
Write a function maxSales(SALES) in Python that accepts a dictionary SALES where
the keys are product names and the values are total sales amounts. The function should
print the name(s) of product(s) whose sales are above 50,000, in upper case.
Ex: SALES = {"Laptop":72000, "Mouse":15000, "Tablet":55000, "Monitor":48000}
Output: LAPTOP
TABLET
26 The code given below accepts a number as an argument and returns the list of all prime 2
numbers upto that number. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.

[3]
define prime(num):
for i in range(2,n/2+1,1):
if i%num==0:
print(‘Not prime’)
continue
else:
print(‘Prime’)
27 (I) 2
A. What SQL constraint should be used to define a default value for a column if
no specific value is provided when inserting a new record?
OR
B. In SQL, which constraint enforces a relationship between columns in different
tables by ensuring that values in the child table correspond to values in the
parent table?
(II)
A) What type of constraint would you use to ensure that a column's value must
match a specified pattern (e.g., a valid email address format)?
OR
B) Which constraint ensures that the values in a column or group of columns are
unique across the table, but can still allow NULL values?
28 (I) 2
A. Expand the following abbreviations:
(i)POP (ii)HTTPS
B. What is a URL?
OR
(II)Write two points of difference between Circuit Switching and Packet Switching
Section – C (3 x 3 = 9 Marks)
29 A) Write a Python function that extracts all unique words from a text file
"Unique_Words.txt" and writes them to a new file "Unique_Output.txt".
OR 3
B) Write a Python function that reads the content of a text file "[Link]" and
prints all the lines that are longer than 20 characters.".
30 A)You are given a nested list CityList where each element is a list representing a city
record in the format [CityName, Country, Population]. Write the following Python
functions to manipulate the stack MustVisitCities.
(i) Push_element(CityList, MustVisitCities): Push the city records where the
population is more than 1 million.
(ii) Pop_element(MustVisitCities): Pop and display the city records until the stack is
empty, and print "Stack Empty" afterward.
For example: If the nested list contains the following data:
CityList = [['New York', 'USA', 8.4], ['Tokyo', 'Japan', 9.3],['Zurich', 'Switzerland',
0.8], ['Delhi', 'India', 18.6]]
The stack should contain: 3
[['New York', 'USA', 8.4], ['Tokyo', 'Japan', 9.3],['Delhi', 'India', 18.6]]
OR
B) Consider a Nested List ‘Inventory’ in which all the elements are lists of the format
– [ItemID, ItemName, Price, Quantity]. Write the following user defined functions in
python to perform the task specified on the stack named ‘items’ which is initially an
empty list.
• Push_item(Inventory) – It takes nested list Inventory as argument and pushes records
of those items onto stack which have quantity > 100.
• Pop_items() –It repeatedly pops the top element of stack and displays it. Appropriate
message should be displayed when there are no more elements left in the stack.
For example, if
[4]
Inventory = [[101, ‘Pen’, 10, 120],
[102, ‘Pencil’, 10, 100],
[103, ‘Eraser’, 5, 90],
[104, ‘Notebook’, 20, 52],
[105, ‘Marker’, 30, 130],
[106, ‘Sharpener’, 5, 110],]
After execution of Push_Items(Inventory), Stack should contain:
[[101, ‘Pen’, 10, 120], [105, ‘Marker’, 30, 130], [106, ‘Sharpener’, 5, 110]] Top
The output after Pop_Items() should be:
[106, ‘Sharpener’, 5, 110]
[105, ‘Marker’, 30, 130]
[101, ‘Pen’, 10, 120]
Stack Empty
31 Predict the output of the following code:
(i)
s = "Le@rn@Python#24"
m = ""
for i in range(len(s)):
if s[i].isupper():
m=m+s[i]
elif s[i].islower():
m=m+s[i].upper()
elif i % 2 != 0:
m += s[i] * 2
else:
m += s[i-1]
print(m)
OR 3
Predict the output of the following code:
(ii)
x = 25
def modify(s, c=2):
global x
for a in s:
if a in 'qweIOP':
x //= 5
print([Link](),'@',c*x)
else:
x += 5
print([Link](),'#',c+x)
string = 'Pytho'
modify(string,10)
print(x, '$', string)
Section – D (4 x 4 = 16 Marks)
32 A Medical store “Lifeline” is planning to maintain their inventory using SQL to store
the data. 4
• Name of the database –medstore
• Name of the table –MEDICINE

[5]
A)Write the following queries:
(I) To update the content of the row whose ino is 1003 as, iname = “Paracetamol
Tablet ” mcode = 25 and qty = 100.
(II) To count the total number of medicines available in the table
(III) To display all distinct medicine codes in the MEDICINE table
(IV) To display all medicines whose name ends with the letter 'l'
OR
B)Write the output for the following queries:
(I) SELECT * FROM MEDICINE WHERE QTY = (SELECT MAX(QTY) FROM
MEDICINE);
(II) SELECT INAME FROM MEDICINE WHERE MCODE IN (22, 24);
(III) SELECT INO,QTY FROM MEDICINE ORDER BY QTY DESC;
(IV) SELECT MCODE, AVG(QTY) AS Average_Quantity FROM MEDICINE
WHERE QTY >150 GROUP BY MCODE;
33 Avinash is a Python programmer working in a Law firm. For his record he has
created a csv file named [Link] to keep all information about his work. The
structure of [Link] is:
[CaseNo, ClientName, Opposition, Status]
Where
CaseNo – integer, ClientName – string, 4
Opposition – string, Status – string
For efficiently maintaining data of his work he wants to write the following user
defined functions:
Add() – to accept a record from the user and add it to the file at the end.
wonCount() – to count and print the number of cases with the status “Won”
As a Python expert, help him complete the task
34 Write SQL commands for the following queries (a) to (e) based on the relations
Vehicle and Travel given below.
Table: Travel
NO NAME TDATE K COD NO
M E P
101 Janish Kin 2015-11-13 200 101 32
103 Vedika Sahai 2016-04-21 100 103 45
105 Tarun Ram 2016-03-23 350 102 42 4
102 John Fen 2016-02-13 90 102 40
107 Ahmed Khan 2015-01-10 75 104 2
104 Raveena 2016-05-28 80 105 4

Table: Vehicle
CODE VTYPE PERK
M
101 VOLVO BUS 160

[6]
102 AC DELUXE 150
BUS
103 ORDINARY 90
BUS
105 SUV 40
104 CAR 20
a. To display NO, NAME, TDATE from the table Travel in descending order of NO.
b. To display the NAME of all the travelers from the table Travel who are travelling by
vehicle with code 101 or 102.
c. To display the NO and NAME of those travellers from the table Travel who
travelled between ‘2015-12-31’ and ‘2016-04-01’.
d. To display the CODE, NAME, VTYPE from both the tables with distance travelled
(km) less than 90 Km.
OR
e. To display the NAME of those traveller whose name starts with the alphabet ‘R’.
35 A table, named Electronics, in shopdb database, has the following structure:

Write a Python function UpdateStock() to update the quantity of a product in the


ELECTRONICS table based on the product ID. After updating, display all products
where the price is greater than 5000.
Section – E (2 x 5 = 10 Marks)
36 You are provided with an employee record stored in a binary file named
[Link]. Each record contains the following details of an employee:
[Emp_ID,Emp_Name, Department, Salary]
• Emp_ID (integer): Unique ID of the employee
• Emp_Name (string): Name of the employee
• Department (string): Department in which the employee works
• Salary (float): Current salary of the employee 2+3

(I)Write a function to input the data of an employee and append it in a binary file.
(II) Write a Python function that read the employee records from the binary file
[Link]. Check if the salary of each employee is less than 50,000. If the salary
is less than 50,000, increase the salary by 10%.Update the records in the binary file
with the modified salary values
37 ABC Computers decided to open a new office at Banglore, the office consist of Five
Buildings and each contains number of computers. The details are shown below.

[7]
Computers in each building are networked but buildings are not networked so far. The
Company has now decided to connect building also.

(i) Suggest a cable layout for connecting the buildings


(ii) Do you think anywhere Repeaters required in the campus? Why?
(iii) The company wants to link this office to their head office at Delhi
(a) Which type of transmission medium is appropriate for such a link?
OR
(b) What type of network would this connection result into?
(iv) Where server is to be installed? Why?
(v) Suggest the wired Transmission Media used to connect all buildings efficiently.

[8]
KENDRIYA VIDYALAYA SANGATHAN
HYDERABAD REGION
MODEL QUESTION PAPER
2024-25
CLASS: XII समयTIME:03
HOURS
SUBJECT: COMPUTER SCIENCE Maximum Marks:
70
General Instructions:
 This question paper contains 37 questions.
 All questions are compulsory. However, internal choices have been provided in some
questions.
 The paper is divided into 5 Sections – A, B, C, D and E.
 All programming questions are to be answered using Python Language only.
Section A
1 State true or false: 1
The value of the expressions 4/(3*(2 - 1)) and 4/3*(2 - 1) is the same.
2 What is the output of the following code snippet?
text = "HELLO"
text = [Link]('L', 'Z')
print(text)
(a) HEZZO
(b) HELLO
(c) HELO
(d) HZZLO
3 Which of the following evaluates to False?
(a) not(False)
(b) True and False
(c) True or False
(d) not(True)
4 What is the output of the following expression? 1
text = 'Explanation'
print([Link]('a'))
(a)['Expl', 'n', 'tion']
(b)['Expl', 'nation']
(c)('Expl', 'n', 'tion')
(d) Error
5 Which method should I use to convert String "Python programming is fun" to 1
"Python Programming Is Fun"?
a) upper()
b) capitalize()
c) istitle()
d) title()
6 Which of the following functions raises an exception if the key is not found 1
in a dictionary?
a) [Link]()
b) dict[key]
c) [Link]()
d) [Link]
7 Which method in Python is used to remove the first occurrence of a value 1
from a list?
(a) [Link](value)
(b) [Link](value)
(c) [Link](value)
(d) [Link](value)
8 What is the output of following code? 1
l1 = [ [ 4,1] ,[ 2,3] ,[ 3,5] ,[ 6,0.5] ]
[Link]()
print(l1)
a) [ [ 2,3] ,[ 3,5] ,[ 4,1] ,[ 6,0.5] ]
b) [ [ 2,3] ,[ 3,4] ,[ 5,6] ]
c) [ [ 0.5,1] ,[ 2,3] ,[ 3,4] ,[ 5,6] ]
d) [ [ 6,0.5] ,[ 4,1] ,[ 2,3] ,[ 3,5] ]
9 Which of the following attributes can be considered as a choice for the 1
primary key?
a) Street
b) Subject
c) Roll No
d) Name
10 Which clause runs only if no exception occurs? 1
a) finally
b) else
c) try
d) raise
11 def interest(Principle, Time, Rate=3) 1
In the above function call what is the last argument
a. Keyword b. Default c. Postional d. Arbitrary keyword
12 Which function returns the sum of all elements of a list? 1
a) sum ()
b) count ()
c) total ()
d) add ()
13 What is Degree of a relation in Mysql 1
a. No. of Rows b. No. of Columns c. No of Primary keys d. None
14 What will be the output of the query?
SELECT * FROM employees WHERE employee_name LIKE '%son';
(a) Details of all employees whose names start with 'son'
(b) Details of all employees whose names end with 'son'
(c) Names of all employees whose names start with 'son'
(d) Names of all employees whose names end with 'son'
15 Which SQL query is used to retrieve all records from a table named 1
'products'?
(a) SELECT * FROM products;
(b) SHOW products;
(c) RETRIEVE * FROM products;
(d) SELECT ALL IN products;
16 Which aggregate function can be used to find the total number of records in a 1
table?
(A) SUM()
(B) COUNT()
(C) MAX()
(D) AVG()
17 Which protocol is used to send emails over the Internet? 1
(A) HTTP
(B) FTP
(C) SMTP
(D) HTTPS
18 Which device is used to amplify and regenerate signals in a network? 1
(A) Modem
(B) Gateway
(C) Repeater
(D) Router
19 Which switching technique establishes a dedicated communication path 1
between two endpoints for the duration of the transmission?
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 of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true
20 Assertion (A): Python allows us to divide a large program into the basic 1
building blocks known as a function.
Reason (R): The function contains the set of programming statements
enclosed by ( )
21 Assertion (A): The primary key in a database table ensures that all values in 1
a column are unique.
Reasoning (R): A primary key is used to identify records uniquely within a
table, which allows for efficient data retrieval.
Section-B
22 Write a Python function replace_element() that accepts a list L, an old value 2
old_val, and a new value new_val.
 If old_val exists in the list, replace only the first occurrence with
new_val.
 If old_val is not found, print "Element not found".
OR
Write a Python function highest_score() that accepts a dictionary marks
where keys are student names and values are their scores.
 The function should find the student with the highest score and print
"Topper: <name> with <score>".
 If the dictionary is empty, print "No data available".
23 Differentiate between == and is operators in Python with examples. 2
24 A) Write the Python statement for each of the following tasks using BUILT- 2
IN functions/methods only:
(i) To append the value 100 to a list L
OR
(ii) To convert the string word to all uppercase characters.
B) Write the Python statement to import the required module and (using a
built-in function) to perform the following tasks:
(i) To calculate the square root of a variable num
OR
(ii) To generate a random float between 0 and 1
25 Predict the output of the Python code given below : 2
sales = {"Amit": (120, 150),
"Bina": (90, 110),
"Chirag": (200, 180),
"Diya": (140, 130)}

high_sellers = []
for person in sales:
s = sales[person]
avg = (s[0] + s[1]) / 2
if avg >= 140:
high_sellers.append(person)
print(high_sellers)
26 The code provided below is intended to calculate the sum of all even 2
numbers in a given list. However, there are errors in the code. Identify and
correct syntax errors and logical errors. Underline all the corrections made.
def sum_even_numbers(numbers)
total = 0
for num in numbers:
if num / 2 == 0:
total += num
return total
result = sum_even_numbers([1, 2, 3, 4, 5, 6])
print("Sum of even numbers: " result)

27 Given below is a table Item in database Inventory. 2

ItemID ItemName Quantity UnitPrice


101 ABC 5 120
102 XYZ 7 70
103 PQR 8 65
104 XYZ 12 55

Riya created this table but forget to add column ManufacturingDate. Can she
add this column after creation of table?
If yes, write the code where user’s name and password are system and test
respectively.
28 List one advantage and one disadvantage of bus topology. 2
OR
Expand the term HTTP, URL
SECTION –C (3x3=9)
29 Write the definition of a function Count_Line() in Python, which should 3
read each line of a text file "[Link]" and count total number of
lines present in text file.
OR
Write the definition of a function Count_Words() in Python, which should
read each line of a text file "[Link]" and count the total number of
words present in the text file.
30 3
You have a list PatientList where each element represents a patient record in
the format Name, Age, Department, Charges. Write Python functions to
operate on the stack SurgeryStack.

(i) Push_patient(PatientList, SurgeryStack): Push the names and ages of


the patients whose department is 'Surgery' and charges are greater than 250
onto the stack.

(ii) Pop_patient(SurgeryStack): Pop and display the names of the patients


from the stack until it is empty, then print "Stack Empty".

(iii) Peek_patient(SurgeryStack): This function displays the topmost


patient name and age of the stack without deleting it. If the stack is empty,
the function should display 'None'.

OR

Write a function filter_high_charges(PatientList) that accepts a list of


patients and pushes only the patients with charges greater than 300 into a
stack called HighChargePatients. Implement the following functions:

(i) Pop_high_charge(HighChargePatients): This function removes and


returns the top element from the HighChargePatients stack. If the stack is
empty, then it returns None.

(ii) Display_high_charge(HighChargePatients): This function displays all


elements of the stack without deleting them. If the stack is empty, the
function should display None.

For example: If the patients' input into the list PatientList are:

PatientList = [('Sandeep', 65, 'Surgery', 300), ('Ravina', 24, 'Orthopaedic',


200), ('Ankita', 29, 'Cardiology', 800)]

Then the stack HighChargePatients should store: [('Ankita', 29, 'Cardiology',


800)]
31 Predict the output of the following code:
data = [3, 5, 8]
result = "" 3
for number in data:
for i in range(1, number + 1):
result += str(i) + "!"
print(result)
OR
values = [2, 4, 6]
for v in values:
for j in range(v):
print(v, end=" ")
print()
SECTION – D
32 Consider the table CUSTOMERS as given below: 4
C_Id C_Name City Age Join_Date
1 Alice New York 30 2022-01-10
2 Bob Los Angeles 25 2021-11-15
3 Charlie Chicago 35 2023-03-12
4 David Miami 28 2020-07-22

A) Write the following queries:


(I) To display the average age of customers from each city.
(II) To display the total number of customers who joined in the year 2022.
(III) To display the distinct cities from the Customers table.
(IV) To display the maximum age of customers who are from New York.

OR

B) Write the output:


(I) SELECT C_Name, COUNT(*) AS Total_Customers FROM Customers
GROUP BY City;
(II) SELECT * FROM Customers WHERE Age > 30;
(III) SELECT C_Id, C_Name FROM Customers WHERE Join_Date
BETWEEN '2022-01-01' AND '2022-12-31';
(IV) SELECT MIN(Age) FROM Customers;

33 A CSV file "[Link]" contains the data of employees in a 4


company. Each record of the file contains the following data:
● Employee ID
● Name of the employee
● Department
● Salary
For example, a sample record of the file may be:
[101, 'Alice', 'HR', 75000]
Write the following Python functions to perform the specified operations on
this file:
(I) Read all the data from the file in the form of a list and display all those
records for which the salary is greater than ₹60,000.
(II) Count the number of records in the file.
34 Write the SQL commands for (i) to (v) on the basis of the table HOSPITAL 4
Consider the following tables ACTIVITY and COACH and answer the
questions. Table: ACTIVITY
ACo ActivityNa Stadium Participantsn PrizeMon ScheduleD
de me um ey ate
1001 Relay 100 x Star 16 10000 23-Jan-
4 Annex 2004
1002 High Jump Star 10 12000 12-Dec-
Annex 2003
1003 Shot Put Super 12 8000 14-Feb-
Power 2004
1005 Long Jump Star 12 9000 01-Jan-
Annex 2004
1008 Discuss Super 10 15000 19-Mar-
Throw Power 2004

Table: COACH
PCode Name ACode
1 Ahmad Hussain 1001
2 Ravinder 1008
3 Janila 1001
4 Naaz 1003

Write SQL commands for the following statements:


i. To display the names of all activities with their Acodes in descending
order.
ii. To display sum of PrizeMoney for the Activities played in each of the
Stadium separately.
iii. Display the activity name ,total participant numbers and their coach
name.
iv. A) Display the total prize amount received by each coach.
Or
B) Display the highest prize money and its Coach name

35 A table, named EMPLOYEES, in HRDB database, has the following 4


structure:

Field Type
emp_id int(11)
emp_name varchar(30)
department varchar(20)
salary float

Write the following Python function to perform the specified operation:


AddAndDisplay(): To input details of an employee and store it in the table
EMPLOYEES. The function should then retrieve and display all records
from the EMPLOYEES table where the Salary is greater than 50,000.

Assume the following for Python-Database connectivity:


Host: localhost
User: root
Password: Employee123
SECTION - E
36 Consider a binary file "[Link]" containing a dictionary with 5
multiple elements. Each element is in the form:
SID: [SNAME, SCLASS, MARKS]
where:
SID – Student ID
● SNAME – Student Name
● SCLASS – Student Class
● MARKS – Student Marks
Perform the following tasks:
(I) Write a function to input the data of a student and append it to the binary
file.
(II) Write a user-defined function find_students(marks) that accepts a marks
value as a parameter and displays all records from the binary file
"[Link]" where the student's marks are greater than the marks
value passed as a parameter.
(III) Write a function to update the class to "12" for students whose marks are
greater than 90
37 "Hindustan Connecting World Association" is planning to start their offices in 5
four major cities in India to provide regional IT infrastructure support in the
field of Education & Culture. The company has planned to setup their head
office in New Delhi in three locations and have named their New Delhi offices
as "Sales Office", "Head Office" and "Tech Office". The company’s regional
offices are located in "Coimbatore", "Kolkata" and "Ahmedabad".

A rough layout of the same is as follows:

Approximate distance between these offices as per network survey team is as


follows:
Place Place To Distance
From
Head Sales Office 10 KM
Office
Head Tech Office 70
Office METER
Head Kolkata Office 1291
Office KM
Head Ahmedabad 790 KM
Office Office
Head Coimbatore 1952
Office Office KM

In continuation of the above, the company experts have planned to install the
following
number of computers in each of their offices:

Head Office 100


Sales Office 20
Tech Office 50
Kolkata Office 50
Ahmedabad 50
Office
Coimbatore 50
Office
i. Based on the distance and number of computers, suggest the most suitable
location for the main server that will optimize connectivity across all offices.
Explain your reasoning.
ii. For efficient communication between the various offices, suggest a suitable
network topology and illustrate it.
iii. Recommend the placement of the following devices with justifications:
a. Repeater
b. Hub/Switch
iv. VoIP technology will be implemented for voice communication over the
internet. What does the acronym VoIP stand for?
v. A) If Hindustan Connecting World Association intends to link its New
Delhi head office with the regional offices in Coimbatore, Kolkata, and
Ahmedabad, which type of network (LAN, MAN, or WAN) will be created?
Justify your answer.
OR
B) Which hardware device would you recommend to connect all the
computers in the head office effectively?
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2024-25
CLASS: XII TIME:03 HOURS
SUBJECT: COMPUTER SCIENCE Maximum Marks: 70
General Instructions:
 This question paper contains 37 questions.
 All questions are compulsory. However, internal choices have been provided in some questions.
 The paper is divided into 5 Sections – A, B, C, D and E.
 All programming questions are to be answered using Python Language only.
[Link] Question Marks
Section – A (21 x 1 = 21 Marks)
1 Find the invalid identifier 1
(A) Name (B) break (C) marks 12 (D) section
2 Evaluate the expression given below A=16 and B=15 A%B//A
1
(A) 0.0 (B) 0 (C) 1.0 (D) 1
3 AL is defined as follows : AL=[1,2,3,4,5] Which of the following statement removes
the middle element from it so that the list AL equals to [1,2,4,5] 1
(A) del AL[2] (B) AL[2:3]=[ ] (C) AL[2:2]=[ ] (D) [Link](3)
4 Suppose T is declared as T=(10,12,43,39) which of the following is incorrect?
(A) print(T[1])
(B) print(max(T) 1
(C) T[2]=-29
(D) print(len(T))
5 What is the output of the code >>>int("3”+"4")
1
(A) "7" (B) "34" (C) 24 (D) 34
6 Which of the following is the correct form of declaration of a dictionary?
(A) Day=[1:'Mon', 2:'Tue', 3: 'Wed'] (B) Day={1:'Mon', 2:'Tue', 3: 'Wed'} 1
(C) Day=[1;'Mon', 2;'Tue', 3; 'Wed'] (D) Day={1;'Mon', ;'Tue', 3;'Wed'}
7 Which of the given argument types can be skipped from a function call? 1
(A) positional (B) keyword (C) named arguments (D) default arguments
8 What is the output of this code?
def add(x, y=3):
return x + y 1
print(add(5))
a) 8 b) 5 c) Error d) 3
9 Which statement correctly imports the random module?
a) import Random
b) import random 1
c) include random
d) from random import *
10 A security mechanism that can be created in hardware and software both to prevent the
unauthorised access to and from the network is called___________________ 1
(A) Anti-virus (B) Network security (C) Authentication (D) Firewall
11 IMAP stands for ________
(A) Internet Message Access Protocol (B) Internet Mapping Add Protocol 1
(C) Internetwork Mapping Access Protocol (D) Internetwork Message Added Protocol
12 Which device is more intelligent while sending data packets 1
[1]
(A) Router (B) Switch (C) Modem (D) None of them
13 Which command is used in removing the table and all its data from the database
1
(A) DROP (B) DELETE (C) DESCRIBE (D) ALTER
14 Which of the following command change the structure of the table/characteristics?
1
(A) ALTER (B) MODIFY TABLE (C) CHANGE TABLE (D) All of the above
15 Which of the following is not a legal constraint for CREATE TABLE command
1
(A) Primary key (B) Foreign key (C) Unique (D) Distinct
16 Which is a join condition contains equality operator?
1
(A) Equi join (B) Cartesian product (C) Both (A) & (B) (D) None of them
17 State whether True or False?
1
The [Link] gives the count of the records in the resultset
18 ___________command makes the changes reflect in the database permanently
1
(A) done() (B) reflect() (C) commit() (D) final()
19 Which method is used to convert the first character of a string to uppercase in Python?
1
(A) upper() (B) capitalize() (C) title() (D) first_upper()
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct
choice as:
[Link] A and R are true and R is the correct explanation for A
[Link] 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):Modifying a string creates another string internally but modifying a list
cannot create a list internally 1
Reason(R): Stings are immutable types whereas Lists are mutable types in Python.
21 Assertion (A): Exception handling code is clear and block based in Python.
Reasoning (R): The code where unexpected runtime exception may occur is separate 1
from the code where the action takes place when an exception occurs.
Section – B (7 x 2=14 Marks)
22 Predict the output of the following : 2
fruit={}
f1=['Apple', 'Banana', 'apple', 'Banana']
for index in f1:
if index in fruit:
fruit[index]+=1
else:
fruit[index]=1
print(fruit)
print(len(fruit))
23 Write the difference between actual parameter and formal parameter with example? 2
24 Write the Python statement for each of the following tasks using BUILT-IN functions / 2
methods only:
I)
A. To update dictionary d1 with dictionary d2
or
B. Write the code to remove the fifth element from the list L?
II)
(A ) To add an element 10 in 2nd position into the list age.
or
i) ( B) To replace the letter m with ‘@’ in a string “ Computer Science” holding
the variable name as subject?
25 Write a function highScores(SCORES) in Python that takes a list of integers SCORES 2
and prints all the scores that are above the average score of the list.
Ex: marks = [65, 80, 72, 90, 55]

[2]
Output: 80
90
OR
Write a function expensiveItems(ITEMS) in Python that accepts a dictionary ITEMS
where keys are item names and values are their prices.
The function should display the names of all items whose price is greater than or equal
to 2000, sorted alphabetically, in upper case.
Ex: products = {"Bag":1800, "Watch":2500, "Shoes":3200, "Belt":1200}
Output: SHOES
WATCH
26 The code given below accepts a number as an argument and returns the list of all prime 2
numbers upto that number. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.
define prime(num):
for i in range(2,n/2+1,1):
if i%num==0:
print(‘Not prime’)
continue
else:
print(‘Prime’)
27 (I) 2
A. What SQL constraint should be used to define a default value for a column if
no specific value is provided when inserting a new record?
OR
B. In SQL, which constraint enforces a relationship between columns in different
tables by ensuring that values in the child table correspond to values in the
parent table?
(II)
A) What type of constraint would you use to ensure that a column's value must
match a specified pattern (e.g., a valid email address format)?
OR
B) Which constraint ensures that the values in a column or group of columns are
unique across the table, but can still allow NULL values?
28 (I) 2
A. Expand the following abbreviations:
(i)POP (ii)HTTPS
B. What is a URL?
OR
(II)Write two points of difference between Circuit Switching and Packet Switching
Section – C (3 x 3 = 9 Marks)
29 Write a function COUNT_AND () in Python to read the text file “[Link]” and
count the number of times “AND” occurs in the file. (include AND/and/And in the
counting) 3
OR
Write a function DISPLAYWORDS( ) in python to display the count of words starting
with “t” or “T” in a text file ‘[Link]’
30 Two list Lname and Lage contains names of persons and age of persons respectively.
A list named Lnameage is empty. Write functions as details given below
(i) Push_na() :- it will push the tuple containing pair of name and age from Lname and
Lage whose age is above 50 3
(ii) Pop_na() :- it will remove the last pair of name and age and also print name and
age of removed person. It should also print “underflow” if there is nothing to remove.
For example, the two lists have following data
[3]
Lname=[‘narender’, ‘jaya’, ‘raju’, ‘ramesh’, ‘amit’, ‘Piyush’]
Lage=[45,23,59,34,51,43]
After Push_na() the contains of Lnameage stack is
[(‘raju’,59),(‘amit’,51)]
The output of first execution of pop_na() is
The name removed is amit
The age of person is 51
OR

(i) Push (st, expression), where expression is a string containing a valid arithmetic
expression with +, -, *, and / operators, and st is a list representing a stack. The
function should push all the operators appearing in this expression into the stack st.
(ii) Pop(st) to pop all the elements from the stack st and display them. It should also
display the message 'Stack Empty' when the stack becomes empty.
iii) Main program to accept the expression from the user and add only arithmetic
expression using function call statements accordingly.
31 Predict the output of the following code:
x = 25
def modify(s, c=2):
global x
for a in s:
if a in 'QWEiop':
x //= 5
print([Link](),'@',c*x)
else:
x += 5
print([Link](),'#',c+x) 3
string = 'We'
modify(string,10)
print(x, '$', string)

OR
Predict the output of the following code:
L=[2,4,6,8,10]
for i in L:
for j in range(I,len(L)+1):
print(j,’#’,end=””)
print()
Section – D (4 x 4 = 16 Marks)
32 Write the output of the queries (i) to (iv) based on the table PRODUCTS given below:
Table: PRODUCTS
CODE ITEM QTY PRICE TDATE
1001 Plastic Folder 14'' 100 3400 2014-12-14
1004 Pen Stand Standard 200 4500 NULL
1005 Stapler Mini 250 1200 2015-02-28
1006 Punching Machine Small NULL 1400 2015-03-12
1009 Stapler Big 100 1500 NULL 4
i) SELECT COUNT(TDATE) FROM PRODUCTS;
ii) SELECT MAX(TDATE) FROM PRODUCTS WHERE PRICE BETWEEN
1000 AND 1400;
iii) SELECT ITEM, QTY*PRICE AS “TOTAL” FROM PRODUCTS WHERE
QTY > 200 AND ITEM LIKE ‘%tap%’;
iv) SELECT ITEM, TDATE FROM PRODUCTS WHERE QTY IS NULL AND
PRICE =1400;
[4]
O0052
Write the queries (i) to (iv) based on the table PRODUCTS given below:
i) Display the complete details of products whose Tdate is before the year
2015.
ii) Add a column UNIT PRICE using integer which include two digits and
restrict the entry of null values.
iii) To show the maximum and minimum price of items.
Write query to increase the price by 10% whose price is more than 1200.
33 Write a Program in Python that defines and calls the following user defined functions
(i) InsertRow() – To accept and insert data of an student to a CSV file ‘[Link]’.
Each record consists of a list with field elements as rollno, name and marks to store 4
roll number, student’s name and marks respectively.
(ii) COUNTD() – To count and return the number of students who scored marks
greater than 75 in the CSV file named ‘[Link]’.
34 Consider the tables STORE and SUPPLIERS given below:
Table : Store
ITEM NO ITEM SCODE QTY RATE LASTBUY
2005 Sharpner Classic 23 60 8 2009-11-31
2003 Ball pen 22 50 25 2010-01-31
2002 Gel pen premium 21 150 12 2001-11-23
2004 Gel pen classic 22 250 20 2009-01-11
2006 Eraser small 21 220 6 2009-05-12
2008 Eraser big 21 110 8 2009-06-14
2005 Ball pen 0.5 22 180 18 2009-03-25

Table : Supplier 4
SCODE SNAME
21 Premium Stationary
22 Soft Plastics
23 Tetra Supply
i) To display ItemNo, Item Name and Sname from the tables with their
corresponding matching Scode.
ii) Display the structure of the table store.
iii) Display the average rate of Premium Stationary and Tetra Supply.
iv) A )Display the item, qty, and rate of products in descending order of rates
Or B) Display the complete report of store whose item name has p letter in
between.
35 Rojalina Gamango has created a table 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 Python and MySQL: 4
• Username - root
• Password – root
• Host – localhost
Rojalina Gamango now wants to display the records of students whose fee is more than
3500.
Section – E (2 x 5 = 10 Marks)
36 A binary file [Link] needs to be created with following data written it in the form of
Dictionaries. 2+3
EID ENAME SALARY

[5]
101 KARTHIK 55000
102 SANIA 65000
103 SOMESH 52000
Write the following functions in python accommodate the data and manipulate it.
a) A function insert() that creates the [Link] file in your system and writes the three
dictionaries.
b) A function() read() that reads the data from the binary file and displays the
dictionaries whose SALARY is greater than 50000.
c ) A function to delete those records whose employee id is more than 102.
37 NMS Training Institute is planning to set up its Centre in Bhubaneswar with four
specialized blocks for Medicine, Management, Law courses along with an Admission
block in separate buildings. The physical distances between these blocks and the
number of computers to be installed in these blocks are given below. You as a network
expert have to answer the queries raised by their board of directors as given in (i) to
(iv). Shortest distances between various locations in meters:
Admin Block to Management Block 50 m
Admin Block to Medicine Block 30 m
Admin Block to Law Block 65 m
Management Block to Medicine Block 40 m
Management Block to Law Block 125 m
Law Block to Medicine Block 35 m

Number of Computers installed at various locations are as follows:


Admin Block 250
Management Block 100
Medicine Block 45
Law Block 95

(i). Suggest the most suitable location to install the main server of this institution to get
efficient connectivity.
(ii). Suggest the layout and also draw the best cable layout for effective network
connectivity of the blocks having server with all the other blocks.
(iii). Suggest the device to be installed in each of these buildings for connecting
computers installed within the building.
(iv) Suggest the most suitable wired medium for efficiently connecting each computer
installed in every building out of the following network cables:
• Coaxial Cable • Ethernet Cable
• Single Pair • Telephone Cable.
(v) A) Suggest a device/software to be installed to take care of data security.
Or
B ) Suggest the type of network? (PAN,LAN,MAN,WAN)

[6]
KENDRIYA VIDYALAYA SANGATHAN : HYDERABAD REGION
MODEL QUESTION PAPER 2024-25
ककककक CLASS : XII ककक TIME : 03 HOURS
कककक SUBJECT : COMPUTER SCIENCE कककककक ककक MAX. MARKS: 70
General 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 case of MCQ, text of the correct answer should also be written.

[Link]. Section-A(21x1=21Marks) Marks


1. Logical operators do not have highest precedence among all operators 1
a) TRUE b) FALSE
2. Which of the following datatype in python is used to represent any real number: 1
a) int b) complex c ) float d ) bool
3. What will be output of following expression 1
float (5+int (4.39+2.1) %2)
a)5.0 b) 5 c) 8.0 d)0
4. Which of the following keyword is useful in SELECT COMMAND in SQL 1
retrieves unique (different) values from a column
a) UNIQUE b) DISTINCT c) PRIMARY d) None of the Above
5. Value returning functions should be generally called from inside of an expression. 1
a)True b) False
6. The___can add a element in middle of a list 1
a)append( ) b) insert ( ) c) Keys( ) d) Clear( )
7. Which exception is raised when incorrect type of assignment is passed to a function 1
in python?
a)Value Error b)Type Error c)Attribute Error d)Name Error
8. Aishwarya wants to display all students’ data in descending order of class. She wrote 1
the following query, but not getting the expected output.
SELECT * FROM STUDENT IN DESCENDING ORDER OF CLASS
Help her by rewriting the above query correctly to get the expected output.
9. A TEXT FILE “[Link]” is stored in hard drive. Identify correct option out of 1
the following option to open the file in read mode
i)dbfile=open(‘[Link],’rb’) ii)dbfile=open(‘[Link]’,’w’)
iii)dbfile=open(‘[Link]’,’r’) iv)dbfile=open(‘[Link]’)
a)Only i b)Both i and iv c)Both iii and iv d)Both i and iii
10. What will be the output of the following code. 1
myList=[111,222, [333,444],555]
print(len(myList))
11. Which of the possible output(s) are not possible by the following code? 1
import random
p = "MY PROGRAM"
i=0
while p[i] != "R":
x = [Link](0,3) + 5
print (p[x],end ="_")
i += 1
i) M_M_Y_P ii) R_G_A_G iii) G_G_R_O (iv) O_G_G_A
12. What will be the output of python code 1
def A_func(X=10,Y=20):
X=X+1
Y=Y-2
return (X+Y)

print(A_func(5), A_func( ))

a)24,29 b)15,20 c)20,30 d)25,30


13. Which SQL command will remove the table entirely? 1
a) delete table b) remove table c) drop table d) erase table
14. What does the following code produces the output? 1
print("KV"*3,"SANG"+"2")
a) KV*3SANGSANG b) KVKVKVSANG2 c) KVKVKVSANGSANG d) None
15. In SQL Cardinality refers to------------ 1
a) no of keys in a table b) no of columns in a table
c) no of rows in a table d) None of the above
16. Which of the following is not an aggregate function of MYSQL 1
a) count() b) sum() c) avg() d) minimum()
17. _________ is a protocol used for retrieving emails from a mail server. 1
a) SMTP b) FTP c) POP3 d) PPP
18. Transmission media are usually categorized as 1
a) Fixed and Unfixed
b) Guided and Unguided
c) Determinate and Indeterminate
d) Metallic and Non metallic
19. [Link] is a -------------------- 1
a) link b) Uniform Resource Locator c) Domain Name d) all of the above.
Q.20 to 21 are Assertion (A) and Reasoning (R) based questions. Mark the
correct choice as :
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true but R is not correct explanation of A.
c) A is true but R is false (or partly true).
d) A is false (or partly true) but R is true.
20. Assertion (A). Data redundancy may lead to data inconsistency. 1
Reason (R). When redundant data or the multiple copies of data mismatch, it
makes the data inconsistent
21. Assertion: Python is portable and platform independent. 1
Reason: Python program can run on various operating systems and
hardware platforms.
a) Both Assertion and reason are true and reason is correct explanation
of assertion.
b) Assertion and reason both are true but reason is not the correct
explanation of assertion.
c) Assertion is true, reason is false.
d) Assertion is false, reason is true

[Link]. Section-B(7x 2 = 14Marks) Marks


22. What would be the data types of variables data in following statements? 2
x=5
y=3
i) Data= x/y
ii) Data=x//y
iii) Data=bool(x%y)
iv)Data=str(x**y)

23. Observe the following Python code very carefully and rewrite it after removing all 2
syntactical errors with each correction underlined.
DEF result_even( ):
x = input(“Enter a number”)
if (x % 2 = 0) :
print (“You entered an even number”)
else:
print(“Number is odd”)
resulteven ( )
24. If L1=[1,2,3,2,1,2,4,2,. .. ], and L2=[10,20,30, . . .], then 2
(Answer using built in functions only)
(A) i) Write a statement to count the occurrences of 4 in L1.
ii) Write a statement to sort the elements of list L1 in ascending order.
OR
B) i) Write a statement to insert all the elements of L2 at the end of L1.
ii) Write a statement to reverse the elements of list L2
25. Define a function sixSeven() which takes a list MyRno (each rollno contains 4 2
digits) as argument and store all roll numbers that begin with 6 in separate list named
Batch6 and roll numbers that begins with 7 in a list named Batch7.
For Example MyRno=[4131,6112,7312,6114,7215,5213] then
Batch6=[6112,6114], Batch7=[7251]
OR
Your PET teacher is conducting games. She/He is maintaining separate lists namely
Game1[] and Game2[] with the names of students participating in that game. Now
teachers wants to have a list BothGames[] which contain names of those students
who are participating in both the games. Help your teacher by writing suitable
Python program for the same.
26. Find the output of the following code 2
a={}
a[(1,2,4)]=8
a[(4,2,1)]=10
a[(1,2)]=12
sum=0
for k in a:
sum+=a[k]
print(sum)
print(a)
27. A) i) What do you understand by constraint? 2
ii) What constraint should be applied on a table column so that NULL is not
allowed in that column, but duplicate values are allowed
OR
B)i)) Write an SQL command to remove column AGE from the STUDENT table.
ii) Write an SQL command to MODIFY SNAME data type as CHAR(50) in table
STUDENT Nulls are allowed in that column, but duplicate values are allowed
28 A i) Expand the following terms: SMTP, URL 2
ii) Difference between HTML and XML
OR
B. i) What is Band width?
ii) Define baud rate?
[Link]. Section-C (3x 3 = 9Marks) Marks
29 A) Assume a text file named “[Link]” file exists. Write Python program to 3
display only those lines which contains word ‘the’.
(OR)
B) Write Python program to copy all lines that begin with Upper Case vowel from
[Link] and store them into a new file named [Link].
30 MANJU has created a dictionary containing names and marks as key value pairs of 6 3
students.
i) Write a program, with separate user defined functions to perform the following
operations:
Push the keys (name of the student) of the dictionary into a stack, where the
corresponding value (marks) is greater than 75.
ii) Pop and display the content of the stack.
For example:
If the sample content of the dictionary is as follows:
R={"OM":76, "JAI":45, "BOB":89, "ALI":65, "ANU":90, "TOM":82}
The output from the program should be:
TOM ANU BOB OM
31 Predict the output of the Python code given below: 3
value = 50
def display(N):
global value
value = 25
if N%7==0:
value = value + N
else:
value = value - N
print(value, end="#")
display(20)
print(value)
OR
Predict the output of the Python code given below:
l=[]
for i in range (4):
[Link](2*i+1)
print(l[::-1])

[Link]. Section-D(4x 4 = 16Marks) Marks


32 Consider the following STAFF table: 4
empno ename desig sal Gen
1001 PRAMOD PGT 90000 M
1005 SACHIN PRT 35500 F
2005 AISHWARYA TGT 49500 F
8090 SRINIVAS ASO 35000 M
7890 ASHOK JSA 28000 M
A) Write SQL Queries for the following assuming all kinds of data exist in the table.
a) Display name, designation of all staff members.
b) Display all staff members whose salary is between 50000 to 100000
c) Display name and gender of all PGTs
d) Display all staff members whose salary is not yet fixed.
(OR)
B) Write the output of the following queries as per the data contained in the above
table.
a) SELECT MAX(SAL), AVG(SAL) FROM STAFF;
b) SELECT SAL*0.1 AS “COMM” FROM STAFF WHERE GEN=’F’;
c) SELECT ENAME FROM STAFF WHERE ENAME LIKE ‘%I%’
d) SELECT COUNT (DISTINCT GEN) FROM STAFF;
33 A csv file "[Link]" contains the data of a survey. Each record of the file 4
contains the following data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in that
country)
● Happy (Number of persons who accepted that they were Happy)
For example,a sample record of the file may be:
[‘Signiland’, 5673000, 5000, 3426]
WritethefollowingPythonfunctionstoperformthespecifiedoperationson this file:
(I) Read all the data from the file in the form of a list and display all those
records for which the population is more than 5000000.
(II) Count the number of records in the file
34 Consider the following tables STUDENT and ST-HOUSE. 4
Table :STUDENT Table : ST-HOUSE
STUDENT
Clas Sec Rno Sname House Hid Hname HMaster
3 A 1 ROHAN H03 H01 GANGA VACHASPATHI
12 C 5 PALLAVI H04 H02 YAMUNA MADHURI
9 D 12 KIRAN H03 H03 NARMADA MURALI
11 A 6 SAMPATH H02 H04 KAVERI SRIHARI
i) Display class, section and name of all students belong to NARMADA house.
ii) Identify the Primary key and foreign key in the above tables with justification for
foreign key.
(OR)
(B) Write SQL query to add a new column to ST-HOUSE table named Hmember
of varchar type with size 20.
35 A table named WORKER available in a database named “BUILDER” with the 4
following structure.

Table : WORKER
Field name Type
WID Integer(5)
WNAME Varchar(20)
SKILL Varchar(20)
Rate Integer(2)
Write a Python program to input worker details and store the input data in MySQL
table named WORKER. At the end Program should also display all the workers
from worker table using Python-MySQL connectivity.
(MySQL : username = root , Password=kvs123, database=BUILDER
[Link]. Section-E(5x 2 = 10Marks) Marks
36 Your vidyalaya needs to store Stock details of computer department like 5
COMPUTER, KEYBOAD, MOUSE, SCANNER, PRINTER etc. Data of each stock
item is maintained in the form of a dictionary named Item with keys as StockId,
ItemName, Quantity,’Brand’ and their quantity available as values.
a) Define a function AddStock() that will input one Item details and append to a
binary file [Link].
b) Define a function getScanner() which will display the details of all scanners
exist in [Link] along with total number of scanners exist.
37 ELITE University of Andhra Pradesh is setting up a secured network for its campus 5
at VIJAYAWADA for operating their day-to-day office & web-based activities.
They are planning to have network connectivity between four buildings MAIN,
ADMIN, FINANCE, ACADEMIC. Answer the question (a) to (e) after going
through the building positions in the campus & other details which are given below:

The distances between various buildings of university are given as

Building 1 Building 2 Distance in meters


Main Admin 50
Main Finance 120
Main Academic 70
Admin Finance 50
Finance Academic 70
Admin Academic 60
Number of computers in each building
Building No. of Computers
Main 150
Admin 75
Finance 50
Academic 60

a) Suggest cable layout for the connections between the various buildings,
b) Suggest the most suitable building to house the server of the network of the
university.
c) Suggest the placement of following devices with justification:
i) Switch/Hub
ii) Repeater
d) which device is needed if internet connection is to be provided to all the blocks
and also suggest where it is to be placed?
e) Suggest the most suitable and economical transmission media for connecting
different buildings
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2025-26

ककककक CLASS: XII ककक TIME:03 HOURS


कककक SUBJECT: COMPUTER SCIENCE कककककक ककक Maximum Marks: 70
General 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 case of MCQ, text of the correct answer should also be written.
Q. No. Section – A (21 x 1 = 21 Marks) Marks
1 State True or False:
An exception(error) in Python will stop the program from executing further unless 1
it is handled.
2 Identify the output of the following code snippet:
text = "PythonExample"
text = text[::-1].replace('e', '3')
text = text[:5] + text[7:] 1
print(text)
A. PythonExampl3 B. 3lpmanohtyP
C. 3lpmax3nohtyP D. Python3xampl3
3 Evaluate the following expression
print(6//3**2 and 84%3 or 35/7+5)
A. True B. 10.0 1
C. 5.0 D. 10
4 What does ‘R’ represents in RDBMS ?
1
a. Rotational DBMS b. Relational c. Recoverable d. Real
5 What will be the output of the following code snippet?
string = "COMPUTER SCIENCE" 1
print(string[12:5:-2])
6 What will be the output of the following code?
tup = (5)
print(tup * 3) 1
A. (5,5,5) B. (15)
C. (5,) D. (15,)
7 What will be the output of the following code? 1
my_dict = {'a': 1, 'b': 2}
[1]
my_dict['c'] += 1
A. {'a': 1, 'b': 2, 'c': 1} B. KeyError
C. {'a': 1, 'b': 2, 'c': 2} D. TypeError
8 What does the [Link](x, y) method do in Python?
A. Inserts the value y at the end of the list.
B. Inserts the value x at index y in the list. 1
C. Inserts the value y at index x in the list, shifting elements to the right.
D. Replaces the element at index x with the value y.
9 Given the following table structure, how many candidate keys can be identified?
ID NAME USERNAME Mobile
101 Alisha Al12 8741455878
102 Anaya Ana09 8741455456 1
103 Alisha Ali21 8741455432
A. 1 B. 2
C. 3 D. 4
10 What happens if no arguments are passed to the seek () method?
A. file position is set to the start of file
B. file position is set to the end of file 1
C. file position remains unchanged
D. results in an error
11 State whether the following statement is True or False:
A try block in Python can exist without an except block as long as a finally block is 1
present.
12 What will be the output of the following code?
c = 10
def increment():
global c
c += 5
print(c, end='#')
1
increment()
c = 30
print(c)
A. 15#15# B. 15#15
C. 15#30 D. 15#30#
13 A table has initially 10 columns and 5 rows. Consider the following sequence of
operations performed on the table –
i. 5 rows are added
ii. 3 columns are added
iii. 4 rows are deleted
iv. 5 columns are deleted 1

What will be the cardinality and degree of the table at the end of above
operations?
A. 8, 10 B. 8, 6
C. 18, 14 D. 6, 8
14 Which SQL statement correctly calculates the average age of students grouped by
gender?
1
A. SELECT gender, AVG(age) FROM students GROUP BY gender;
B. SELECT gender, AVG(age) FROM students HAVING gender;
[2]
C. SELECT gender, AVG(age) WHERE age > 18;
D. SELECT gender, AVG(age) FROM students GROUP BY age;
15 Which function is used to display the unique values of a column of a table?
A. sum() B. unique() 1
C. distinct() D. return()
16 Which SQL aggregate function is used to count the number of unique values in a
column?
1
A. COUNT(*) B. COUNT(DISTINCT)
C. DISTINCT(COUNT) D. COUNT(UNIQUE)
17 The __________ is a mail protocol used to retrieve mail from a remote server to a
1
local email client.
18 Unique physical address of each NIC card is called __________.
A. IP address B. MAC address 1
C. HOME address D. STATIC address
19 The IP (Internet Protocol) of TCP/IP transmits packets over Internet using ________
switching. 1
a) Circuit b) Message c) Packet d) All of the above
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 Consider the following code:
x = 25
def study( ):
global x
x+ = 50 1
print(x)
study()
Assertion (A): 75 will be the output of above code.
Reason (R): Because the x used inside the function study( ) is of global scope
21 Assertion (A): The GROUP BY clause in SQL is used to group rows that have the
same values in specified columns.
1
Reasoning (R): The GROUP BY clause is used to filter rows before the result set is
returned.
Q. No. Section – B (7 x 2 = 14 Marks) Marks
22 Write a function word_count(sentence) that takes a sentence (string) as input and 2
returns a dictionary where the keys are the unique words from the sentence and
the values are the number of times each word appears. For example, if the input is
"hello world hello", the function should return {'hello': 2, 'world': 1}
OR
Differentiate for loop and while loop
23 Give two examples of each of the following: 2
A. Logical operators B. Membership operators
24 A) Write the python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
(i) To remove an element at index 2 in a list L
OR

(ii) To check whether a string named text ends with ‘ce’.


[3]
B) Write the python statement to import the required module and (using built-in
function) to perform following tasks
(i) To calculate the cosine of variable angle
OR
(ii) To generate a random integer between 1 and 100
25 Identify the correct output of the following code. Also write the minimum and the 2
maximum possible values of the variable b.
import random
phrase = " Code with Python and unlock possibilities!”
words = [Link]()
b =[Link](1,4)
for i in range(b):
print(words[i][0], end='-')
A. C-w-P-a-u- B. C-w-P-a
C. C-P-a- D. C-w-P-
26 The code provided below is intended to generate and print the Fibonacci series for 2
the first 10 elements. However, there are syntax and logical errors in the code.
Rewrite it after removing all errors. Underline all the corrections made.
define fibonacci()
first=0
second=1
print(“first no. is”, first)
print(“[Link],second)
for a in range (1,9):
third=first+second
print(third)
first,second=second,third
fibonacci()
27 (I) 2
A) Which key constraint is used to establish a link between two tables.
B) What type of constraint must be applied to a column to ensure that
every entry in that column must contain a value (i.e., no NULL values
are allowed)?

OR

(II)
A) Write an SQL command to add a column “email” in customer table.

B) Write an SQL command to delete the column C_Name from the customer
table.

28 (I)Differentiate between HTML and XML. 2


OR
(II)
A. Expand the following:
(i) SMTP (ii) VoIP
B. Give one disadvantage of Star topology.
Q. No. Section – C (3 x 3 = 9 Marks) Marks
29 Write a Python function that finds and displays all the lines that end with a 3

[4]
question mark (?) from a text file "[Link]".
OR
Write a Python function that reads a text file "[Link]" and displays all the lines
that do not contain the word "error".
30 You have a list SongList where each element represents a song record in the format
[SongName, Artist, Duration]. Write Python functions to operate on the stack
FavSongs.
(i) Push_element(SongList, FavSongs): Push the songs and their artist names that
have a duration greater than 3.5 minutes to the stack.
(ii) Pop_element(FavSongs): Pop and display the songs until the stack is empty,
then print "Stack Empty"
(iii)peek(FavSongs): This function displays the topmost element of the stack without
deleting it. If the stack is empty, the function should display 'None
OR
Write a function filter_greater_than(N, threshold) that accepts a list of integers and 3
a threshold value, pushing only those integers greater than the threshold into a
stack called FilteredNumbers.
Implement following functions
pop_filtered(FilteredNumbers) - This function removes and returns the top element
from the FilteredNumbers stack. If the stack is empty then returns None.
Display(FilteredNumbers): This function displays all element of the stack without
deleting them. If the stack is empty, the function should display None.
For example:
If the integers input into the list `N` are:
N = [1, 10, 5, 8, 20, 15, 30] and threshold=10
Then the stack `FilteredNumbers` should store: [20,15,30]
31 Predict the output of the following code:
d = {"apple": 15, "banana": 7, "cherry":9,"apple":20}
str1 = ""
for key,value in [Link]():
str1 = str1 + str(key)+"@"+str(d[key]) + str(value) + "\n"
str2 = str1[:-1]
print(str2)
OR
Predict the output of the following code: 3
numbers = [3, 7, 4]
for I in numbers:
for j in range(1, I + 1):
if j % 2 == 0:
print(j, '*', end="")
else:
print(j, '#', end="")
print()
Q. No. Section – D (4 x 4 = 16 Marks) Marks
32 A) Rishi has been entrusted with the management of the Employee Database. He
needs to access some information from the EMPLOYEES table for a survey
analysis. Help him extract the following information by writing the desired SQL 4
queries as mentioned below.

[5]
Emp_ID Name Department Joining_Date Salary City

2001 Rahul IT 2021-06-15 55000 Mumbai

2002 Sneha HR 2019-08-22 48000 Delhi

2003 Arjun Marketing 2020-01-10 62000 Banglore

2004 Meena Finance 2018-11-05 71000 Chennai

2005 Vikram IT 2022-03-18 54000 Hyderabad

Note: The table contains many more records than shown here.

Write the following queries:


(I) To display the total number of employees in each department.
(II) To display employees who joined after January 1, 2020.
(III) To display the details of employees sorted by their salary in descending order
while calculating a 10% bonus for each employee and displaying the total salary
(salary + bonus) as Total_Salary_With_Bonus.
(IV) To find the employees whose city is either Mumbai or Delhi
OR
B) Write the output of the following queries:
(I) SELECT Department, SUM(Salary) AS Total_Salary FROM Employees GROUP BY
Department;
(II) SELECT Name,city FROM Employees WHERE City LIKE '_%i';
(III) SELECT Emp_ID, Name, Joining_Date FROM Employees ORDER BY Joining_Date
DESC;
(IV) SELECT Name, Salary FROM Employees WHERE Salary < (SELECT AVG(Salary)
FROM Employees);
33 A CSV file named [Link] has the structure [ModelNo, Brand, Price].

i. Write a user-defined function add_camera() to input data for a camera record


and add it to [Link]. 4
ii. Write a function in Python to read and display the details of all cameras that are
priced between 15000 and 40000 from [Link], and display the number of
cameras in this range.
34 Write the outputs of the SQL queries (a) to (d) based on the relations Teacher and
4
Placement given below:

[6]
a) Write an SQL query to calculate the average salary of teachers in each
department
b) Write an SQL query to find the maximum and minimum dates of joining for
teachers in the Teacher table.
c) Write an SQL query to retrieve the names, salaries, departments, and
placement locations of teachers who earn more than 20,000.
d) i) Write a SQL query to list the names and placement locations of female
teachers.
OR

ii)Write a SQL query to count the number of female teachers in each


department
35 Keshav wants to write a program in python to display some records from the
CRICKET Table of SPORTS Database. The MySQL server is running on LOCALHOST
and the login credentials are as following:
Host: localhost
Username – root
Password – sports
The columns of the CRICKET table are described below:
4
pid (Player ID) – integer
pname (Player Name) – string
innings (Innings Played) – integer
runs (Runs Scored) – integer
wickets (Wickets taken) – integer
Help him Write a program to display the names of players who have scored more
than 5000 runs.
Q. No. Section – E (2 x 5 = 10 Marks) Marks
36 Consider a binary file [Link] containing a dictionary with multiple
elements. Each element is in the form
EID:[ENAME, EDEPARTMENT, SALARY] as a key pair where:
- EID – Employee ID
5
- ENAME – Employee Name
- EDEPARTMENT - Department
- SALARY – Employee Salary

[7]
(I) Write a function to input the data of a employee and append it in a binary file.
(II) Write a user-defined function, find_employees(salary), that accepts a salary
value as a parameter and displays all records from the binary file [Link]
where the employee's salary is greater than the salary value passed as a parameter.
(III) Write a function to update the salary to 100000 of candidates whose
department is “IT”.
37 XYZ Media house campus is in Delhi and has 4 blocks named Z1, Z2, Z3 and Z4. The
tables given below show the distance between different blocks and the number of
computers in each block.
Block Z1 to Z2 80m
Block Z1 to Z3 65m
Block Z1 to Z4 90m
Block Z2 to Z3 45m
Block Z2 to Z4 120m
Block Z3 to Z4 60m

Block
Z1 135
Z2 290
Z3 180
Z4 195

The company is planning to form a network by joining these blocks. 5


i. Out of the four blocks on campus, suggest the location of the server that will
provide the best connectivity. Explain your response.
ii. For very fast and efficient connections between various blocks within the
campus, suggest a suitable topology and draw the same.
iii. Suggest the placement of the following devices with justification

a. Repeater b. Hub/Switch
iv. VoIP technology is to be used which allows one to make voice calls using a
broadband internet connection. Expand the term VoIP.
v. A) The XYZ Media House intends to link its Mumbai and Delhi centres. Out of
LAN, MAN, or WAN, what kind of network will be created? Justify your
answer.
OR
B) Which hardware device will you suggest to connect all the computers
within each building?

[8]
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
MODEL QUESTION PAPER
2025-26
कक्षा/CLASS: XII समय/TIME : 3 Hours
विषय/ SUBJECT COMPUTER SCIENCE (083) अविकतम अं क/MAX MARKS: 70
General Instructions:

 Please check this question paper contains 35 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 case of MCQ, text of the correct answer should also be written.

प्र.क्र. अं क
Ques प्रश्न Question Marks
No
SECTION A (1 MARK QUESTIONS)
1 1
State whether the following statement is True or False
“It is difficult to identify logical errors in a program”
2 Select the correct output of the code : 1
S=”hello india"
C=[Link]()
print(C)
(a) HELLO INDIA (b) Hello india (c) Hello India (d) hello India
3 Which of the following expressions evaluates to True? 1

a) (5>10) and (12<20) b) (1<5) or (12>14)


c) not ((1<5) or (23>62)) d) not (32>41) and (25==26)
4 What is the output of the given code? 1
s1=’KVS’
s2=’@@’
print([Link](s2))
a) K@V@S b) @KVS@ c) K@@V@@S d) None of these
5 What will be the output of the following code snippet? 1
s= "Good Morning"
print(s[-3::-2])
6 Which of the following statement(s) would give an error after executing the following 1
code?
T=(10,20,30,40,50) # Statement 1
print(T) # Statement 2
T=(1,2,3,4,5) # Statement 3
T[1]= 20 # Statement 4
T=T+(60,70) # Statement 5
a. Statement 1 b. Statement3 c. Statement 4 d. Statement 5
7 1
Given the following dictionary
Day={1:"January", 2: "February", 3: "March", 4:”April”}
Which statement will return "March".
(a) [Link]() (b) [Link](2) (c) [Link](3) (d) [Link]("March")

8 What does [Link](x) do in a python program? 1


(a) Remove the element at index x from a list
(b) Removes the first occurrence of value x from the list
(c) Removes all occurrences of value x from the list
(d) Removes the last occurrence of value x from the list
9 _________ is a non-key attribute, whose values are derived from the primary key of some 1
other table.
(a) Foreign Key (b) Primary Key (c) Candidate Key (d) Alternate Key
10 Write the missing statement to complete the following code: 1
f = open("[Link]", "r")
d = [Link](50)
____________________ #Print the position of the file pointer
[Link]()
11 State whether the following statement is True or False: 1
The else part of try-except-else be executed when an exception occurs.
12 What will be the output of the following code? 1
a = 20
def display():
global a
a = a *2
print(a, end='#')
display()
a=15
print(a , end='%')
(a) 15%40# (b) 15#40% (c) 40#15% (d) 40%15#
13 Which SQL keyword is used to retrieve only unique values? 1
(a) DISTINCTIVE (b) UNIQUE (c) DISTINCT (d) DIFFERENT
14 What will be the output of the query? 1
SELECT Empname, Salary FROM Employee WHERE Salary IS NOT NULL;
(a) Empname and Salary of all employees whose salary is known
(b) Details of all employees whose salary is NOT NULL
(c) Names of all employees whose salary is NOT NULL
(d)Number of employees whose salary is NOT NULL
15 Which of the following is a DML Command? 1
(a) CREATE (b) DROP (c) DELETE (d) Both a and b
16 Which clause is used to arrange the records of a table in ascending or descending order? 1
(a) ASC ORDER (b) ARRANGE (c) ORDER BY (d) BY ORDER
17 Which protocol establishes a dedicated and direct connection between two 1
communicating devices?
a) HTTP b) FTP c) PPP d) SMTP
18 Which network device is used to amplify the signals to transmit them over longer 1
distances?
(a) Modem (b) Gateway (c) Switch (d) Repeater
19 What does the acronym MAN stand for? 1
a) Metropolitan Area Network c) Multi Area Network
b) Magnetic Access Network d) Multi –Access Net
Q 20 and 21 are ASSERTION AND REASONING based questions. Mark the correct 1
choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true but 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):- If the arguments in a function call statement match the number and order 1
of arguments as defined in the function definition, such arguments are called positional
arguments.
Reasoning (R):- During a function call, the argument list first contains positional
argument(s) followed by default argument(s).
21 Assertion(A): SQL SELECT's GROUP BY clause is used to divide the result in groups. 1
Reason(R): The GROUP BY clause combines all those records that have identical values in
a particular field or in group by fields.
SECTION B (2 MARK QUESTIONS)

22 Rewrite the following code in Python after removing all syntax error(s) : 2
Underline each correction done in the code.

Marks = ( 35,40,56,23,64)
For I in Marks:
if I<23
print(Failed)
else
print(Not Failed)
23 Evaluate the following Python expressions : 2
(a) 2 * 3 + 4 ** 2 + 5 // 2
(b) 6 < 12 and not (20 > 15) or (10 > 5)
24 If A=[10,20,30,40,50,60,70,…. ], and B=[2,4,6,8,2,4,6,8, . . .], then 2
(Answer using built-in functions only)
I.
a) Write a statement to find the position of the first occurrence of 4 in B.
OR
b) Write a statement to delete an elements 30 from the list A.
II.
a) Write a statement to insert an element 5 at an index 3 in the list B
OR
b) Write a statement to sort the elements of list A in descending order.

25 What possible output(s) is/are expected to be displayed on the screen at the time of 2
execution of the program from the following code ? Also specify the maximum and
minimum value that can be assigned to the variable j when i is assigned value as 3.

import random
Sub = [ 'Math', 'Phy', 'Chem',’Bio’ ]
for i in range(3, 0, -1):
j = [Link](0,i)
print (Sub[j], end = ' # ')
(a) Bio # Chem # Phy #
(b) Phy # Math # Math#
(c) Bio # Bio #Math#
(d) Chem # Bio #Math#
26 Write a function DisplayMarks (Student) in python that takes the dictionary, Student as an 2
argument. Display the name of the students whose marks is more than 90
Consider the following dictionary
Student={“Rahul”:95, “Sai” : 80 ,”Satwik”:75, “Shiv” :92}
The output should be:
Rahul
Shiv
27 I. A) Write an SQL command to delete a column Marks from a table STUDENT. 2
B) Write an SQL command to change the data type of marks attribute of a table
STUDENT from int to float.
OR
II. A) Write an SQL command to delete all the records from a table EMPLOYEE.
B) Write an SQL command to delete a database SCHOOL from the server
28 (a) Write the difference between hub and switch. 2
OR
(b)
i. Expand the following: FTP,TCP /IP
ii. Give one disadvantage of Bus topology.
SECTION C (3 MARK QUESTIONS)

29 Write a python function that displays all the words starting with a vowel from a text file 3
‘[Link]’.
OR
Write a python function that counts and displays the number of words starting with ‘a’ or
‘A’ in each line of a text file ‘[Link]’

30 A. Consider a Nested List ‘Stationery’ in which all the elements are lists of the format – 3
[ItemID, ItemName, Price, Quantity]. Write the following user defined functions in python
to perform the task specified on the stack named ‘items’ which is initially an empty list.
• Push_item(Stationery) – It takes nested list Inventory as argument and pushes records of
those items onto stack which have quantity > 100.
• Pop_items(Stationery) –It repeatedly pops the top element of stack and displays it.
Appropriate message should be displayed when there are no more elements left in the
stack.
• Peep_items(Stationery)- This function displays the topmost element of the stack without
deleting it. If the stack is empty, the function should display 'None'.

For example:
Stationery = [[101, ‘Pen’, 10, 120],
[102, ‘Pencil’, 10, 100],
[103, ‘Eraser’, 5, 90],
[104, ‘Notebook’, 20, 52],
[105, ‘Marker’, 30, 130],
[106, ‘Sharpener’, 5, 110]]
After execution of Push_Items(Stationery), Stack should contain:
[[101, ‘Pen’, 10, 120], [105, ‘Marker’, 30, 130], [106, ‘Sharpener’, 5, 110]]
The output after Pop_Items(Stationery) should be:
[106, ‘Sharpener’, 5, 110]
[105, ‘Marker’, 30, 130]
[101, ‘Pen’, 10, 120]
Stack Empty
OR
B. Write a function in Python Square(N) which takes a list N as the parameter and pushes
the squares of all the odd numbers and cubes of all the even numbers in a stack.
Write a popstack() to pop the topmost number from the stack and returns it. If the stack is
already empty, the function should display "Empty".
Write a function Dsiplay() which displays the elements present in the stack without
deleting them, if the stack is empty the function should display ‘None’.

31 Write the output of the following python code. 3


msg= ‘Hello World123’
n = len(msg)
new_msg = ‘’
for i in range(0,n):
if not msg[i].isalpha():
new_msg = new_msg + ‘@’
else:
if msg[i].isupper():
new_msg = new_msg + msg[i]*2
else:
new_msg = new_msg + msg[i]
print( new_msg)

OR
Write the output of the following python code.
L=[3,10,6,13]
for I in L:
for J in range(I%2,5):
print(J,'#',end='')
print()
SECTION D (4 MARKS QUESTIONS)

32 Consider the BIKES table given below: 4

BIKENAME BRAND PRICE CC


BIKE_ID
B1 DUKE KTM 350000 390

B2 VERSEYS KAWASAKI 730000 650

B3 BENELLI BENELLI 630000 600

B4 NINJA KAWASAKI 7700000 1000

B5 S1000RR BMW 2000000 1000

A. Write the following queries:


i. To display the total Price of the bikes, whose price is more than 60000.
ii. To display the details of the bikes in alphabetical order of the bike names.
iii. To display the distinct brand names from the Bikes table.
iv. Display the maximum CC of all the bikes whose brand is ‘BMW’.

OR
B. Write the output:
i. Select * from bikes where cc>600;
ii. Select Bikename, Brand from bikes where price<70000;
iii. Select max(Price), min(Price) from Bikes;
iv. Select count(*) , brand from Bikes group by brand;
33 Vijay has created a csv file ‘[Link]’ to store player name, matches and goals 4
scored.
Write a program in python that defines and calls following user defined functions.
i. addPlayer(name, matches, goals) : Three parameters – name of the player, matches
played and goals scored are passed to the function. The function should create a list
object and append it to the csv file.

ii. AverageGoals( ): The function should read the csv file and display the name of the
player with their average goals (goals/matches).

34 Consider the tables COMPANY and CUSTOMER and extract the following 4
information by writing the desired SQL queries as mentioned below
COMPANY

CID NAME CITY PRODUCTNAME

101 LG KOLKATA TV
102 HP DELHI LAPTOP
103 DELL MUMBAI KEYBOARD
104 ACER DELHI LAPTOP
105 ASUS KOLKATA LAPTOP

CUSTOMER
CUSTID NAME PRICE QTY CID
100011 RAHUL 40500 10 101
100012 SAHIL 3000 20 103
100013 SATWIK 55000 3 104
100014 SARTHAK 45000 20 105

I. To display the company names whose price is less than 43000


II. To add one column totalprice with decimal (10,2) to the table customer
III. To increase the price of the customers whose name starts with ‘S’ by 200
IV. A. To display the Customer names in reverse alphabetical order
OR
B. To display the number of products available in each city.
35 A student created a table Inventory in MYSQL database, warehouse with following 4
structure:
Inv_No(Inventory Number )- integer
Inv_name(Name) – string
Inv_Entry(Date )
Inv_price – Decimal
Note the following to establish connectivity between Python and MySQL:
Username - root
Password - 12345
Host - localhost
Write the following Python function to perform the specified operation:

InsertRecord () : To accept the inventory details from user and insert a new row into the
table. The function should then retrieve and display the records.
SECTION E (5 MARK QUESTIONS)

36 Shweta had stored all her passwords in one binary file named ‘[Link]’. The 5
passwords were stored in following format:
[app_name, username, password]
i. Write a function that accepts title as a parameter and displays the username
and password for that particular app.
ii. Write a function to read the data and display all the app names which start
with ‘A’
iii. Write a function to add a new app details to the binary file.
37 5
Shalimar Solutions is setting up a campus in Mumbai. The campus have four Blocks
Alpha, Beta, Gamma and Theta. Suggest the best possible solutions for their questions (a)
to (e) based on the information given below.
Blocks Distance(m)
Alpha to Beta 25
Alpha to Gamma 75
Alpha to Theta 45
Beta to Gamma 80
Beta to Theta 125

Block No. of
Computers
Alpha 120
Beta 45
Gamma 25
Theta 30
a) Suggest the most appropriate block to house the server. Justify your answer.
b) Which Hardware/Software can be installed prevent unauthorized access to server?
c) Suggest the best wired transmission medium and draw the cable layout
diagram to connect the four blocks.
d) The company doesn’t want to use any wired media for connecting the computers within
the Alpha block. Which device can be used to provide wireless access, given that all the
machines in this block are wi-fi enabled.
b) A. Which network device is used to connect all the computers present in each block?
i. Repeater ii. Router iii. Hub/Switch iv. Bridge
OR
B. Is there a requirement of repeater in the given cable layout? Justify
KENDRIYA VIDYALAYA SANGATHAN :: HYDERABAD REGION
MODEL QUESTION PAPER 2025-26 VISHAL
ककककक CLASS : XII ककक TIME : 03 HOURS
कककक SUBJECT : COMPUTER SCIENCE कककककक ककक MAX. MARKS: 70
General 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 case of MCQ, text of the correct answer should also be written.

[Link]. Section-A(21x1=21Marks) Marks


1. try: 1
print(x)
except NameError:
print("Variable not defined")
else:
print("All good")
Output of the above code is “All good” . State True or False
2. What will be the output of the following code: 1
L=[12,(1,3,6),5,[8,9]]
print(L[1][1]+L[-1][-1])
a)10 b) 12 c) 9 d) Error
3. What is the expected output of the following expression 1
print(type("5" + "6"))?
A)int B)tuple C)str D)Error
4. Which of the following operations is not allowed on tuples? 1
A) Indexing
B) Slicing
C) Concatenation
D) Item assignment
5. Consider string state=”Telangana” Identify appropriate state that will display the 1
last five characters of string state
A)state[-5:] B)state[4:] C) state[:4] D) state[:-4]
6. If two tables A and B have no common columns, the INNER JOIN result will be: 1
A) All rows from both tables
B) Cartesian product
C) Empty set
D) Same as LEFT JOIN
7. What is the output of the following statement 1
print(x // y * y + x % y) for the values x=5, y=2
A)5 B)6 C)4 D) 3
8. What will be the output of the following code? 1
d = {'x': 1, 'y': 2}
[Link]({'z': 3, 'x': 5})
print(d)
A) {'x': 1, 'y': 2, 'z': 3}
B) {'x': 5, 'y': 2, 'z': 3}
C) {'x': 1, 'y': 2}
D) {'y': 2, 'z': 3}
9. Rashmi is executing the following SQL query to display total salary of each 1
department.
SELECT Dept, SUM(Salary) FROM Employee WHERE SUM(Salary) > 5000 GROUP BY
Dept;
The above query is not giving the expected output. Suggest the correction.
10. Which of the following is true about median() in Python statistics module? 1
A) Always returns a value present in the dataset
B) Returns middle value(s); average if even number of elements
C) Returns most frequent value
D) Returns sum of all elements divided by count

11. Find the possible output of the following code 1


import random
L = [2,4,6,8,10]
x = [Link](0, 0)
y = [Link](1, 2)
for i in range(x, y+1):
print(L[i], end=",")
A) a) 2,4,6,
b) 2,4,
c) 4,6,
d) 6,8,10,
12. Observe the following code and find the output 1
t = (10, 20, 30)
a, b, c = t
print(b)
13. A Hub can distinguish between different devices and send data only to the 1
intended device. True/False
14. Which device is used in a wireless network to provide access to wireless clients? 1
A) Router
B) Access Point (AP)
C) Hub
D) Switch

15. Which protocol is used by web browsers to fetch pages over the internet? 1
A) TCP
B) IP
C) HTTP
D) FTP
16. Consider a table Books(BookID, Title, Author) with 0 rows. Which of the following 1
statement is correct
a) Degree of the table is 0 Cardinality is 3
b) Degree of the table is 3 Cardinality is 0
c) Degree of the table is 0 Cardinality is 0
d) Invalid statement as a table can’t be created with 0 rows.
17. Which protocol allows a user to log in remotely to a computer securely? 1
A) Telnet
B) SSH
C) FTP
D) HTTP

18. Which of these is not an Aggregate function A)min B)max C)with D)Avg 1
19. Which MySQL command can list all columns (degree info) of a table Employee? 1
A) DESCRIBE Employee;
B) SHOW TABLES;
C) SELECT * FROM Employee;
D) DROP TABLE Employee;

20. Q.20 to 21 are Assertion (A) and Reasoning (R) based questions. Mark the 1
correct choice as :
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not correct explanation of A.
(c) A is true but R is false (or partly true).
(d) A is false (or partly true) but R is true.
Assertion (A) : There is a difference between a field being empty or
storing NULL value in a field.
Reason (R) : The NULL value is a legal way of signifying that no value
exists in the field
21. Assertion: Python is portable and platform independent. 1
Reason: Python program can run on various operating systems and
hardware platforms.
(A) Both Assertion and reason are true and reason is correct explanation
of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true

[Link]. Section-B(7x 2 = 14Marks) Marks


22. Find the output of the following code 2
x=1
def f():
x=2
def g():
global x
x=3
g()
print(x)
f()
print(x)
OR
Explain the use of different types of python function arguments (positional,
keyword and default ) with an example code.

23. Reema has written a python program to check whether a given strig is palindrome 2
or not. The program supposed read a string and case insensitive while checking the
letters of the word. Example: “Madam” should be identified as palindrome .
word = input("Enter a word: ")
if word == word[::-1]
Print("Palindrome")
else
print("Not Palindrome")
The above code is not giving the expected output. Identify the errors and suggest
for changes to get the expected output.
24. What output produced by following code snippet 2
LST=[1,2,3,4,5,6,7,8,9]
print(LST[::3]+LST[-8:-2:2])
OR
Write most appropriate list method to perform the following
(i)Delete a given element from the list (ii)Add element in a list at index 3
25. A) Write a function separate_prime() in python that accepts a list and create a 2
new list named Prime with all the primary numbers of the given list.
OR
B) Write a function multiples() which takes a list of numbers and creates a
dictionary with each number as key and its multiples if any exists in that list
Example:
Input: numbers = [2, 3, 4, 6, 9, 12]
multiples(numbers) should result the following Output:
{2: [4, 6, 12], 3: [6, 9, 12], 4: [12], 6: [], 9: [], 12: []}
26. Find output of the following code 2
words = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple']
freq = {}
for word in words:
if word in freq:
freq[word] += 1
else:
freq[word] = 1

print("Word Frequency:")
for word, count in [Link]():
print(word, "->", count)
print("Repeated Words:")
for word, count in [Link]():
if count > 1:
print(word, count)
27. Consider the following two commands with reference to a table, named 2
Students, having a column named Section:
(a) Select count(Section) from Students;
(b) Select count(*) from Students;
If these two commands are producing different results,
(i) What may be the possible reason?
(ii) Which command, (a) or (b), might be giving higher value?
OR
Name the aggregate functions which work only with numeric data, and
those that work with any type of data.
28. Write two points of difference between Circuit Switching and Packet Switching. 2
OR
Write two points of difference between XML and HTML

[Link]. Section-C(3x 3 = 9Marks) Marks


29. Write a method SHOWLINES() in Python to read lines from text file 3
‘[Link]’ and display the lines which do not contain 'ke'.
Example: If the file content is as follows:
An apple a day keeps the doctor away.
We all pray for everyone’s safety.
A marked difference will come in our country.
The SHOWLINES() function should display the output as:
We all pray for everyone’s safety.
OR
Write a function RainCount() in Python, which should read the content of
a text file “[Link]” and then count and display the count of occurrence
of word RAIN (case-insensitive) in the file.
Example: If the file content is as follows:
It rained yesterday
It might rain today
I wish it rains tomorrow too
I love Rain
The RainCount() function should display the output as: Rain - 2
30. Ashutosh has created a dictionary containing names and marks of 3
computer science as key,value pairs of 5 students. Write a program, with
separate user defined functions to perform the following operations:
● Push the keys (name of the student) of the dictionary into a stack, where
the corresponding value (CS marks) are more than or equal to 90 .
●Pop and display the content of the stack,if the stack is empty display the
message as “UNDER FLOW”.
For example: If the sample content of the dictionary is as follows:
CS={"Raju":80, "Balu":91, "Vishwa":95, "Moni":80, “Govind":90}
The output from the program should be:
Balu Vishwa Govind
The pop operation must display
Govind
vishwa
Balu
UNDER FLOW
OR
ANKIT have a list of 10 numbers. You need to help him create a
program with separate user defined functions to perform the following
operations based on this list.
● Traverse the content of the list and push the numbers divisible by 5 into
the stack.
● Pop and display the content of the stack, if the stack is empty display the
message” STACK EMPTY”
For Example:
If the sample Content of the list is as follows:
N=[2,5,10,13,20,23,45,56,60,78]
After the push operation the list must contain
5,10,20,45,60
And pop operation must display the output as
60
45
20
10
5
31. Predict the output of the Python code given below: 3
value = 50
def display(N):
global value
value = 25
if N%7==0:
value = value + N
else:
value = value - N
print(value, end="#")
display(20)
print(value)
OR
Predict the output of the Python code given below:
l=[]
for i in range(4):
[Link](2*i+1)
print(l[::-1])

[Link]. Section-D(4x 4 = 16Marks) Marks


32. Consider the following STAFF table: 4
empno ename desig sal Gen
1001 SACHIN PGT 90000 M
1005 TIMOTHY PRT 35500 F
2005 AISHWARYA TGT 49500 F
8090 SRINIVAS ASO 35000 M
7890 ARVIND JSA 28000 M
Write SQL Queries for the following assuming all kinds of data exist in the table.
a) Display name, designation of all staff members.
b) Display all staff members whose salary is between 50000 to 100000
c) Display name and gender of all PGTs
d) Display all staff members whose salary is not yet fixed.
(OR)
Write the output of the following queries as per the data contained in the above
table.
a) SELECT MAX(SAL), AVG(SAL) FROM STAFF;
b) SELECT SAL*0.1 AS “COMM” FROM STAFF WHERE GEN=’F’;
c) SELECT ENAME FROM STAFF WHERE ENAME LIKE ‘%I%’
d) SELECT COUNT(DISTINCT GEN) FROM STAFF;

33. What is the full form of csv? Write a Program in Python that defines and calls the 4
following userdefined functions:
(i)ADDR()– To accept and add data of a student to a CSVfile‘ [Link]’ .Each
Record consists of a list with field elements as rollno,name and mobile to store roll
number name and mobile no of student respectively.
(ii)COUNTR()– To count the number of records present in the CSVfile named
‘ [Link]’
34. Consider the following tables STUDENT and ST-HOUSE. 4
Table : STUDENT Table : ST-HOUSE
Cla clas Sec Rno Sname House Hid Hname HMaster
3 3 A 1 ROHAN H03 H01 GANGA VACHASPATHI
12 C 5 PALLAVI H04 H02 YAMUNA MADHURI
9 9 D 12 KIRAN H03 H03 NARMADA MURALI
11 11 A 6 SAMPATH H02 H04 KAVERI SRIHARI
a) Display class, section and name of all students belong to NARMADA house.
b) Identify the Primary key and foreign key in the above tables with justification for
Foreign key.
(OR)
b) Write SQL query to add a new column to ST-HOUSE table named Hmember of
Varchar type with size 20.
35. The code given below accepts the increments the value of Class by 1 foreach 4
student. The structure of a record of table Student is:
RollNo – integer; Name – string; Clas – integer; Marks – integer
Note the following to establish connectivity between Python and MYSQL:
Username is root, Password is abc
The table exists in a MYSQL database named school.
Write the following missing statements to complete the code:
import [Link] as mysql def sql_data():
con1=[Link](host="localhost",user="root",password="abc")
____________________________________#Statement 1
[Link]("use school")
________________________________#Statement 2
[Link](querry)
____________________________________# Statement 3
________________("Data updated successfully")
Statement 1 – to create the cursor object.
Statement 2 – to create the query to update the table.
Statement 3- to make the updation in the database permanent
Statement 4- to print
Section-E(2x 5 Marks = 10 Marks)
36. A binary file “[Link]” has structure [BookNo, Book_Name, Author, 5
Price].
i. Write a user defined function CreateFile() to input data for a record
and add to [Link] .
ii. Write a function CountRec(Author) in Python which accepts the
Author name as parameter and count and return number of books by
the given Author are stored in the binary file “[Link]”
OR
A binary file “[Link]” has structure (admission_number,
Name, Percentage). Write a function countrec() in Python that would
read contents of the file “[Link]” and display the details of
those students whose percentage is above 75. Also display number
of students scoring above 75%
37. Your school building has blocks named ‘Phase1’ , ‘phase2’ and ‘phase3. 5
The distances and no. of computers is as following.
Distance between blocks [Link] computers
From To distance Block [Link] Computers
Phase1 Phase2 40mts Phase1 25
Phase2 Phase3 200 mts Phase2 36
Phase3 Phase1 90 mts Phase3 96
a) Suggest the most appropriate block to house the server. Justify your
reason.
b) Draw the cable layout to connect all the blocks. Suggest the type of cable
for this connectivity.
c) Which block requires the placement of Switch/Hub?
d) Two blocks are suffering from signal loss? Identify them and suggest the
solution.
The school regional office is located 150 KM away from your school.
e)Suggest the type of communication/transmission media to be used
between your school and the Regional office.
KENDRIYA VIDYALAYA SANGATHAN, HYDERABAD REGION
MODEL QUESTION PAPER – I 2025-26

कक्षा / CLASS : XII समय / TIME : 3 HRS


विषय / SUBJECT : COMPUTER SCIENCE अविकतम अंक / MAX.
MARKS : 70
General 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 case of MCQ, text of the correct answer should also be written.
Section A (21 x 1 = 21 Marks)
[Link] Marks
1. State True or False: 1
Python allows function overloading using different argument types.
2. Identify the output of the following code snippet: 1

string = "HELLO_WORLD"
string = [Link]().replace('l', '$')
print(string)

(A) he$$o_world (B) he$$o_wor$d


(C) he$lo_world (D) he$$o_world

3. Which of the following conditions will evaluate to True?


(A) not(False) or True (B) False and True
(C) not(True or False) (D) True and False
4. What is the output of the expression? 1
word = 'Programming'
print([Link]('g'))
(A) ['Pro', 'rammin', ''] (B) ['Pro', 'rammin', 'g']
(C) ['Pro', 'ram', 'in'] (D) Error
5. What will be the output of the following code snippet? 1

phrase = "Knowledge"
print(phrase[-1::-3])

6. What will be the output of the following code? 1


list1 = [1, 2, 3]
list2 = list1
[Link](4)
print(list1 == list2)

(A) True (B) False (C) list1 (D) Error

7. Which statement will raise an exception? 1


sample_dict = {'x': 5, 'y': 10, 'z': 15}

(A) sample_dict.get('x')
(B) print(sample_dict['x', 'y'])
(C) sample_dict['y'] = 20
(D) print(str(sample_dict))
8. What does the `[Link](x)` method do in Python? 1

(A) Adds x to the beginning of the list


(B) Adds x to the end of the list
(C) Adds x to the middle of the list
(D) Removes the last element from the list
9. If a table has two primary keys and one unique key, how many candidate keys 1
will it have?

(A) 1
(B) 2
(C) 3
(D) 4
10. Write the missing statement to complete the following code: 1

```python
with open("[Link]", "w") as file:
[Link]("Hello World")
______________________
[Link]("Python Programming")
```

#Write a statement to flush the content without closing the file


11. True or False: Python's `finally` block executes even if an exception is raised in 1
the `try` block.
12. . What will be the output of the following code? 1

a=5
def increment():
global a
a += 5
print(a)

increment()

(A) 10 (B) 5 (C) Error (D) None


13. Which SQL command can be used to delete an existing table? 1
(A) DROP TABLE (B) DELETE TABLE (C) REMOVE TABLE (D) TRUNCATE TABLE
14. What will be the output of the query? 1

SELECT * FROM products WHERE product_name LIKE 'Pro%';

(A) Details of all products whose names start with 'Pro'


(B) Details of all products whose names end with 'Pro'
(C) Names of all products whose names start with 'Pro'
(D) Names of all products whose names end with 'Pro'
15. In which datatype the value stored is padded with zeros to fit the specified 1
length?

(A) DATE (B) VARCHAR (C) FLOAT (D) CHAR


16. Which aggregate function can be used to calculate the number of rows in a 1
table?

(A) SUM() (B) COUNT() (C) AVG() (D) MAX()


17. Which protocol is used to send email over the Internet? 1

(A) HTTP (B) FTP (C) SMTP (D) POP3


18. Which network device is used to connect multiple devices within the same 1
network and filter traffic?

(A) Router (B) Switch (C) Hub (D) Repeater


19. Which switching technique is used in circuit-switched networks? 1

(A) Packet Switching (B) Message Switching (C) Circuit Switching


(D) Virtual switching
20. Assertion (A): Positional arguments in Python functions must be passed in the 1
exact order in which they are defined in the function signature
Reasoning (R): This is because Python functions automatically assign default
values to positional arguments.

(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
21. Assertion (A): A SELECT command in SQL can have both WHERE and ORDER BY 1
clauses.

Reasoning (R): WHERE clause is used to filter records, and ORDER BY clause is
used to sort the filtered records.

(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
Section B (7 x 2 = 14 Marks)
22. How is a list different from a tuple in Python? Identify one mutable and one 2
immutable object from the following: (1, 2, 3), [4, 5, 6], {7: 'seven'}, 'eight'.
23. Give two examples of each of the following 2
(i) Logical operators (ii) Bitwise operators
24. . If L1 = [1, 2, 3, 4, 5, 6, 7, 8] and L2 = [10, 20, 30, 40], then: 2

(i) Write a statement to remove the last element from L1.


OR
(ii) Write a statement to add all elements of L2 to L1 at the end.
25. Identify the correct output(s) of the following code. Also write the minimum 2
and the maximum possible values of the variable `n`.

import random

s = "Learning"
n = [Link](1, 5)
for i in range(0, n):
print(s[i], end='@')

(A) L@ (B) L@e@ (C) L@e@a@r (D) L@e@a@r@n


26. The following code is intended to find the maximum value in a tuple. However, 2
there are syntax and logical errors in the code. Rewrite it after removing all
errors. Underline all the corrections made.

def find_maximum(tup)
max_value = tup(0)
for i in tup:
if i > max_value:
max_value = i
return max_value

result = find_maximum((1, 5, 3, 9, 2))


print("Maximum value:", result)

27. (A) What constraint should be applied to a table column to ensure that NULL 2
values are not allowed?
OR
(B) What constraint should be applied to a table column to ensure that all
values are unique?
28. (A) Define star topology. Mention one advantage and one disadvantage of 2
using it.
OR
(B) Expand the term IMAP. What is the use of IMAP?

Section C (3 x 3 = 9 Marks)
29. (A) Write a Python function that reads a text file "[Link]" and displays all the 3
lines that contain the word "Python".
OR
(B) Write a Python function that finds and displays all the words in a text file
"[Link]" that start with a vowel.
30. (A) You have a stack named `BookStack` that contains records of books. Each 3
book record is represented as a dictionary containing `title`, `author`, and
`year`.
Write the following user-defined functions in Python to perform the
specified operations on the stack `BookStack`:
- `push_book(BookStack, new_book)`: This function pushes the new book
record onto the stack.
- `pop_book(BookStack)`: This function pops the topmost book record from
the stack and returns it. If the stack is empty, it should display "Underflow".
- `peek(BookStack)`: This function displays the topmost book record without
deleting it. If the stack is empty, it should display 'None'.

OR
(B) Write a user-defined function `push_odd(N)` which accepts a list of
integers and pushes all the odd numbers into a stack named `OddNumbers`.
Write the function `pop_odd()` to pop the topmost number from the stack
and return it. If the stack is empty, it should display "Empty". Write function
`display_odd()` to display all elements of the stack without deleting them. If
the stack is empty, it should display 'None'.
31. Predict the output of the following code: 3

d = {"apple": 10, "banana": 5, "cherry": 8}


output = ""

for key, value in [Link]():


output += key + str(value) + "@"
print(output)

OR

Predict the output of the following code:

nums = [3, 6, 9, 12]


for i in nums:
for j in range(1, i % 4):
print(j, '#', end="")
print()

Section D (4 x 4 = 16 Marks)

32. Consider the table `ORDERS` as given below: 4

O_Id C_Name Product Quantity Price

1001 Ramesh Laptop 2 60000


1002 Suresh Smartphone 5 30000

1003 Priya Headphones 10 1500

Write the following SQL queries:

(i) To display the total quantity of each product where the quantity is more
than 3.
(ii) To display the orders sorted by price in ascending order.
(iii) To display the distinct customer names from the `ORDERS` table.
(iv) To display the sum of prices for all the orders where the quantity is not
null.

33. A CSV file "[Link]" contains data of different countries. Each record of 4
the file contains the following data:
- Country Name
- Population
- Number of cities with over 1 million people
- Average temperature

For example, a sample record of the file may be: `['India', 1300000000, 50,
25.4]`

Write the following Python functions to perform the specified operations


on this file:
(i) Read all the data from the file in the form of a list and display all records
where the population is greater than 1 billion.
(ii) Count the number of records in the file
34. . The table `FACULTY` and `COURSES` are given below: 4

F_ID FName LName Hire_Date Salary

101 Aman Singh 10-10-2005 15000

102 Nisha Khanna 05-06-2010 20000

103 Rohit Sharma 12-01-2018 25000

C_ID F_ID CName Fees

C01 101 Data Structures 30000

C02 102 Algorithms 25000

C03 103 Operating 20000


Systems
Write the following SQL queries:
(i) Display complete details (from both tables) of faculties whose salary is
greater than 18000.
(ii) Display the details of courses where the fees are between 20000 and
35000.
(iii) Increase the fees by 1000 for all courses where the course name starts
with 'Data'.
(iv) Display the faculty name (FName and LName) of the faculty teaching
'Algorithms'.
35. A table `GROCERY` in a database has the following structure: 4

Field Type

item_id int(11)

item_name varchar(20)

Price float

quantity int(11)

Write the following Python function to perform the specified operation:


- `AddAndDisplay()`: To input details of an item and store it in the table
`GROCERY`. The function should then retrieve and display all records from the
`GROCERY` table where the price is greater than 50.

Assume the following for Python-Database connectivity:


Host: localhost, User: root, Password: admin

Section E (2 x 5 = 10 Marks)

36. Varun is working as a HR manager in a company. He needs to manage the 5


records of employees. For this, he wants the following information of each
employee to be stored:
- Employee_ID (integer)
- Employee_Name (string)
- Department (string)
- Salary (float)

You have been assigned the task to write the following functions for Varun:

(i) Write a function to input the data of an employee and append it in a


binary file.
(ii) Write a function to update the data of employees whose salary is less
than 20000 and change their department to 'Support'.
(iii) Write a function to read the data from the binary file and display the
data of all those employees who belong to the 'IT' department.

37. Event Management Pvt. Ltd. is planning to set up a new branch office in 5
Hyderabad with a head office in Bangalore. The Hyderabad office will have
three departments: ADMIN, IT, and LOGISTICS. The details are given below:

Department to Department distances (in Meters):

From To Distance

ADMIN IT 40 m

ADMIN LOGISTICS 70 m

IT LOGISTICS 50 m

Distance of Bangalore Head Office from Hyderabad Branch = 600 km

Number of computers in each department:


- ADMIN: 15
- IT: 25
- LOGISTICS: 10
- Bangalore Head Office: 20

Answer the following questions:


(i) Suggest the most appropriate location for placing the server within the
Hyderabad office. Justify your choice.
(ii) Which hardware device would you suggest to connect all computers
within each department?
(iii) Draw a cable layout to efficiently connect various departments within
the Hyderabad office. Which cable would you suggest for efficient data
transfer?
(iv) Is there a need for a repeater in the given cable layout? Justify your
answer.
(v) (A) What would be your recommendation for enabling visual
communication between the Hyderabad office and the Bangalore Head Office
from the following options:
- Video Conferencing
- Email
- Telephony
- Instant Messaging
OR
(B) What type of network (LAN, WAN, MAN) will be set up among the
computers connected within the Hyderabad office?
KENDRIYA VIDYALAYA SANGATHAN, HYDERABAD REGION
MODEL QUESTION PAPER – I 2025-26

कक्षा / CLASS : XII समय / TIME : 3 HRS


विषय / SUBJECT : COMPUTER SCIENCE अविकतम अंक / MAX. MARKS : 70
General 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 case of MCQ, text of the correct answer should also be written.
प्र. क्र. प्रश्न QUESTION अं क
[Link] MARKS
SECTION – A(21 X1= 21 Marks )
1. a. State True or False : 1
b. The expression 2**2**3 is evaluated as : (2**2)**3
2. What is the output from the following code: 1
p="study material"
p='p'
print(p)
a. study material b. p c. studymaterial d. None of the
above
3. Identify the valid identifier out of the following: 1
a. item*qty b. $price c. for d. price
4. Which of the following among the four code fragments will yield following output: 1
Kendriya
Vidyalaya
Sangathan
a. print(' ' 'Kendriya b.
print('Kendriya\nVidyalaya\nSangathan')
\nVidyalaya\nSangathan' ' ')
c. print('Kendriya d. print(' ' 'KendriyaVidyalayaSangathan' ' ')
Vidyalaya
Sangathan’)
5. Which of the following will delete key-value pair for key=”Red” from a dictionary 1
D1?
a. delete D1["Red"] b. del D1["Red"]
c. del.D1["Red"] [Link]["Red"]
6. Given the following Tuple : 1
Tup=(10,20,30,40)
Which of the following statements will result in an error?
a. print(Tup[0]) b. [Link](2,3) [Link](Tup[1:2]) d. print
(len(Tup))
7. Write the output of the following: 1
a={1:34,3:45,5:58}
s=0
for i in a:
s+=i
print(s)
a.12 b. 8 c.9 d. 10
8. Write the output of the following code: 1
Q=[“Amit”,”Anita”,”Zee”,”Longest Word”]
print(max(Q))
a. Zee b. Longest Word [Link] [Link] of the above
9. Predict the output of the following code fragment: 1
def display(message,num=1):
print(message * num)
display("python")
display("Easy",3)
a. python b. pythonEasyEasyEasy c. a. pythonEasy d. Error
EasyEasyEasy EasyEasy
10. The pattern ‘ _ _ _’ matches any string of _____________three characters. 1
[Link] [Link] [Link] d. None of the above
11. Unauthorized electronic junk mail is called __________ 1
a. Trojan horse b. Worm c. Spam d. Computer Virus
12. Which of the following is an valid value for a field “price” having data type as 1
float(5,2)?
a. 12.3 b. 112.235 c. 123.2 d.124.56
13. Errors resulting out of violation of programming language’s grammer rules are 1
known as ____________
a. Compile time error c. Logical Error
b. Runtime error d. Syntax error
14. Which clause cannot be used with aggregate functions? 1
a. Group By b. Select c. Where [Link] (a) and (c )
15. Which of the following is not a legal constraint for a create table command? 1
a. Primary key b. Foreign key c. Unique d. Distinct
16. Hub is a ___________ 1
a. Broadcast Device b. Unicast device c. Multicast device d. None of
the above
17. Which of the following query contains an error? 1
a. Select * from emp where empid=10003;
b. Select empid from emp where empid=10006;
c. Select empid from emp;
d. Select empid where empid=1009 and lastname =”Gupta”;
18. Which of the following option is the correct Python statement to read and display 1
the first 10 characters of a text file “[Link]”?
a. f=open(“[Link]”)
print([Link](10))
b. f=open(“[Link]”)
print([Link](10))
c. f=open(“[Link]”)
print(f.read10))
d. f=open(“[Link]”)
print([Link](10))
19. Bluetooth is used to establish ____________connection. 1
[Link] [Link] c. MAN d. PAN
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) .Python standard library consists of number of modules. 1
Reasoning (R ). A function in a module is used to simplify the code and avoid
repetition.1
21. Assertion (A) . Both WHERE and HAVING clauses are used to specify conditions. 1
Reasoning (R ). WHERE and HAVING clauses are interchangeable.
[Link] SECTION – C (7 X 2 = 14 Marks ) Marks
22. There are two types of else clauses in python. What are these two types of else 2
clauses?
23. How = and == operators are different? Explain with example? 2
24. Write the Python statement for each of the following tasks using BUILT-IN 2
functions/methods only:-
(i) To delete an element which is at fifth position, in the list L.
(ii) To check whether a string named, country begins with “India”.
OR
A list named emp stores age of Employees of a company. Write the Python
command to import the required module and (using built-in function) to display the
most common age value from the given list.
25. Sameer has written a python program to count the occurrences of elements of a list 2
using a dictionary. But the code has some syntax errors. Re-write the code after
removing all such errors and underline your corrections.
L = [1,2,1,1,2,1,2,3,5,4,1,2,5,4,4,5]
D = {}
foreach x in L:
if x in D:
D[x]=+1
Else:
D(x)=1

26. What possible outputs(s) are expected to be displayed .from the following code? 2
Also specify the maximum values that can be assigned to each of the variables
Lower and Upper.
import random
AR = [25, 35, 45, 55, 65, 78]
L = [Link](1, 3)
U = [Link](2, 4)
for K in range(L, U +1):
print (AR[K], end= “#”)
(i) 35#45# (ii) 25#35#45# (iii) 55#65#78# (iv) 25#35#45#55#

27. (i) (A) A table, shop has been created in a database with the following fields: 2
Shop No, Shopname , Type , Category , Location
Give the SQL command to display the structure of the table.
Or
(B) Write a query to remove the record whose Shop_No is 255 and is of category
"Electronics".

Ii ) (A) Which declaration of data type doesn't use the same number of bytes for
every record and consumption of bytes depends on the input data?
Or

(B) Which declaration of data type will consume the same number of byte declared
and is right padded"?
28. (i) Expand the following terms : 2
VoIP , URL
or
(i) Give one difference between Twisted Pair and Co-axial Cable.

[Link] SECTION – C (3 X 3 = 9 Marks ) Marks


29. Write a method in python to read the lines from a text file [Link], to find and 3
display the occurrence of the word “India”?

Or
Write a function show_words () in python to read the content of a tes=xt file
“[Link]” and display the entire content in capital letters.
Example
This is a test file
Then the function should display the output as : THIS IS S TEST FILE
30. Write functions in python to maintain stack of data about packages through 3
following functions:
i) push() to add a new package
ii) pop() to delete a package from a list of package
iii) display () the available packages .

or
Thushar received a message(string) that has upper case and lower-case alphabet.
He want to extract all the upper case letters separately .Help him to do his task
by performing the following user defined function in Python:
a) Push the upper case alphabets in the string into a STACK
b) Pop
c) display the content of the stack.
For example:
If the message is “All the Best for your Pre-board Examination”
The output should be : E P B A

31. Give the output of following, if the value of string is ‘abacus@2023’: 3


string= input( "Enter a string :”)
count=3
while True:
if string[0] == 'a':
string= string[2 :]
elif string[-1] == ‘b’:
string =string [: 2]
else:
count+= 1
break
print (string)
print(count)
[Link] SECTION – D (4 X 4 = 16 Marks ) Marks
32. Consider the following student table – 4
Rollno Firstname Lastname Gender stream
1 Akash Singh Boy Science
2 Deepak Sarkar Boy Commerce
3 Gajendra Kumar Boy Null
4 Girija Bhardwaj Girl Science

Write the SQL Commands for the following –


(i) To show the first names of boys in science stream.
(ii) To show the records in lastname wise in Alphabetical Order.
(iii) To drop the column gender from the table.
(iv) To display different streams.
OR
Write the effect / output of the following commands –
(i) select * from student where stream is null;
(ii) delete from student where gender = ‘girl’;
(iii) alter table student rename column stream to course;
(iv) Select lastname from student where lastname like ‘%h’;
33. Write a program in python that defines the following user defined functions: 4
a. ADD() to accept and add data of an employee to a csv file ‘[Link]’. Each
record consists of a list with field elements as empid, name and mobile to
store employee id, employee name and employee salary respectively.
b. COUNT() to count the number of records present in the csv file named
‘[Link]’.
34. Raman has problem in writing the desired SQL queries for the table Doctors and 4
salary, help him in writing queries .
Doctor
ID Name Dept Gender Exp
101 John ENT M 10
104 Smith Orthopedic M 12
107 George Cardiologist M 8
114 Lares Skin M 5
109 Lucy ENT F 6
111 Morphy Orthopedic M 8
130 Aruna Skin F 11

Salary
ID Basic Allowance Consultation
101 12000 1000 300
104 20000 2000 500
107 15000 4000 400
114 32000 2500 300
109 21700 1500 100
111 15500 1500 200
130 12500 1700 500

i) Display complete details of doctors along with their salary whose dept is
skin.
ii) Increase the basic salary by Rs.200/- for all the doctors.
iii) Add the following details into doctor’s table:
(145,”Shalini”,”ENT”,”F”,12)
iv)
A ) Display dept and number of doctors for each dept.
Or
B) Display number of male and female dotors.
35. Kashyap wants to write a program in python to insert the following record in the 4
table named student in mysql database , SCHOOL:
Rno – Integer name – String
DOB – Date Fee - float
Note the following to establish connectivity between python and MySQL
Username : root
Password : mysql
Host : localhost
The values to be accepted from the [Link] Kashyap to write the program in
python.

[Link] SECTION – E (2 X 5 = 10 Marks ) Marks


36. Tiwari wants the data of products to be maintained in system through program. 5
Help him in adding , searching and checking details of the products using binay
files.
The item details are :
Itemno Integer
Itemname String
Quantity int
Price float
a) Write a function add() to input the data from the user and append in binary
file.
b) Write a function display () those items whose price Is more than Rs.100 /.
c) Write a function to update() the data of those items whose qty is 1345 to
150.
37. Ionex Private Ltd. Patna has different divisions Marketing (A1), Sales (A2), Finance 5
(A3) and Production (A4). The company has another branch in New Delhi. The
management wants to connect all the divisions as well as all the computers of each
division (A1, A2, A3, A4) of Patna branch.
Distance between the divisions are as follows :
DIVSIION DISTANCE
A3 to A1 20m
A1 to A2 35m
A2 to A4 20m
A4 to A3 130m
A3 to A2 1000m
A1 to A4 190 m
The number of computers in each division is as follows :

DIVSIION DISTANCE
A1 50
A2 40
A3 110
A4 60

Based on the above configurations, answer the following questions :


(i) Suggest the division which should be made server by quoting suitable reasons.
division with the New Delhi branch by giving suitable reasons.
(ii) Suggest the placement of following devices
(a) Switch (b) Repeater
(iii) Suggest the topology and draw the most suitable cable layout for connecting all
the divisions of the Patna branch.

(iv) The company wants to conduct an online video conference between employees
of the Patna and New Delhi branches. Name the protocol which will be used to
send voice signals in this conference.
(v)
A)Suggest the type of network (PAN, LAN, MAN, WAN) required to connect the
Finance (A3) with New Delhi Office
OR
B) If the company is planning to provide to provide a high speed link with its head
office situated in NewDelhi using a wired connection .Which of the following will be
most suitable for this job?
a) Optical fibre b) Co-axial cable c) Ehernet cable
KENDRIYA VIDYALAYA SANGATHAN, HYDERABAD REGION
MODEL QUESTION PAPER (2024 - 25) T SRINIVAS
Class: XII Time: 3hrs
Subject: COMPUTER SCIENCE (083 ) Max Marks: 70

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 21 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 04 Short Answer type questions carrying 03 marks each.
6. Section D has 02 Long Answer type questions carrying 04 marks each.
7. Section E has 03 questions carrying 05 marks each.
8. All programming questions are to be answered using Python Language only.
SECTION-A
S. Question Marks
No
1 What is the return type of function id? 1
a) int b) float c) bool d) dict
2 What error occurs when you execute the following statement? 1
apple = mango
a) SyntaxError
b) NameError
c) ValueError
d) TypeError
3 Carefully observe the code and give the answer. 1
def example(a):
a = a + '2'
a = a*2
return a
>>>example("hello")
a) indentation Error
b) cannot perform mathematical operation on strings
c) hello2
d) hello2hello2
4 Aryan created a table(Students) with 5 rows and 6 columns. After few days based on the 1
requirement he added 3 more rows to the table. What is the cardinality and degree of the table?
a) cardinality=6,degree=8
b) cardinality=8,degree=6
c) cardinality=5 degree=8
d) None of the above
5 What is the output of the following? 1
print("xyyzxyzxzxyy".count('xyy', 0, 100))
a) 2
b) 0
c) 1
d) error
6 What is the output of the below program? 1
def func(a, b=5, c=10):
print('a is', a, 'and b is', b, 'and c is', c)

func(3, 7)
func(25, c = 24)
func(c = 50, a = 100)

a) a is 7 and b is 3 and c is 10
a is 25 and b is 5 and c is 24
a is 5 and b is 100 and c is 50
b) a is 3 and b is 7 and c is 10
a is 5 and b is 25 and c is 24
a is 50 and b is 100 and c is 5
c) a is 3 and b is 7 and c is 10
a is 25 and b is 5 and c is 24
a is 100 and b is 5 and c is 50
d) None of the mentioned
7 Which of the following statements are true? 1
a) When you open a file for reading, if the file does not exist, an error occurs
b) When you open a file for writing, if the file does not exist, a new file is created
c) When you open a file for writing, if the file exists, the existing file is overwritten with the
new file
d) All of the mentioned
8 Which of the following is equivalent to [Link](3, 6)? 1
a) [Link]([3, 6])
b) [Link](3, 6)
c) 3 + [Link](3)
d) 3 + [Link](4)
9 Entries in a stack are “ordered”. What is the meaning of this statement? 1
a) A collection of stacks is sortable
b) Stack entries may be compared with the ‘<’ operation
c) The entries are stored in a linked list
d) There is a Sequential entry that is one by one
10 Bridge works in which layer of the OSI model? 1
a) Application layer
b) Transport layer
c) Network layer
d) Data link layer
11 SMTP stands for 1
a) sample mail transfer protocol
b) simple message transportation protocol
c) simple mail transfer protocol
d) synchronous message transmit protocol
12 Which of the following statement will reverse the list L1? 1
a)L1[::1]
b)L1[-1::-1]
c)L1[::-1]
d)None of the above
13 Out of one or more candidate keys, the attribute chosen by the database designer to uniquely 1
identify the tuples in a relation called______ of that relation.
a)primary key
b)foreign key
c)composite primary key
d)alternate key
14 The loop else statement is executed when 1
a)the for loop is executed for the last value in the sequence
b)the while loop test condition evaluates to false
c)both a and b
d)none of the above
15 Hub decreases the traffic in the network whereas switch increases the traffic in the network. 1
(Ture/False)
16 Which of the following expressions evaluates to False? 1
a) not(True) and False
b) True or False
c) not(False and True)
d) True and not(False)
17 Which of the following is an invalid identifier? 1
(a)_123 (b) E_e12 (c) None (d) true
18 Which of the following is a DML command? 1
(a) DROP (b) INSERT (c) ALTER (d) CREATE
19 Which aggregate function can be used to find the cardinality of a table? 1
a) sum()
b) count()
c) avg()
d) max()
20 Assertion(A):Python uses immutable types for call by value mechanism 1
Reason (R):in the call by value mechanism, the called function makes a separate copy of
passed values and then works with them.
a) Both A and R are wrong
b)A is wrong, but R is right
c)A is right, but R is wrong
d)Both A and B are Right
21 Assertion (A): Python automatically flushes the file buffers before closing a file with close () 1
function.
Reason (R): when you open an existing file for writing, it adds the content at the end of the
file.
a) Both A and R are wrong
b)A is wrong, but R is right
c)A is right, but R is wrong
d)Both A and B are Right
SECTION-B
22 Write the output given by following Python code. 2
x=1
def fun1():
x=3
x=x+1
print(x)

def fun2():
global x
x=x+2
print(x)

fun1()
fun2()
OR
What do you mean by scope of a variable? Explain different types of scopes with the help of
suitable example.
23 (i) Write the SQL statement to add a field Country_Code(of type Integer) to the table 1+1
Countries with the following fields.
Country_id, Country_name, Continent, Region_id
(ii) Which of the following is not a DML command?
DELETE FROM, DROP TABLE, CREATE TABLE, INSERT INTO
24 Write a function to take a number(atleast 5digit) as argument and prints alternative digits of 2
the number
OR
Write a function which accepts a dictionary with name of the student as key and Admission
number as value and returns a dictionary with admission number as key and name as value.
25 Write two points of difference between Bus Topology and Tree Topology. 2
OR
Write two points of difference between Packet Switching and Circuit Switching techniques?

26 2

Write the output of the queries (a) to (d) based on the table SCHOOLADMIN given above:
a) SELECT max (DOB) FROM SCHOOLADMIN;
b) SELECT Name FROM SCHOOLADMIN WHERE STREAM< >"Business Admin" AND
SECTION IS NULL;
c) SELECT count (NAME) FROM SCHOOLADMIN WHERE SECTION IS NOT NULL;
d) SELECT count (NAME) FROM SCHOOLADMIN WHERE SECTION IS NOT NULL
AND STREAM="FINE ARTS";
27 Rewrite the following Python program after removing all the syntactical and logical errors (if 2
any), underlining each correction:
def checkval:
x = input(“Enter a number”)
if x % 2 = 0:
print x,”is even”
else if x<0:
print x,”should be positive”
else;
print x,”is odd”
28 (a) What is the output produced by the following code – 2
d1={“b”:[6,7,8],”a”:(1,2,3)}
print([Link]())
a) { (1,2,3) , [6,7,8] }
b) [[6,7,8],(1,2,3)]
c)[6,7,8,1,2,3]
d) (“b”, “a”)
(b) What is the output of given program code:
list1 = range(100,110)
print( [Link](105))
(a) 4 (b) 5 (c) 6 (d) Error
SECTION-C
29 (a)Write a function in python to count the number of lines in “[Link]” that begins with 3
Upper case character.
OR
Write a function in python to read lines from file “[Link]” and count how many times the
word “INDIA” exists in file.
30 Write a function in Python PUSH(Num), where Num is a list of integer numbers. From this 3
list push all positive even numbers into a stack implemented by using a list. Display the stack
if it has at least one element, otherwise display appropriate error message.
OR
Write a function in Python POP(cities), where cities is a stack implemented by a list of city
names for eg. cities=[‘Delhi’, ’Jaipur’, ‘Mumbai’, ‘Nagpur’]. The function returns the value
deleted from the stack.
31 Write a function EVEN_LIST(L), where L is the list of elements passed as argument to the 3
function. The function returns another list named ‘evenList’ that stores the indices of all even
numbers of L.
For example:
If L contains [12,4,3,11,13,56]
The evenList will have - [0,1,5]

SECTION-D
32 4
(a)Sonal needs to display name of teachers, who have “0” as the third character in their name.
She wrote the following query.
SELECT NAME FROM TEACHER WHERE NAME = “$$0?”;
But the query is’nt producing the result. Identify the problem.
(b)Write output for (i) to (iv) based on table COMPANY and CUSTOMER.

[Link] COUNT(*) , CITY FROM COMPANY GROUP BY CITY;


[Link] MIN(PRICE), MAX(PRICE) FROM CUSTOMER WHERE QTY>10;
[Link] AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r%;
[Link] PRODUCTNAME, CITY, PRICE FROM COMPANY, CUSTOMER
33 Write a python program to create a csv file [Link] and write 10 records in it with the 4
following details: Dvdid, dvd name, qty, price.
Display those dvd details whose dvd price is more than 25.
34 Consider the tables below to write SQL Queries for the following: 4
[Link] display TEACHERNAME, PERIODS of all teachers whose periods are more than 25.
[Link] display all the information from the table SCHOOL in descending order of experience.
iii. To display DESIGNATION without duplicate entries from the table ADMIN.
iv. To display TEACHERNAME, CODE and corresponding DESIGNATION from tables
SCHOOL and ADMIN of Male teachers.
35 A binary file “[Link]” has structure [ITEMID, ITEMNAME, QUANTITY, PRICE]. 4
(i) Write a user defined function MakeFile( )to input data for a record and add to [Link].
(ii) Write a function GetPrice(ITEMID) in Python which accepts the ITEMID as parameter
and return PRICE of the Item stored in Binary file [Link].
OR
A binary file “[Link]” has structure (EMPID, EMPNAME, SALARY).
Write a function CountRec( )in Python that would read contents of the file
“[Link]” and display the details of those Employees whose Salary is above 20000.
Also display number of employees having Salary more than 20000.
SECTION E
36 Perfect Edu Services Ltd. is an educational organization. It is planning to setup its India 5
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.

(i) Suggest the most appropriate location of the server inside the CHENNAI campus (out
of the 4 buildings), to get the best connectivity for maximum no. of computers. Justify
your answer.
(ii) Suggest and draw the cable layout to efficiently connect various buildings within the
CHENNAI campus for connecting the computers.
(iii) Which hardware device will you suggest to be procured by the company to be installed
to protect and control the internet uses within the campus?
(iv) Which of the following will you suggest to establish the online face-to-face
communication between the people in the Admin Office of CHENNAI campus and
DELHI Head Office?
(a) Cable TV
(b) Email
(c) Video Conferencing
(d) Text Chat
(v)Name protocols used to send and receive emails between CHENNAI and DELHI office?
37 (a)Write the outputs of the SQL queries (i) to (iii) based on relations EMP and DESIG given 2+3
below:
Table: EMP
E_ID Name Gender Age DOJ Designation
1 Om Prakash M 35 10/11/2009 Manager
2 Jai Kishan M 32 12/05/2013 Accountant
3 Shreya Sharma F 30 05/02/2015 Clerk
4 Rakesh Minhas M 40 15/05/2007 Manager
5 Himani Singh F 33 19/09/2010 Clerk

Table: DESIG
Salary E_ID DEPT_ID
45000 1 D101
35000 2 D102
45000 4 D101
(i) SELECT Designation, count(*) FROM EMP GROUP BY Designation;
(ii) SELECT AVG(Age) FROM EMP;
(iii) [Link],[Link],[Link] FROM EMP,DESIG WHERE EMP.E_ID =
DESIG.E_ID AND [Link]>35;

(b)Preety has written the code given below to read the following record from the table named
employee and displays only those records who have salary greater than 53500:
Empcode – integer
EmpName – string
EmpSalary – integer

Note the following to establish connectivity between Python and MYSQL:


• Username is root
• Password is root@123
• The table exists in a MYSQL database named management.
Write the following missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the query that extracts records of those employees whose salary are
greater than 53500.
Statement 3- to read the complete result of the query (records whose salary are greater than
53500) into the object named data, from the table employee in the database.
import [Link] as mysql
def sql_data():
con1=[Link](host="localhost",user="root",password="root@123",
database="management")
mycursor=_______________ #Statement 1
print("Employees with salary greater than 53500 are : ")
_________________________ #Statement2
data=__________________ #Statement 3
for i in data:
print(i)
print()

You might also like