Computer Science
Computer Science
Page: 1/11
(A) True (B) False (C) list_a (D) Error
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)
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”]
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:
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:
result = ""
for n in numbers:
print()
Q No Section-D ( 4 x 4=16 Marks) Marks
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
Table: TEACHERS
Table: COURSES
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.
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.
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
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) 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)
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:
(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.
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
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
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
[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.
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
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
[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.
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])
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]))
CLIENT
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:
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
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
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.
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]”.
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)
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
M03 Medimix
M04 Pepsodent
M05 Dove
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
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])
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
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
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
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]
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.
Table : GARMENT
Table :FABRIC
FCODE TYPE
F04 POLYSTER
F02 COTTON
F03 SILK
F01 TERELENE
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
(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.
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
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
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
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
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.
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
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.
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}
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.
(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
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)
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)['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.
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:
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 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.
(ii) Pop_patient(SurgeryStack): Pop and display the names of the patients from the
stack until it is empty, then print "Stack Empty".
OR
Table: COACH
PCode Name ACode
1 Ahmad Hussain 1001
2 Ravinder 1008
3 Janila 1001
4 Naaz 1003
Field Type
emp_id int(11)
emp_name varchar(30)
department varchar(20)
salary float
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:
[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
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.
[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.
Note: The table contains many more records than shown here.
[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
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:
प्र.क्र. अं क
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
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.
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’.
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
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
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))
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?
Page 4 of 8
28 (A) What is the difference between HTTP and FTP? 2
OR
(B) Expand the following: HTML, PPP
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}
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)
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
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.
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:
(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.
[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)
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.
OR
For example: If the patients' input into the list PatientList are:
OR
Table: COACH
PCode Name ACode
1 Ahmad Hussain 1001
2 Ravinder 1008
3 Janila 1001
4 Naaz 1003
Field Type
emp_id int(11)
emp_name varchar(30)
department varchar(20)
salary float
In continuation of the above, the company experts have planned to install the
following
number of computers in each of their offices:
[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
(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.
print(A_func(5), A_func( ))
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])
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:
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
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
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.
[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
Note: The table contains many more records than shown here.
[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
[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
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:
प्र.क्र. अं क
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
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’.
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)
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
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
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.
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
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
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
string = "HELLO_WORLD"
string = [Link]().replace('l', '$')
print(string)
phrase = "Knowledge"
print(phrase[-1::-3])
(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) 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")
```
a=5
def increment():
global a
a += 5
print(a)
increment()
(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
import random
s = "Learning"
n = [Link](1, 5)
for i in range(0, n):
print(s[i], end='@')
def find_maximum(tup)
max_value = tup(0)
for i in tup:
if i > max_value:
max_value = i
return max_value
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
OR
Section D (4 x 4 = 16 Marks)
(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]`
Field Type
item_id int(11)
item_name varchar(20)
Price float
quantity int(11)
Section E (2 x 5 = 10 Marks)
You have been assigned the task to write the following functions for Varun:
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:
From To Distance
ADMIN IT 40 m
ADMIN LOGISTICS 70 m
IT LOGISTICS 50 m
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.
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
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.
DIVSIION DISTANCE
A1 50
A2 40
A3 110
A4 60
(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.
(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