Kv Preboard Papers-1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 56

KENDRIYA VIDYALAYA SANGATHAN: JABALPUR REGION

FIRST PRE-BOARD (2024-25)


CLASS: XII Time allowed: 3 Hours Maximum Marks:70
COMPUTER SCIENCE (083-THEORY)

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 carries1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

Q No. Section-A (21x1=21Marks) Marks

1. State-True or false:
Python interpreter handles semantic errors during code execution. (1)
2. (A) Which of the following will return False:
(B) A) not (True and False) B) True or False (1)
(C) C) not (True or False) D) not (False and False)
3. (A) Which of the following function will help in converting a string to list with
elements separated according to delimiter passed? (1)
(D) A) list( ) B) split( ) C) str( ) D) shuffle( )
4. What is the output of the following?
OCEANS=('pacific','arctic','Atlantic','southern') (1)
print(OCEANS[4])
A) ‘southern’ B) (‘southern’) C) Error D) INDEX
5. What is the output of the following (1)
x="Excellent day"
print(x[1::3])
A) x B) xlnd C) error D) dnlx
6. What can be the possible output of the following code:
def Element(x):
z=""
for y in x:
if not y.isalpha():
z=z+z.join(y) (1)
print(z)
Element("W2e0Py2th4n") #Function Call
A) 2 B) 02 C) 024 D) 2024
7. If D={‘Mobile’:10000, ‘Computer’:30000, ‘Laptop’:75000} then which of the
following command will give output as 30000
A) print(D) B) print(D['Computer'])
C) print(D.values( )) D)print(D.keys( )) (1)

1
8. Which of the following is not correct?
(A) del deletes the list or tuple from the memory
(B) remove deletes the list or tuple from the memory (1)
(C) pop is used to delete an element at a certain position
(D) pop(<index>) and remove(<element>) performs the same operation
9. A relation in a database can have _____ number of primary key(s)?
A) 1 B) 2 C) 3 D) 4 (1)
10. What is the value of ‘p’ and how many characters will be there in the variable
‘data’ in the following statement (1)
with open ("lists.txt","r",encoding="utf-8") as F:
data = F.read(100)
p=F.seek(10,0)
print(p)
A) 10, 100 B) 100, 10 C) 10, 110 D) 110, 10
11. Write the name of block / command(s) can be used to handle the error/exception in (1)
Python.
12. What will be the output of the following code?
def add():
c=1
d=1
while(c<9):
c=c+2 (1)
d=d*c
print(d, end="$")
return c
print(add( ),end="*")

A) 945$9* B) 945$9 C) 9*945$ D) 9$945*


13. Which type of command is used to delete the structure of the relation? (1)
A) DDL B) DML C) Select D) Cannot delete structure
14. What will the following query show?
(considering a table student with some columns)
SELECT * FROM students WHERE age in (17,19,21);
A) Show tuples of students table with all the age values from 17 to 21 (1)
B) Show tuples of students table only with the age values 17,19,21
C) Show tuples of students table only with the age values other then 17,19,21
D) Show tuples of students table with all the age values outside the range 17 to 21
15. Which of the following is not a data type in Python
A) date B) string C) tuple D) float (1)
16. Which of the following is not an aggregate function?
A) max( ) B) count( ) C) sum( ) D) upper( ) (1)
17. Which of the following protocol helps in e-mail services?
A) FTP B) PPP C) UDP D) MIME (1)
18. In order to cover a long-distance network which of the following device will be (1)
helpful?
A) Modem B) Gateway C) Switch D) Repeater
19. What is SIM & GPRS? (1)
A) Small Information Machine & Global People Research and Science
B) Subscriber Identity Module & General Packet Radio Service
C) Subscriber Information Module & General Public Radio Shrive
D) None of these

2
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice as:
A) Both A and R are true and R is the correct explanation for A
B) Both A and R are true and R is not the correct explanation for A
C) A is True but R is False
D) A is False but R is True

20. Assertion(A): In a relation of RDBMS, redundancy can be reduced.


Reasoning (R): This can be done with the help of join operations in between
relation. (1)
21. Assertion (A): A function in Python can have any number of arguments.
Reasoning(R): variable length parameter can be used to deal with such number of
arguments. (1)
Q No Section-B (7x2=14 Marks) Marks
22. a) Explain dictionary with example?
b) What is the data type of (i) x=10 (ii) x=10,20 (2)
23. Explain ‘in’ operator and write a small code in Python to show the use of ‘in’ (2)
operator.
24. Consider T=(10,20,30) and L=[60,50,40] answer the question I and II (1)
(I) Write command(s) to add tuple T in list L.
OR
Write command to find and delete element 20 from tuple T
(II) Write command to add 50 in L at position 2. (1)
OR
Write command to delete the variable T.
25. Identify the correct output(s) of the following code and write the minimum and the
maximum possible values of the variable b.
import random
a="ComputerScience"
I=0
while (I<3):
b=random.randint(1,len(a)-1) (2)
print(a[b],end='$')
I+=2

A) C$m$ B) m$p$ C) c$n$ D)c$e$c$


26. Write a function named RECORDS() which can open a binary file named
‘district.dat’ containing the population data of all the districts of a state. The
function will ask for the name of the district to be searched in file and display its (2)
data from the file. [Note: Name of dist. is stored at 0 index of record in district.dat]
27. [I]
A) Benjamin a database administrator created a table with few columns. He
wants to stop duplicating the data in the table. Suggest how he can do so.
OR
B) Consider two tables student (rno, name, class) and marks (rno, mrk_obt,
percent). You as a database administrator how will your stop redundancy of
data in the table students and how the tables students and marks can be
connected with each other (2)
[II]
A) Write an SQL command to change the data type of a column named price
to number (10,2) in a table named stationary
OR
3
B) Write an SQL command to change the values of all the rows of the column
price of table stationary to Null
28. A) Difference between star and mesh topology.
OR (2)
B) Write the full forms of (i) VoLTE (ii) GSM

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


29. A) Write a Python function that displays all the words starting from the letter ‘C’
in the text file "chars.txt".
OR (3)
B) Write a Python function that can read a text file and print only numbers stored
in the file on the screen (consider the text file name as "info.txt").
30. A) You have a stack named Inventory that contains records of medicines. Each
record is represented as a list containing code, name, type and price.
Write the following user-defined functions in Python to perform the specified
operations on the stack Inventory:
i. New_In (Inventory, newdata): This function takes the stack Inventory and
newdata as arguments and pushes the newdata to Inventory stack.
ii. Del_In(Inventory): This function removes the top most record from the
stack and returns it. If the stack is already empty, the function should
display "Underflow".
iii. Show_In(Inventory): This function displays the topmost element of the (3)
stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
B) Write the definition of a user-defined function `Push(x)` which accepts a string
in parameter `x` and pushes only consonants in the string `N` into a Stack named
`Consonants`.
Write function Display () to display all element of the stack.

For example: x = “Python”


Then the stack `Consonants’ should store: [‘P’,’y’,’t’,’h’,’n’]
31. Predict the output of the following code:
d={}
V="programs"
for x in V: (3)
if x in d.keys():
d[x]=d[x]+1
else:
d[x]=1
print(d)
OR
Predict the output of the following code:
V="interpreter"
L=list(V)
L1=""
for x in L:
if x in ['e','r']:
L1=L1+x
print(L1)

4
Q No. Section-D( 4x4=16Marks) Marks
32. Consider the tables given below
Watches
Id Wname Price Type Qty
W01 High Time 1200 Common 75
W02 Life line 1600 Gents 150
W03 Wave 780 Common 240
W04 Timer 950 Gents 460
W05 Golden era 1760 Ladies 250
(4)
WSale
Wid QSold Qtr
W01 25 1
W02 23 1
W03 2 1
W04 10 2
W05 12 2
W03 22 3
W04 22 3
W02 23 3

“Note: Consider the table contains the above records.”


A) Write the queries for the following:
i) To display the total quantity sold (qsold) of wsale for qtr number 3.
ii) To display the details of watches in descending order of qty.
iii) To display the total quantity of watches.
iv) To display the wname and maximum qsold from the table watches and
wsale sold in qtr=1
OR
B) Write the output
i) Select sum(price) from watches;
ii) Select * from watched where wname '%e';
iii) Select sum(qty), type from watches group by type;
iv) Select wname, price, qtr from watches, wsold
where watches.id = wsale.wid and watches.type=’Common’;
33. A csv file "candidates.csv" contains the data collected from an online application form
for selection of candidates for different posts, with the following data
 Candidate Name
 Qualification (4)
 Percent_XII
 Percent_Qualification
E.g. [‘Smith Jones’, ‘M Tech’, 80, 76]
Write the following Python functions to perform the specified operations on this file:
a) READ() function which can read all the data from the file and display only records
with Percent_XII more than 75
b) IDENTIFY() function which can find and print the number of such records which are
having Percent_XII not more than 75
34. A school is maintaining the records of his departments and their in-charges in the
following table and wants to see the data according to the following conditions. Study
the following table and write the queries for (i) to (iii) and output for (iv)

Table: Departments

5
D_No D_name D_Incharge Date_join grant
D94 Physics Binny 12-10-2021 34000
D46 Chemistry Virat 24-12-2010 49500
D78 Biology Jimmy 10-05-2001 79000 (4)
D99 Geography Adams 05-09-2006 62000
D23 Primary Ajay 15-06-2009 Null

(i) To display complete details of those departments where date_join is less then
01-01-2010
(ii) To display the details of departments with the name of incharges containing
m in their name.
(iii) To increase the grant of department by 1200 of D_no either D99 or D23.
(iv) Select d_name, grant from department where grant is null;
OR
Select sum(grant) from department where date_join>’10-10-2020’;
35. Consider a database named ‘DB’ containing a table named ‘Vehicle’ with the following
structure
Field Type
Model char(10)
Make_year Int(4)
Qty Int(3) (4)
Price Number(8,2)

Write the following Python function to perform the following operation as mentioned:
1. Add_Vehicle() - which takes input of data and store it to the table
2. Search_vehicle() – which can search a model given by user and show it on screen
* Assume the following for Python – Database connectivity:
Host: localhost, User: root, Password: root
Q.No. SECTIONE(2X5=10 Marks) Marks
36. Rajiv Kumar is an owner of a company willing to manage the data of his office
employees like their biodata, salary centrally for all his offices located in the state of
Karnataka.
He planned to make a database named ‘company’ with the table ‘staff’ that contains
following structure
- ID–integer(4)
- Name–string(30)
- Designation–string(10)
- Birth_date–date
- Salary-decimal(10,2)

You as his database administrator write the following queries (I) to (IV)

(I) Create a table ‘staff’ with above structure and id as primary key. (2)
(II) Display all the records with designation ‘Sales Executive’ (1)
(III) To change the designation = ‘Assistant’ of all the staff having salary from (1)
15000 to 17000 (both values included)
(IV) To display the total number of records with name ending at letter ‘j’ (1)
37. PK International is an advertising agency who is setting up a new office in Gurgaon in
an area of 2.5 kms with four building Admin, Finance, Development, Organizers. You
have been assigned the task to suggest network solutions by answering the following
questions (i) to (v)

6
No. of computers in the building Distance between buildings
Admin 10 Admin-Finance 96
Finance 10 Admin-Development 58
Development 46 Admin-Organizers 48
Organizers 25 Finance-Development 42
(5)
Finance-Organizers 35
Development-Financers 40

Finance
Organizers

Development
Admin

i) Suggest the most appropriate location of the server inside the above campus.
Justify your choice.
ii) Which hardware device can be used to connect all the computers within each
building?
iii) Draw the cable layout for economic and efficiently connect various buildings
within the campus?
iv) Whether repeater is required for your given cable layout? Yes or No? Justify
your answer.
v) A) Give your recommendation for live visual communication between all the
offices and customer located in different cities
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN or WAN) will be setup
among the computers connected in this campus?

7
KENDRIYA VIDYALAYA SANGATHAN: JABALPUR REGION
PREBOARD-1 (2024-25)
COMPUTER SCIENCE (THEORY)
CLASS: XII Time allowed: 3 Hours Maximum Marks:70
Marking Scheme
General Instructions:
● In case any doubt regarding the answer the evaluator can check by himself/herself and do the
needful

Q No. Section-A (21x1=21Marks) Marks


1. False (1)
2. (A) C) not (True or False) (1)
3. (B) B) split() (1)
4. (A) C) error (1)
5. B) xlnd (1)
6. D) 2024 (1)
7. B) print(D['Computer']) (1)
8. B) remove deletes the list or tuple from the memory (1)
9. A) 1 (1)
10. B) 100, 10 (1)
11. try …except block (1)
12. A) 945$9* (1)
13. A) DDL (1)
14. B) Show tuples of students table only with the age values 17,19,21 (1)
15. A) date (1)
16. D) upper (1)
17. D) MIME (1)
18. D) Repeater (1)
19. B) Subscriber Identity Module & General Packet Radio Service (1)
20. B) Both A and R are true and R is not the correct explanation for A (1)
21. A) Both A and R are true and R is the correct explanation for A (1)
Q No Section-B(7x2=14 Marks) Marks
22. a) Either definition of dictionary or example of dictionary 1 mark
b) (i) x=10 integer ½ mark (ii) x=10,20 tuple ½ mark
23. Relevant explanation about in operator 1 mark
Eg.
A=”welcome” 1 mark
if ‘e’ in A: example
print(“found a vowel”)
or any code that demonstrate the use of in operator
24. Consider T=(10,20,30) and L=[60,50,40] answer the question I and II
(I)
L.append(T) 1 mark
OR OR
As T is tuple deletion of an element is tuple is not possible due to 1 mark
its immutable nature.(any relevant correct reason)
(II)
L.insert(50,2) 1 mark
OR OR
del T 1 mark

Page:1/5
25.
B) m$p$ C) c$n$ For each correct answer ½ mark

Value of b minimum 1 and maximum 14


½ mark for each minimum and maximum
26. Any relevant code with following marks distribution
½ mark for correct function declaration
1 ½ mark for logic (2)

import pickle
def RECORDS():
with open(“district.dat”,”r”) as file:
name=input(“Enter name of district”)
try:
while(1):
a=pickle.load(file)
if a[0]==name:
print(a)
except EOFError:
break
or any relevant correct code
27. (I)
A) Use of Primary key or Any relevant correct answer 1 mark
OR
B) Use of Primary key for rno in students table and use of foreign key in marks
table for connecting the two tables or Any relevant correct answer 1mark

(II)
A) Alter table stationary modify(price number(10,2); 1 mark (2)
OR
B) Update table stationary set price=Null;
28. A) Any 2 correct difference between star and mesh topology - 2 marks
(partial marks can be awarded on partial correct answer). (2)
OR
B) (i) VoLTE Voice over Long Term Evolution 1 mark
(ii) GSM Global System for Mobile communication 1 mark
Q No. Section-C(3x3=9Marks) Marks
29. 1 ½ mark for logic, ½ mark for indentation ½ mark for correct file opening
command , ½ mark for print command
(3)
A) with open( “chars.txt”,”r”) as file:
d=file.read()
WL=d.split()
for w in WL:
if w[0]==’c’ or w[0]==’C’:
print(w)
or any other correct relevant code
OR
A) with open( “info.txt”,”r”) as file:
d=file.read()
for x in d:
if x.isdigit():
print(x)
or any other correct relevant code
Page:2/5
30. 1 ½ mark for logic, ½ mark for indentation ½ mark for variable declaration,
½ mark for print command
A)
Inventory=[]
def New_In(Inventory,newdata):
Inventory.append(newdata)

def Del_In(Inventory):
if len(Inventory)==0:
print(“Nothing to POP”) (3)
else:
Inventory.pop()

def Show_In(Inventory):
for p in range(len(Inventory)-1,-1,-1):
print(Inventory[p])

code=input(“Code”)
name=input(“Name”)
price=input(“Price)
L=[code,name,price]
New_In(Inverntory, L)
Del_In(Inventory)
Show_In(Inventory)

Or any other correct relevant code

OR
B)
N=””
Consonants=[]
def Push(x):
for p in x:
if p not in [‘a’,’A’,’e’,’E’, ‘i’,’I’,’o’,’O’, ‘u’,’U’] :
N=p
Consonants.append(N)
def Display():
for p in range(len(Inventory)-1,-1,-1):
print(Consonants[p])
Push(“Welcome to stacks”)
Display()

Or any other correct relevant code.


31. {'p': 1, 'r': 2, 'o': 1, 'g': 1, 'a': 1, 'm': 1, 's': 1} 3 marks
(partial marking may be given)
OR
erreer 3 marks (3)
(partial marking may be given)
Q No. Section-D( 4x4=16Marks) Marks
32. A) Write the queries for the following:
i) Select sum(qsold) from wsale where qtr=3;
ii) Select * from watches order by qty desc;
iii) Select sum(qty) from watches;
iv) Select wname, max(qsold) from watches , wsale where
Page:3/5
watches.id=wsale.wid and qtr=1;
iv) OR
B) Write the output
i) Sum(price) (4)
6290
ii)
Id Wname Price Type Qty
W01 High Time 1200 Common 75
W02 Life line 1600 Gents 150
W03 Wave 780 Common 240

iii) sum(qty) type


315 Common
610 Gents
250 Ladies

iv)
Wname Price Qtr
High Time 1200 1
Wave 780 3
33. ½ mark correct import statement
½ mark for opening file in correct mode
½ mark for making reader object
½ mark for print statement (4)
2 mark for logic
import csv
def READ():
with open(“candidates.csv”, “r”) as csv_file:
reading=csv.reader(csv_file)
for x in reading:
if x[2]>75 :
print(x)
def IDENTIFY():
count=0
with open(“candidates.csv”, “r”) as csv_file:
reading=csv.reader(csv_file)
for x in reading:
if x[2]<=75 :
count=count+1
print(“number of records less then 75% “ ,count)

or any other correct relevant code


34. (I)Select * from departments where date_join < ’01-01-2010’; 1
(II) Select d_name, d_incharge from departments where d_incharge like 1
‘%m%;’
(III) Update departments set grant=grant+1200 where d_no in (‘D99’, ‘D23’) 1
(IV) d_name grant
Primary Null
OR
sum(grant) 1
34000

Page:4/5
35. import mysql_connector 1 mark
connect=mysql.connector.connect(hostname=”localhost”, user=”root”, for
password=”root”, database=”db”) connect
cur=connect.cursor() ion
string
def Add_Vehicle():
Model = input(“Enter model”) ½
Make_year= input(“Enter year”) mark
Qty= input(“Enter qty”) for
Price =input(“Enter price”) variable
Q=”insert into Vehicle values(‘” + Model +”’,” + Make_year + “,” + Qty declarat
+”,” + Price +”)” ion
cur.execute(Q)
connect.commit()
½ mark
def Search_vehicle(): for
model=input(“Enter model to search”) correct
Q=”select * from Vehicle where Model=’” + model+ ’” function
cur.execute(Q) declarati
for x in cur: on
print(x)
2 marks
for logic
Q.No. SECTIONE(2X5=10 Marks) Marks
36. (I) Create table staff ( ID int(4) primary key, Name char(30), Designation (2)
char(10) , Birth_date date, Salary numeric(10,2));
(II) Select * from staff where designation= ‘Sales Executive’ ; (1)
(III) Update staff set designation =’Assistant’ where salary between 15000 and (1)
17000;
(IV) Select sum(*) from staff where name like “%j”; (1)
37. i) Development building with relevant and correct explanation 1
ii) Switch 1
iii) Any correct relevant layout with same placement of the building 1
iv) Correct & Relevant answer as per the layout given .by the student 1
v) A) Video conferencing
OR 1
B) LAN

Page:5/5
केन्द्रीय विद्यालय संगठन , कोलकाता संभाग
KENDRIYA VIDYALAYA SANGATHAN , KOLKATA REGION
प्री-बोर्ड परीक्षा / PRE BOARD EXAMINATION 2024-25
कक्षा / Class - XII अविकतम अं क / Maximum Marks : 70
विषय / Subject - Computer Science समय / Time : 3 Hrs.
__________________________________________________________________________

General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

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

1. State True or False:


(1)
The Python statement print(‘Alpha’+1) is example of TypeError Error

2. What id the output of following code snippet?

country = "GlobalNetwork" (1)


result = "-".join(country.split("o")).upper()
print(result)
(A) GL-BALNETW-RK
(B) GL-BA-LNET-W-RK
(C) GL-BA-LNET-W-RK
(D) GL-BA-LNETWORK

3. Identify the output of the following code snippet:

text = "The_quick_brown_fox"
index = text.find("quick")
(1)
result = text[:index].replace("_", "") + text[index:].upper()
print(result)

(A) Thequick_brown_fox
(B) TheQUICK_BROWN_FOX

Page: 1/11
(C) TheQUICKBROWNFOX
(D) TheQUICKBROWN_FOX
What will be the output of the following Python expression?
4.
x=5
y = 10
(1)
result = (x ** 2 + y) // x * y - x
print(result)

(A) 0
(B) -5
(C) 65
(D) 265
What will be the output of the following code snippet?
5.
(1)
text = "Python Programming"
print(text[1 : :3])

(A) Ph oai
(B) yoPgmn
(C) yhnPormig
(D) Pto rgamn
6. What will be the output of the following code?
tuple1 = (1, 2, 3)
tuple2 = tuple1 + (4,)
tuple1 += (5,)
print(tuple1, tuple2) (1)

(A) (1, 2, 3) (1, 2, 3, 4)


(B) (1, 2, 3, 5) (1, 2, 3)
(C) (1, 2, 3, 5) (1, 2, 3, 4)
(D) Error
7. Dictionary my_dict as defined below, identify type of error raised by statement
my_dict['grape']?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A) ValueError (1)
(B) TypeError
(C) KeyError
(D) ValueError
What does the list.pop(x) method do in Python?
8.
A. Removes the first element from the list.
(1)
B. Removes the element at index x from the list and returns it.
C. Adds a new element at index x in the list.
D. Replaces the element at index x with None.

Page: 2/11
In a relational database table with one primary key and three unique constraints
9.
defined on different columns (not primary), how many candidate keys can be
derived from this configuration?
(1)
(A) 1
(B) 3
(C) 4
(D) 2
10. Fill in the blanks to complete the following code snippet choosing the correct
option:

with open("sample.txt", "w+") as file:


(1)
file.write("Hello, World!") # Write a string to the file
position_after_write = file.______ # Get the position after writing
file.seek(0) # Move the pointer to the beginning
content = file.read(5) # Read the first 5 characters
print(content)

(A) tell
(B) seek
(C) read
(D) write
11. State whether the following statement is True or False:
In Python, if an exception is raised inside a try block and not handled, the
program will terminate without executing any remaining code in the finally (1)
block.

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


x=4
def reset():
global x
x=2
print(x, end='&')
def update(): (1)
x += 3
print(x, end='@')

update()
x=6
reset()
print(x, end='$')

(A) 7@2&6$
(B) 7@6&6$
(C) 7@2&2$
(D) Error

Page: 3/11
Which SQL command can modify the structure of an existing table, such as adding or
13. (1)
removing columns?

(A) ALTER TABLE


(B) UPDATE TABLE
(C) MODIFY TABLE
(D) CHANGE TABLE
14. What will be the output of the query?
SELECT * FROM orders WHERE order_date LIKE '2024-10-%';
(A) Details of all orders placed in October 2024
(B) Details of all orders placed on October 10th, 2024 (1)
(C) Details of all orders placed in the year 2024
(D) Details of all orders placed on any day in 2024
Which of the following statements about the CHAR and VARCHAR datatypes in SQL
15.
is false?
(A) CHAR is a fixed-length datatype, and it pads extra spaces to match the specified
length. (1)
(B) VARCHAR is a variable-length datatype and does not pad extra spaces.
(C) The maximum length of a VARCHAR column is always less than that of a CHAR
column.
(D) CHAR is generally used for storing data of a known, fixed length.
16. Which of the following aggregate functions can be employed to determine the
number of unique entries in a specific column, effectively ignoring duplicates?
(A) SUM() (1)
(B) COUNT()
(C) AVG()
(D) COUNT(DISTINCT column_name)
17. Which protocol is used to send e-mail over internet?
(A) FTP
(B) TCP
(C) SMTP
(D) SNMP
(1)
18. Which device is primarily used to amplify and regenerate signals in a network,
allowing data to travel longer distances?
(A) Switch
(B) Router (1)
(C) Repeater
(D) Bridge

19. Which communication technique establishes a dedicated communication path


between two devices for the entire duration of a transmission, ensuring a (1)
continuous and consistent connection?

Page: 4/11
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct
choice as:
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation for A
(C) A is True but R is False
(D) A is False but R is True

Assertion (A): Python functions can accept positional, keyword, and default
20.
parameters.

Reasoning (R): Default parameters allow function arguments to be assigned a (1)


default value if no argument is provided during the function call.
Assertion (A): A GROUP BY clause in SQL can be used without any aggregate
21.
functions.
Reasoning (R): The GROUP BY clause is used to group rows that have the same (1)
values in specified columns and must always be paired with
aggregate functions.
Q No Section-B ( 7 x 2=14 Marks) Marks
Consider the following Python code snippet:
22.
a = [1, 2, 3]
b=a (2)
a.append(4)
c = (5, 6, 7)
d = c + (8,)
a. Explain the mutability of a and c in the context of this code.
b. What will be the values of b and d after the code is executed?
Give examples for each of the following types of operators in Python:
23.
(I) Assignment Operators (2)
(II) Identity Operators
If L1 = [10, 20, 30, 40, 20, 10, ...] and L2 = [5, 15, 25, ...], then:
24.
(Answer using builtin functions only)

(I) A) Write a statement to count the occurrences of 20 in L1. (2)


OR
B) Write a statement to find the minimum value in L1.

(II) A) Write a statement to extend L1 with all elements from L2.


OR
B) Write a statement to get a new list that contains the unique elements
from L1.

Page: 5/11
25. Identify the correct output(s) of the following code. Also write the minimum and
the maximum possible values of the variable b.
import random
text = "Adventure"
b = random.randint(1, 5)
for i in range(0, b):
print(text[i], end='*') (2)

(A) A* (B) A*D*

(C) A*d*v* (D) A*d*v*e*n*t*u*

26. The code provided below is intended to reverse the order of elements in a given
list. However, there are syntax and logical errors in the code. Rewrite it after
removing all errors. Underline all the corrections made.

def reverse_list(lst)
if not lst:
return lst (2)
reversed_lst = lst[::-1]
return reversed_lst
print("Reversed list: " reverse_list[1,2,3,4] )

27. (I)
A) What constraint should be applied to a table column to ensure that all values in
that column must be unique and not NULL?
OR
B) What constraint should be applied to a table column to ensure that it can have
multiple NULL values but cannot have any duplicate non-NULL values? (2)
(II)
A) Write an SQL command to drop the unique constraint named unique_email
from a column named email in a table called Users.
OR
B) Write an SQL command to add a unique constraint to the email column of an
existing table named Users, ensuring that all email addresses are unique.

28. A) Explain one advantage and one disadvantage of mesh topology in computer
networks.
OR (2)
B) Expand the term DNS. What role does DNS play in the functioning of the
Internet?

Page: 6/11
Q No. Section-C ( 3 x 3 = 9 Marks) Marks

29. A) Write a Python function that extracts and displays all the words present in a
text file “Vocab.txt” that begins with a vowel.
OR (3)
B) Write a Python function that extracts and displays all the words containing a
hyphen ("-") from a text file "HyphenatedWords.txt", which has a three letter
word before hypen and four letter word after hypen. For example : “for-
them” is such a word.
(A) You have a stack named MovieStack that contains records of movies. Each
30.
movie record is represented as a list containing movie_title, director_name, and
release_year. Write the following user-defined functions in Python to perform the
specified operations on the stack MovieStack:

(I) push_movie(MovieStack, new_movie): This function takes the stack MovieStack


and a new movie record new_movie as arguments and pushes the new movie
record onto the stack.

(II) pop_movie(MovieStack): This function pops the topmost movie record from the
stack and returns it. If the stack is empty, the function should display "Stack is
empty".

(III) peek_movie(MovieStack): This function displays the topmost movie record (3)
from the stack without deleting it. If the stack is empty, the function should display
"None".

OR

(B) Write the definition of a user-defined function push_odd(M) which accepts a list
of integers in a parameter M and pushes all those integers which are odd from the
list M 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, the function should display "Stack is empty".

Write the function disp_odd() to display all elements 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 NUMBERS are: [7, 12, 9, 4, 15]

Then the stack OddNumbers should store: [7, 9, 15]

Page: 7/11
31. Predict the output of the following code:
data = [3, 5, 7, 2]
result = ""
for num in data:
for i in range(num):
result += str(i) + "*"
result = result[:-1]
print(result)
OR

Predict the output of the following code: (3)


numbers = [10, 15, 20]
for num in numbers:
for j in range(num // 5):
print(j, "+", end="")
print()

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

32. Consider the table ORDERS as given below

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
1005 David Tablet NULL 7000

Note: The table contains many more records than shown here.
(4)
A) Write the following queries:
(I) To display the total Quantity for each Product, excluding Products with total
Quantity less than 5.
(II) To display the ORDERS table sorted by total price in descending order.
(III) To display the distinct customer names from the ORDERS table.
(IV) To display the sum of the Price of all the orders for which the quantity is
NULL.
OR
B) Write the output:
(I) SELECT C_Name, SUM(Quantity) AS Total_Quantity FROM ORDERS GROUP BY
C_Name;
(II) SELECT * FROM ORDERS WHERE Product LIKE '%phone%';
(III) SELECT O_Id, C_Name, Product, Quantity, Price FROM ORDERS WHERE Price
BETWEEN 1500 AND 12000;
(IV) SELECT MAX(Price) FROM ORDERS;

Page: 8/11
A CSV file "HealthData.csv" contains the data of a health survey. Each record of the
33.
file contains the following data:

 Name of a country
 Life Expectancy (average number of years a person is expected to live)
 GDP per capita (Gross Domestic Product per person)
 Percentage of population with access to healthcare

For example, a sample record of the file may be: ['Wonderland', 82.5, 40000, 95].
(4)
Write the following Python functions to perform the specified operations on this
file:

(I) Read all the data from the file in the form of a list and display all those records
for which the life expectancy is greater than 75.

(II) Count the number of records in the file.

Alex has been tasked with managing the Student Database for a High School. He
34.
needs to access some information from the STUDENTS and SUBJECTS tables for a
performance evaluation. Help him extract the following information by writing the
desired SQL queries as mentioned below.
Table: STUDENTS
S_I FNa LNam Enrollment_Dat Mar
D me e e ks
201 John Doe 15-09-2020 85
202 Jane Smith 10-05-2019 90
203 Alex Johns 22-11-2021 75
(4)
on
204 Emily Davis 30-01-2022 60
205 Mich Brown 17-08-2018 95
ael

Table: SUBJECTS

Sub_ID S_ID SubName Credits


301 201 Mathematics 3
302 202 Science 4
303 203 History 2
304 204 Literature 3
305 205 Physics 4
306 201 Computer 3
Science
Write the following SQL queries:
(I) To display complete details (from both the tables) of those students whose
marks are greater than 70.
(II) To display the details of subjects whose credits are in the range of 2 to 4 (both
values included).
(III) To increase the credits of all subjects by 1 which have "Science" in their subject
names.
(IV) (A) To display names (FName and LName) of students enrolled in the
Page: 9/11
"Mathematics" subject.
(OR)
(B) To display the Cartesian Product of these two tables.

A table, named ELECTRONICS, in the PRODUCTDB database, has the following


35.
structure:

Field Type
productID int(11)
productName varchar(20)
price float
stockQty int(11)

Write the following Python function to perform the specified operation: (4)

AddAndDisplay(): To input details of a product and store it in the table


ELECTRONICS. The function should then retrieve and display all records from the
ELECTRONICS table where the price is greater than 150.
Assume the following for Python-Database connectivity:
Host: localhost
User: root
Password: Electro123

Q.No. SECTION E (2 X 5 = 10 Marks) Marks


Raj is a supervisor at a software development company. He needs to manage the
36.
records of various employees. For this, he wants the following information of each
employee to be stored:
Employee_ID – integer
Employee_Name – string
Position – string
Salary – float (5)
You, as a programmer of the company, have been assigned to do this job for Raj.
(I) Write a function to input the data of an employee and append it to a binary file.
(II) Write a function to update the data of employees whose salary is greater than
50000 and change their position to "Team Lead".
(III) Write a function to read the data from the binary file and display the data of all
those employees who are not "Team Lead".
Interstellar Logistics Ltd. is an international shipping company. They are planning to
37
establish a new logistics hub in Chennai, with the head office in Bangalore. The
Chennai hub will have four buildings - OPERATIONS, WAREHOUSE,
CUSTOMER_SUPPORT, and MAINTENANCE. As a network specialist, your task is to
propose the best networking solutions to address the challenges mentioned in
points (I) to (V), considering the distances between the various buildings and the
given requirements.

Building-to-Building Distances (in meters):

Page: 10/11
From To Distance
OPERATIONS WAREHOUSE 40 m
OPERATIONS CUSTOMER_SUPPORT 90 m
OPERATIONS MAINTENANCE 50 m
WAREHOUSE CUSTOMER_SUPPORT 60 m
WAREHOUSE MAINTENANCE 45 m
CUSTOMER_SUPPORT MAINTENANCE 55 m

Distance of Bangalore Head Office from Chennai Hub: 1300 km

Number of Computers in Each Building/Office:

Location Computers
OPERATIONS 40
WAREHOUSE 20
CUSTOMER_SUPPORT 25
MAINTENANCE 22
BANGALORE HEAD OFFICE 15
(I) Suggest the most suitable location for the server within the Chennai hub. Justify
your decision.
(II) Recommend the hardware device to connect all computers within each building (5)
efficiently.
(III) Draw a cable layout to interconnect the buildings at the Chennai hub efficiently.
Which type of cable would you recommend for the fastest and most reliable data
transfer?
(IV) Is there a need for a repeater in the proposed cable layout? Justify your
answer.
(V) A) Recommend the best option for live video communication between the
Operations Office in the Chennai hub and the Bangalore Head Office from the
following choices:
• a) Video Conferencing
• b) Email
• c) Telephony
• d) Instant Messaging
OR
(V) B) What type of network (PAN, LAN, MAN, or WAN) would be set up among the
computers within the Chennai hub?

Page: 11/11
MARKING SCHEME OF 1st PREBOARD ( KVS RO KOLKATA )
2024-25 ( COMPUTER SCIENCE)
Time allowed: 3 Hours Maximum Marks: 70

General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written ( No marks should be
provided if student does not write the correct choice )

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

1. State True or False:


(1)
The Python statement print(‘Alpha’+1) is example of TypeError Error

Ans : True
2. What id the output of following code snippet?

country = "GlobalNetwork" (1)


result = "-".join(country.split("o")).upper()
print(result)
(A) GL-BALNETW-RK
(B) GL-BA-LNET-W-RK
(C) GL-BA-LNET-W-RK
(D) GL-BA-LNETWORK

Ans : A ) GL-BALNETW-RK
3. Identify the output of the following code snippet:

text = "The_quick_brown_fox"
index = text.find("quick")
(1)
result = text[:index].replace("_", "") + text[index:].upper()
print(result)

(A) Thequick_brown_fox
(B) TheQUICK_BROWN_FOX
(C) TheQUICKBROWNFOX
(D) TheQUICKBROWN_FOX

Page: 1/21
Ans : (B) TheQUICK_BROWN_FOX

What will be the output of the following Python expression?


4.
x=5
y = 10
(1)
result = (x ** 2 + y) // x * y - x
print(result)

(A) 0
(B) -5
(C) 65
(D) 265

Ans : ( C ) 65
What will be the output of the following code snippet?
5.
(1)
text = "Python Programming"
print(text[1 : :3])

(A) Ph oai
(B) yoPgmn
(C) yhnPormig
(D) Pto rgamn
Ans : (B)

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


tuple1 = (1, 2, 3)
tuple2 = tuple1 + (4,)
tuple1 += (5,)
print(tuple1, tuple2) (1)

(A) (1, 2, 3) (1, 2, 3, 4)


(B) (1, 2, 3, 5) (1, 2, 3)
(C) (1, 2, 3, 5) (1, 2, 3, 4)
(D) Error

Ans : C )
7. Dictionary my_dict as defined below, identify type of error raised by statement
my_dict['grape']?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
ValueError (1)
(B) TypeError
(C) KeyError
(D) ValueError
Ans : (C) KeyError

Page: 2/21
What does the list.pop(x) method do in Python?
8.

A. Removes the first element from the list. (1)


B. Removes the element at index x from the list and returns it.
C. Adds a new element at index x in the list.
D. Replaces the element at index x with None.

Ans : B. Removes the element at index x from the list and returns it.

In a relational database table with one primary key and three unique
9. constraints defined on different columns (not primary), how many candidate
keys can be derived from this configuration?
(1)
(A) 1
(B) 3
(C) 4
(D) 2

Ans : C) 4
10. Fill in the blanks to complete the following code snippet choosing the
correct option:

with open("sample.txt", "w+") as file:


(1)
file.write("Hello, World!") # Write a string to the file
position_after_write = file.______ # Get the position after writing
file.seek(0) # Move the pointer to the beginning
content = file.read(5) # Read the first 5 characters
print(content)

(A) tell
(B) seek
(C) read
(D) write

Ans : (A) tell

11. State whether the following statement is True or False:


In Python, if an exception is raised inside a try block and not handled,
the program will terminate without executing any remaining code in the (1)
finally block.

Ans : False

Page: 3/21
12. What will be the output of the following code?
x=4
def reset():
global x
x=2
print(x, end='&')
def update(): (1)
x += 3
print(x, end='@')

update()
x=6
reset()
print(x, end='$')

(A) 7@2&6$
(B) 7@6&6$
(C) 7@2&2$
(D) Error
Ans : (D) Error : Unbound local variable x in function update()
Which SQL command can modify the structure of an existing table, such as
13. adding or removing columns? (1)

(A) ALTER TABLE


(B) UPDATE TABLE
(C) MODIFY TABLE
(D) CHANGE TABLE

Ans. (A) ALTER TABLE


14. What will be the output of the query?
SELECT * FROM orders WHERE order_date LIKE '2024-
10-%';
(A) Details of all orders placed in October 2024 (1)
(B) Details of all orders placed on October 10th, 2024
(C) Details of all orders placed in the year 2024
(D) Details of all orders placed on any day in 2024

Ans : (A) Details of all orders placed in October 2024


Which of the following statements about the CHAR and VARCHAR
15.
datatypes in SQL is false?
(A) CHAR is a fixed-length datatype, and it pads extra spaces to match the
specified length. (1)
(B) VARCHAR is a variable-length datatype and does not pad extra spaces.
(C) The maximum length of a VARCHAR column is always less than that of
a CHAR column.
(D) CHAR is generally used for storing data of a known, fixed length.
Ans : ( C )

Page: 4/21
16. Which of the following aggregate functions can be employed to determine
the number of unique entries in a specific column, effectively ignoring
duplicates?
(1)
(A) SUM()
(B) COUNT()
(C) AVG()
(D) COUNT(DISTINCT column_name)
Ans : (D) COUNT(DISTINCT column_name)

17. Which protocol is used to send e-mail over internet?


(A) FTP
(B) TCP
(C) SMTP
(D) SNMP (1)
Ans. (C) SMTP
18. Which device is primarily used to amplify and regenerate signals in a
network, allowing data to travel longer distances?
(A) Switch
(B) Router (1)
(C) Repeater
(D) Bridge
Ans : ( C) Repeater
19. Which communication technique establishes a dedicated communication
path between two devices for the entire duration of a transmission, (1)
ensuring a continuous and consistent connection?

Ans : Circuit Switching


Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark
the correct choice as:
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation
for A
(C) A is True but R is False
(D) A is False but R is True
Assertion (A): Python functions can accept positional, keyword, and default
20. parameters.

Reasoning (R): Default parameters allow function arguments to be assigned (1)


a default value if no argument is provided during the function call.

Ans : (B) Both A and R are true and R is not the correct explanantion
for A
Assertion (A): A GROUP BY clause in SQL can be used without any
21.
aggregate functions.
Reasoning (R): The GROUP BY clause is used to group rows that have the (1)
same values in specified columns and must always be paired
with aggregate functions.
Page: 5/21
Ans : ( C ) A is True , but R is False

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


Consider the following Python code snippet:
22.
a = [1, 2, 3]
b=a (2)
a.append(4)
c = (5, 6, 7)
d = c + (8,)
a. Explain the mutability of a and c in the context of this code.
b. What will be the values of b and d after the code is executed?

Ans : a) a is a mutable object (a list), meaning its contents can be


changed after it is created. This is demonstrated by the append()
method that adds an element to the list.
c is an immutable object (a tuple). Once created, its contents cannot
be changed. The operation c + (8,) does not modify c but creates a new
tuple.

b)The value of b will be [1, 2, 3, 4], as b references the same list as a,


which was modified by appending 4.
The value of d will be (5, 6, 7, 8), as the expression c + (8,) creates a
new tuple combining c and (8,).

( 1 marks + 1 Marks )

Give examples for each of the following types of operators in Python:


23.
(2)
(I) Assignment Operators

(II) Identity Operators

Ans :

(I) Assignment Operators: ( 1 Marks for Any one of them)

1. Example 1: = (Simple Assignment) Usage: x = 5 (assigns the


value 5 to x)
2. Example 2: += (Add and Assign) : Usage: x += 3 (equivalent to x
= x + 3)

(II) Identity Operators: ( 1 Marks for any one of them )

1. Example 1: is , Usage: x is y (checks if x and y refer to the


same object)
2. Example 2: is not : Usage: x is not y (checks if x and y do
not refer to the same object)

Page: 6/21
If L1 = [10, 20, 30, 40, 20, 10, ...] and L2 = [5, 15, 25, ...], then:
24.
(Answer using builtin functions only)

(I) A) Write a statement to count the occurrences of 20 in L1. (2)


OR
B) Write a statement to find the minimum value in L1.

(II) A) Write a statement to extend L1 with all elements from L2.


OR
B) Write a statement to get a new list that contains the unique elements
from L1.

Ans : I ( A) : count_20 = L1.count(20)


(B) : min_value = min(L1)

II (A) : L1.extend(L2)
(B) : unique_elements = list(set(L1))

( 1 marks for each correct answer , no marks if did not used


any built in function )
25. Identify the correct output(s) of the following code. Also write the minimum
and the maximum possible values of the variable b.
import random
text = "Adventure"
b = random.randint(1, 5)
for i in range(0, b):
print(text[i], end='*') (2)

(A) A* (B) A*D*

(C) A*d*v* (D) A*d*v*e*n*t*u*


Ans :  Minimum possible value of b: 1 ( 1/2 + 1/2 marks)
 Maximum possible value of b: 5

Possible Outputs : (A) and ( C ) ( 1/2 + 1/2 marks )

Page: 7/21
26. The code provided below is intended to reverse the order of elements in a
given list. However, there are syntax and logical errors in the code. Rewrite
it after removing all errors. Underline all the corrections made.

def reverse_list(lst)
if not lst:
return lst (2)
reversed_lst = lst[::-1]
return reversed_lst
print("Reversed list: " reverse_list[1,2,3,4] )

Ans : Corrections : ( 1/2 x 4 = 2)


iAdded a colon (:) after the function definition.
ii. Indented the if statement and the return statement for proper
structure.
iii. Put ( ) while calling the function reverse_list( )
iv. Added a comma (,) in the print statement for correct syntax.

27. (I)
A) What constraint should be applied to a table column to ensure that all
values in that column must be unique and not NULL?
OR
B) What constraint should be applied to a table column to ensure that it can
have multiple NULL values but cannot have any duplicate non-NULL (2)
values?
(II)
A) Write an SQL command to drop the unique constraint named
unique_email from a column named email in a table called Users.
OR
B) Write an SQL command to add a unique constraint to the email column
of an existing table named Users, ensuring that all email addresses are
unique.

Ans : (I)(A): Use the UNIQUE constraint along with the NOT NULL OR
PRIMARY KEY constraint.
OR
(B): Use the UNIQUE constraint alone, allowing for multiple NULL
values.
Example: column_name INT UNIQUE NULL

(II)(A):ALTER TABLE Users DROP CONSTRAINT unique_email;


OR
(B):ALTER TABLE Users ADD CONSTRAINT unique_email UNIQUE
(email);

( 1 mark each for correct part for each questions any correct example
as an answer is acceptable )

Page: 8/21
28. A) Explain one advantage and one disadvantage of mesh topology in
computer networks.
OR (2)
B) Expand the term DNS. What role does DNS play in the functioning of the
Internet?

Ans :
(A): Advantage of Mesh Topology: High redundancy; if one connection
fails, data can still be transmitted through other nodes.
Disadvantage of Mesh Topology: Complexity and high cost; requires
more cabling and configuration compared to simpler topologies.
OR

(B): · DNS stands for Domain Name System. It translates human-


readable domain names (like www.example.com) into IP addresses that
computers use to identify each other on the network.

( for part A 1/2 + 1/2 )


(for part B 1/2 for correct abbreviation and 1/2 for correct use)

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

29. A) Write a Python function that extracts and displays all the words present in a
text file “Vocab.txt” that begins with a vowel..
OR (3)
B) Write a Python function that extracts and displays all the words
containing a hyphen ("-") from a text file "HyphenatedWords.txt", which
has a three letter word before hypen and four letter word after hypen.
For example : “for-them” is such a word.
Ans : A)
def display_words_starting_with_vowel():
vowels = 'AEIOUaeiou'
with open('Vocab.txt', 'r') as file:
words = file.read().split()
# Loop through the words and check if the first letter is a vowel
for word in words:
if word[0] in vowels:
print(word)

B)
def display_specific_hyphenated_words():
with open('HyphenatedWords.txt', 'r') as file:
words = file.read().split()
# Loop through the words and check if they match the pattern
for word in words:
parts = word.split('-')
# Check if the word is hyphenated and matches the format "XXX-
XXXX"
if len(parts) == 2 and len(parts[0]) == 3 and len(parts[1]) == 4:
print(word)
Page: 9/21
1/2 mark for file opening + 1/2 mark for correct loop +1/2 mark for
correct use of split( ) + 1 mark for correct condition + 1/2 mark for
output

(A) You have a stack named MovieStack that contains records of movies.
30. Each movie record is represented as a list containing movie_title,
director_name, and release_year. Write the following user-defined functions
in Python to perform the specified operations on the stack MovieStack:

(I) push_movie(MovieStack, new_movie): This function takes the stack


MovieStack and a new movie record new_movie as arguments and pushes
the new movie record onto the stack.

(II) pop_movie(MovieStack): This function pops the topmost movie record


from the stack and returns it. If the stack is empty, the function should
display "Stack is empty".

(III) peek_movie(MovieStack): This function displays the topmost movie (3)


record from the stack without deleting it. If the stack is empty, the function
should display "None".

OR

(B) Write the definition of a user-defined function push_odd(M) which


accepts a list of integers in a parameter M and pushes all those integers
which are odd from the list M 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, the function should display "Stack is empty".

Write the function disp_odd() to display all elements 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 NUMBERS are: [7, 12, 9, 4, 15]

Then the stack OddNumbers should store: [7, 9, 15]

Ans : (A )
def push_movie(movie_stack, new_movie): # 1 mark

movie_stack.append(new_movie)

def pop_movie(movie_stack):

if not movie_stack: # 1 mark

return "Stack is empty"

Page: 10/21
return movie_stack.pop()

def peek_movie(movie_stack):

if not movie_stack: # 1 mark

return "None"

return movie_stack[-1]
OR

(B) def push_odd(M, odd_numbers):

for number in M: # 1mark

if number % 2 != 0:

odd_numbers.append(number)

def pop_odd(odd_numbers):

if not odd_numbers: # 1mark

return "Stack is empty"

return odd_numbers.pop()

def disp_odd(odd_numbers):

if not odd_numbers: # 1mark

return "None"

return odd_numbers

Page: 11/21
31. Predict the output of the following code:
data = [3, 5, 7, 2]
result = ""
for num in data:
for i in range(num):
result += str(i) + "*"
result = result[:-1]
print(result)
OR

Predict the output of the following code: (3)


numbers = [10, 15, 20]
for num in numbers:
for j in range(num // 5):
print(j, "+", end="")
print()

Ans : 0*1*2*0*1*2*3*4*0*1*2*3*4*5*6*0*1
( 1 mark for predicting correct output sequence of
numbers + 1 mark for predicting correct placement
of * + 1 mark for removing last * )

OR
0 +1 +
0 +1 +2 +
0 +1 +2 +3 +
( 1 MARK For putting output in three lines + 1 mark for
predicting correct sequence of numbers in each line (
1/2 for incorrect partially correct) + 1 mark for
correct placement of + )
Q No. Section-D ( 4 x 4 = 16 Marks) Marks

32. Consider the table ORDERS as given below

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
1005 David Tablet NULL 7000

Note: The table contains many more records than shown here. (4)
A) Write the following queries:
(I) To display the total Quantity for each Product, excluding Products with
total Quantity less than 5.
(II) To display the ORDERS table sorted by total price in descending order.
(III) To display the distinct customer names from the ORDERS table.
Page: 12/21
(IV) To display the sum of the Price of all the orders for which the quantity
is NULL.
OR
B) Write the output:
(I) SELECT C_Name, SUM(Quantity) AS Total_Quantity FROM ORDERS
GROUP BY C_Name;
(II) SELECT * FROM ORDERS WHERE Product LIKE '%phone%';
(III) SELECT O_Id, C_Name, Product, Quantity, Price FROM ORDERS
WHERE Price BETWEEN 1500 AND 12000;
(IV) SELECT MAX(Price) FROM ORDERS;

Ans : (A) ( 1 MARK EACH)


(I) SELECT Product, SUM(Quantity) AS Total_Quantity
FROM ORDERS
GROUP BY Product
HAVING SUM(Quantity) >= 5;

(II)SELECT O_Id, C_Name, Product, Quantity, Price


FROM ORDERS
ORDER BY Price DESC;

(III)SELECT DISTINCT C_Name


FROM ORDERS;

(IV)SELECT SUM(Price) AS Total_Price_Null_Quantity


FROM ORDERS
WHERE Quantity IS NULL;

OR
(B) ( 1 MARK EACH )
(I)
C_Name Total_Quantity
Jitendra 1
Mustafa 2
Dhwani 1
Alice 1
David NULL

(II)
O_Id C_Name Product Quantity Price
1002 Mustafa Smartphone 2 10000
1004 Alice Smartphone 1 9000

Page: 13/21
(III)

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
(IV)
MAX(Price)
12000

A CSV file "HealthData.csv" contains the data of a health survey. Each


33. record of the file contains the following data:

 Name of a country
 Life Expectancy (average number of years a person is expected to
live)
 GDP per capita (Gross Domestic Product per person)
 Percentage of population with access to healthcare
(4)
For example, a sample record of the file may be: ['Wonderland', 82.5, 40000,
95].

Write the following Python functions to perform the specified


operations on this file:

(I) Read all the data from the file in the form of a list and display all those
records for which the life expectancy is greater than 75.

(II) Count the number of records in the file.

Ans : (I)
import csv
def read_health_data(filename):
records = []
with open(filename, mode='r') as file:
reader = csv.reader(file)
next(reader) # Skip the header row if present
for row in reader:
country = row[0]
life_expectancy = float(row[1])
gdp_per_capita = float(row[2])
access_to_healthcare = float(row[3])
if life_expectancy > 75 :
records.append([country, life_expectancy, gdp_per_capita,
access_to_healthcare])
return records

Page: 14/21
(II)
def count_records( ):
records = read_health_data(“HealthData.csv”)
return len(records)
Alex has been tasked with managing the Student Database for a High
34. School. He needs to access some information from the STUDENTS and
SUBJECTS tables for a performance evaluation. Help him extract the
following information by writing the desired SQL queries as mentioned
below.
Table: STUDENTS
FNam Mark
S_ID LName Enrollment_Date
e s
201 John Doe 15-09-2020 85
202 Jane Smith 10-05-2019 90 (4)
Johnso
203 Alex 22-11-2021 75
n
204 Emily Davis 30-01-2022 60
Micha
205 Brown 17-08-2018 95
el

Table: SUBJECTS

Sub_ID S_ID SubName Credits


301 201 Mathematics 3
302 202 Science 4
303 203 History 2
304 204 Literature 3
305 205 Physics 4
Computer
306 201 3
Science
Write the following SQL queries:
(I) To display complete details (from both the tables) of those students
whose marks are greater than 70.
(II) To display the details of subjects whose credits are in the range of 2 to 4
(both values included).
(III) To increase the credits of all subjects by 1 which have "Science" in their
subject names.
(IV) (A) To display names (FName and LName) of students enrolled in the
"Mathematics" subject.
(OR)
(B) To display the Cartesian Product of these two tables.

Ans : ( I )
SELECT * FROM STUDENTS S
JOIN SUBJECTS Sub ON S.S_ID = Sub.S_ID
WHERE S.Marks > 70;

Page: 15/21
(II)
SELECT *
FROM SUBJECTS
WHERE Credits BETWEEN 2 AND 4;
(III)
UPDATE SUBJECTS
SET Credits = Credits + 1
WHERE SubName LIKE '%Science%';
(IV) A:
SELECT FName, LName
FROM STUDENTS S
JOIN SUBJECTS Sub ON S.S_ID = Sub.S_ID
WHERE Sub.SubName = 'Mathematics';
OR
B:
SELECT *
FROM STUDENTS, SUBJECTS;

A table, named ELECTRONICS, in the PRODUCTDB database, has the


35. following structure:

Field Type
productID int(11)
productName varchar(20)
price float
stockQty int(11)
(4)
Write the following Python function to perform the specified operation:

AddAndDisplay(): To input details of a product and store it in the table


ELECTRONICS. The function should then retrieve and display all records
from the ELECTRONICS table where the price is greater than 150.
Assume the following for Python-Database connectivity:
Host: localhost
User: root
Password: Electro123

Ans :
import mysql.connector
def AddAndDisplay():
# Connect to the database
conn = mysql.connector.connect(
host='localhost',
user='root',
password='Electro123',
database='PRODUCTDB'
)
cursor = conn.cursor()
productID = int(input("Enter Product ID: "))
Page: 16/21
productName = input("Enter Product Name: ")
price = float(input("Enter Price: "))
stockQty = int(input("Enter Stock Quantity: "))
cursor.execute("INSERT INTO ELECTRONICS
(productID, productName,
price, stockQty) VALUES (%s,
%s, %s, %s)", (productID,
productName, price, stockQty))
conn.commit()
cursor.execute("SELECT * FROM ELECTRONICS
WHERE price > 150")
records = cursor.fetchall()
print("\nRecords with price greater than 150:")
for record in records:
print(record)
cursor.close()
conn.close()|
(1 Mark for Declaration of correct Connection Object
+ 1 Mark for correct input + 1 marks for correctly
using execute( ) method + 1 marks for showing
output using loop )

Q.No. SECTION E (2 X 5 = 10 Marks) Marks


Raj is a supervisor at a software development company. He needs to
36. manage the records of various employees. For this, he wants the following
information of each employee to be stored:
Employee_ID – integer
Employee_Name – string
Position – string
Salary – float (5)
You, as a programmer of the company, have been assigned to do this job for
Raj.
(I) Write a function to input the data of an employee and append it to a binary
file.
(II) Write a function to update the data of employees whose salary is greater
than 50000 and change their position to "Team Lead".
(III) Write a function to read the data from the binary file and display the data
of all those employees who are not "Team Lead".

Ans : (I)
import pickle
def add_employee(filename):
employee_id = int(input("Enter Employee ID: "))
employee_name = input("Enter Employee Name: ")
position = input("Enter Position: ")
salary = float(input("Enter Salary: "))
new_employee = (employee_id, employee_name, position, salary)
with open(filename, 'ab') as file:
pickle.dump(new_employee, file)

(1/2 mark for input + 1 mark for correct use of dump( ) to add new emp
Page: 17/21
data)
(II)
def update_employee(filename):
employees = []
with open(filename, 'rb') as file:
try:
while True:
employees.append(pickle.load(file))
except EOFError:
pass
for i in range(len(employees)):
if employees[i][3] > 50000:
employees[i] = (employees[i][0], employees[i][1], "Team Lead",
employees[i][3])
with open(filename, 'wb') as file:
for employee in employees:
pickle.dump(employee, file)
(1 mark for correct use of load( ) method to retrieve data + 1/2 mark for
correct loop + 1/2 mark for correct condition within loop )

(III)
def display_non_team_leads(filename):
print("\nEmployees who are not Team Leads:")
with open(filename, 'rb') as file:
try:
while True:
employee = pickle.load(file)
if employee[2] != "Team Lead":
print(f"ID: {employee[0]}, Name: {employee[1]}, Position:
{employee[2]}, Salary: {employee[3]}")
except EOFError:
pass
( 1 mark for correct use of Try except block and 1/2 mark for correct
use of while loop )

Page: 18/21
Interstellar Logistics Ltd. is an international shipping company. They are
37. planning to establish a new logistics hub in Chennai, with the head office in
Bangalore. The Chennai hub will have four buildings - OPERATIONS,
WAREHOUSE, CUSTOMER_SUPPORT, and MAINTENANCE. As a
network specialist, your task is to propose the best networking solutions to
address the challenges mentioned in points (I) to (V), considering the
distances between the various buildings and the given requirements.

(5)
Building-to-Building Distances (in meters):

From To Distance
OPERATIONS WAREHOUSE 40 m
OPERATIONS CUSTOMER_SUPPORT 90 m
OPERATIONS MAINTENANCE 50 m
WAREHOUSE CUSTOMER_SUPPORT 60 m
WAREHOUSE MAINTENANCE 45 m
CUSTOMER_SUPPORT MAINTENANCE 55 m

Distance of Bangalore Head Office from Chennai Hub: 1300 km

Number of Computers in Each Building/Office:

Location Computers
OPERATIONS 40
WAREHOUSE 20
CUSTOMER_SUPPORT 25
MAINTENANCE 22
BANGALORE HEAD OFFICE 15

Page: 19/21
(I) Suggest the most suitable location for the server within the Chennai hub.
Justify your decision.

(II) Recommend the hardware device to connect all computers within each
building efficiently.

(III) Draw a cable layout to interconnect the buildings at the Chennai hub
efficiently. Which type of cable would you recommend for the fastest and
most reliable data transfer?

(IV) Is there a need for a repeater in the proposed cable layout? Justify your
answer.

(V) A) Recommend the best option for live video communication between the
Operations Office in the Chennai hub and the Bangalore Head Office from
the following choices:

 a) Video Conferencing
 b) Email
 c) Telephony
 d) Instant Messaging
OR

(V) B) What type of network (PAN, LAN, MAN, or WAN) would be set up
among the computers within the Chennai hub?

Ans :
(I) The server should be placed in the OPERATIONS building.
Justification:

 It has the largest number of computers (40), making it the most


central location in terms of the network load.
 The distances to other buildings are relatively short, ensuring
efficient data transfer. (1 Mark)

(II) A switch should be used within each building to connect all


computers. A switch is ideal for creating a local area network (LAN)
and ensures efficient communication between devices in a single
building. ( 1 Mark)

(III) The most efficient cable layout would involve connecting the
buildings as follows:

 OPERATIONS to WAREHOUSE (40 m)


 OPERATIONS to MAINTENANCE (50 m)
 OPERATIONS to CUSTOMER_SUPPORT (90 m)
 WAREHOUSE to MAINTENANCE (45 m)
 WAREHOUSE to CUSTOMER_SUPPORT (60 m)

Page: 20/21
CUSTOMER_SUPPORT

(90 m)

OPERATIONS

/ | \

(40 m) (50 m) (60 m)

/ | \

WAREHOUSE MAINTENANCE

Cable Recommendation: Fiber optic cable is recommended for high-


speed data transfer and reliable communication over distances. It
offers better bandwidth and lower signal degradation over long
distances than copper cables. ( 1/2 + 1/2 mark)

(III) There is no need for a repeater in this layout. The maximum distance
between any two buildings is 90 meters, which is well within the 100-meter
limit for Ethernet cable or fiber optics before requiring a repeater.

( 1 mark )

(IV) A) The best option for live communication between the Chennai
Operations Office and the Bangalore Head Office would be Video
Conferencing. This allows real-time face-to-face meetings and visual
communication across long distances, which is ideal for inter-office
collaboration.

OR

(V) B) The network type in the Chennai hub would be a LAN (Local Area
Network), as all computers are located within a confined geographical
area (the logistics hub) and are connected to each other for data
communication within the same campus.

(1 mark for any correct part solution )

Page: 21/21
KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION
CLASS: XII SESSION: 2024-25
PREBOARD
COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some questions.
Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

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


1 State True or False 1
In Python, a dictionary is an ordered collection of items(key:value pairs).
2 State the output of the following 1
L1=[1,2,3] i) [1,3,7]
L2=L1
ii) [2,3,7]
L1.append(7)
L2.insert(2,14) iii) [1,14,3,7]
L1.remove(1) iv) [2,14,3,7]
print(L1)
3 The following expression will evaluate to 1
print(2+(3%5)**1**2/5+2)
i) 5 ii) 4.6 iii) 5.8 iv) 4

4 What is the output of the expression? 1


food=’Chinese Continental’
print(food.split(‘C’))
i) ('', 'hinese ', 'ontinental')
ii) ['', 'hinese ', 'ontinental']
iii) ('hinese ', 'ontinental')
iv) ['hinese ', 'ontinental']
5 What will be output of the following code snippet? 1
Msg=’Wings of Fire!’
print (Msg[-9: :2])
6 What will be the output of the following: 1
T1=(10)
print(T1*10)
i) 10 ii) 100 iii)(10,10) iv(10,)
7 If farm is a t as defined below, then which of the following will cause an exception? 1
farm={‘goat’:5,’sheep’:35,’hen’:10,’pig’:7}
i) print(str(farm))
ii) print(farm[‘sheep’,’hen’])
iii) print(farm.get(‘goat))
iv) farm[‘pig’]=17
8 What does the replace(‘e’,’h’) method of string does? 1
i) Replaces the first occurrence of ‘e’ to ‘h’
ii) Replaces the first occurrence of ‘h’ to ‘e’
iii) Replace all occurrences of ‘e’ to ‘h’
iv) Replaces all occurrences of ‘h’ to ‘e’
9 If a table has 1 primary key and 3 candidate key, how many alternate keys will be in 1
the table.
i) 4 ii) 3 iii)2 iv)1
10 Write the missing statement to complete the following code 1
file = open("story.txt")
t1 = file.read(10)
_________________________#Move the file pointer to the beginning of the file
t2= file.read(50)
print(t1+t2)
file.close()
11 Which of the following keyword is used to pass the control to the except block in 1
Exceptional handling?
i) pass ii) finally iii) raise iv)throw
12 What will be the output of the following code: 1
sal = 5000
def inc_sal(per):
global sal i) 5000%6000$
inc = sal * (per / 100) ii) 5500.0%6000$
sal += inc iii) 5000.0$6000%
inc_sal(10) iv) 5500%5500$
print(sal,end='%')
sal=6000
print(sal,end='$')

13 State the sql command used to add a column to an existing table? 1


14 What will be the output of the following query? 1
Mysql> SELECT * FROM CUSTOMER WHERE CODE LIKE ‘_A%’
A) Customer details whose code’s middle letter is A
B) Customers name whose code’s middle letter is A
C) Customers details whose code’s second letter is A
D) Customers name whose code’s second letter is A
15 Sushma created a table named Person with name as char(20) and address as 1
varchar(40). She inserted a record with “Adithya Varman” and address as “Vaanam
Illam, Anna Nagar IV Street”. State how much bytes would have been saved for this
record.
i)(20,34) ii)(30,40) iii)(14,40) iv)14,34)
16 _____ gives the number of values present in an attribute of a relation. 1
a)count(distinct col) b)sum(col) c)count(col) d)sum(distinct col)
17 The protocol used identify the corresponding url from ip address is _____ 1
a)IP b)HTTP c)TCP d)FTP
18 The device used to convert analog signal to digital signal and vice versa is .. 1
a)Amplifier b)Router c)Modem d)Switch
19 In ___________ switching technique, data is divided into chunks of packets and 1
travels through different paths and finally reach the destination.
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct
choice as:
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation for A
(C) A is True but R is False
(D) A is False but R is True
20 Assertion (A) : A function can have multiple return statements 1
Reason (R) : Only one return gets executed Values are returned as a tuple.
21 Assertion (A) : DROP is a DDL command 1
Reason(R ) : It is used to remove all the content of a database object

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


22 Differentiate list and tuple with respect to mutability. Give suitable example to 2
illustrate the same .
23 Give two examples of each of the following 2
a) Assignment operators b) Logical operators
24 If L1 = [13,25,41,25,63,25,18,78] and L2= [58,56,25,74,56] 2
(i) A) Write a statement to remove fourth element from L1
Or
B) Write the statement to find maximum element in L2

(ii) (A) write a statement to insert L2 as the last element of L1


OR
(B) Write a statement to insert 15 as second element in L2
25 Identify the correct output(s) of the following code. Also write the minimum and the 2
maximum possible values of the variable Lot

import random
word='Inspiration'
Lot=2*random.randint(2,4)
for i in range(Lot,len(word),3):
print(word[i],end='$')

i) i$a$i$n$ ii) i$n$


iii) i$t$n$ iv) a$i$n$

26 Identify Primary Key and Candidate Key present if any in the below table name 2
Colleges. Justify
Streng
Cid Name Location Year AffiUniv PhoneNumber
th
University
St. Xavier's
1 Mumbai 1869 10000 of 022-12345678
College
Mumbai
Loyola University
2 Chennai 1925 5000 044-87654321
College of Madras
Hansraj Delhi
3 New Delhi 1948 4000 011-23456789
College University
Christ Christ
4 Bengaluru 1969 8000 080-98765432
University University
Lady Shri
Delhi
5 Ram New Delhi 1956 2500 011-34567890
University
College
27 (I) 2
(A) What constraint/s should be applied to the column in a table to make it as
alternate key?
OR
(B) What constraint should be applied on a column of a table so that it becomes
compulsory to insert the value
(II)
(A) Write an SQL command to assign F_id as primary key in the table named flight
OR
(B)Write an SQL command to remove the column remarks from the table name
customer.
28 List one advantage and disadvantage of star and bus topology 2
OR
Define DNS and state the use of Internet Protocol.

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


29 (A) Write a function that counts no of words beginning with a capital letter from 3
the text file RatanJi.txt
Example:
If you want to Walk Fast,
Walk Alone.
But - if u want to Walk Far,
Walk Together
Output:
No of words starting with capital letter : 10

OR
(B) Write a function that displays the line number along with no of words in it
from the file Quotes.txt
Example :
None can destroy iron, but its own rust can!
Likewise, none can destroy a person, but their own mindset can
The only way to win is not be afraid of losing.
Output:
Line Number No of words
Line 1: 9
Line 2: 11
Line 3: 11
30 (A) There is a stack named Uniform that contains records of uniforms Each record 3
is represented as a list containing uid, uame, ucolour, usize, uprice.
Write the following user-defined functions in python to perform the specified
operations on the stack Uniform :
(I) Push_Uniform(new_uniform):adds the new uniform record onto the stack
(II) Pop_Uniform(): pops the topmost record from the stack and returns it. If
the stack is already empty, the function should display “underflow”.
(III) Peep(): This function diplay the topmost element of the stack without
deleting it.if the stack is empty,the function should display ‘None’.
OR
(a) Write the definition of a user defined function push_words(N) which accept
list of words as parameter and pushes words starting with A into the stack
named InspireA
(b) Write the function pop_words(N) to pop topmost word from the stack and
return it. if the stack is empty, the function should display “Empty”.

31 Predict the output of the Python code given below: 3


Con1="SILENCE-HOPE-SUCCEss@25"
Con2=""
i=0
while i<len(Con1):
if Con1[i]>='0' and Con1[i]<='9':
Num=int(Con1[i])
Num-=1
Con2=Con2+str(Num)
elif Con1[i]>='A' and Con1[i]<='Z':
Con2=Con2+Con1[i+1]
else:
Con2=Con2+'^'
i+=1
print(Con2)

Q Section-D ( 4 x 4 = 16 Marks) Mar


No. ks
32 Consider the following table named Vehicle and state the query or state the output 4
Table:- Vehicle
VID LicensePlate VType Owner Contact State
Cost
1 MH12AB1234 Car Raj Kumar 65 9876543210 Maharastra
2 DL3CDE5678 Truck Arjith Singh 125 8765432109 New Delhi
3 KA04FG9012 Motor cycle Prem Sharma 9123456789 Karnataka
4 TN07GH3456 SUV Shyad Usman 65 9987654321 Tamil Nadu
5 KA01AB1234 Car Devid jhon 65 9876543210 Karnataka
6 TN02CD5678 Truck Anjali Iyer 125 8765432109 Tamil Nadu
7 AP03EF9012 Motor cycle Priya Reddy 9123456789 Andhra Pradesh
(A)
(i) To display number of different vehicle type from the table vehicle
(ii) To display number of records entered vehicle type wise whose minimum cost is above 80
(iii)To set the cost as 45 for those vehicles whose cost is not mentioned
(iv) To remove all motor cycle from vehicle
OR
(B)
(i) SELECT VTYPE,AVG(COST) FROM VEHICLE GROUP BY VTYPE;
(ii) SELECT OWNER ,VTYPE,CONTACT FROM VEHICLE WHERE OWNER LIKE
“P%”;
(iii)SELECT COUNT(*) FROM VEHICLE WHERE COST IS NULL;
(iv) SELECT MAX(COST) FROM VEHICLE;
33 A CSV file “Movie.csv” contains data of movie details. Each record of the file contains the 4
following data:
1.Movie id
2.Movie name
3.Genere
4.Language
5.Released date
For example, a sample record of the file may be:
["tt0050083",’ ‘12 Angry Men is’,’Thriller’.’Hindi’,’12/04/1957’]
Write the following functions to perform the specified operations on this file
(i) Read all the data from the file in the form of the list and display all those records for
which language is in Hindi.
(ii) Count the number of records in the file.
34 Salman has been entrusted with the management of Airlines Database. He needs to access some 4
information from Airports and Flights tables for a survey. Help him extract the following
information by writing the desired SQL queries as mentioned below.
Table - Airports
A_ID A_Name City IATACode
1 Indira Gandhi Intl Delhi DEL
2 Chhatrapati Shivaji Intl Mumbai BOM
3 Rajiv Gandhi Intl Hyderabad HYD
4 Kempegowda Intl Bengaluru BLR
5 Chennai Intl Chennai MAA
6 Netaji Subhas Chandra Bose Intl Kolkata CCU
Table - Flights
F_ID A_ID F_No Departure Arrival
1 1 6E 1234 DEL BOM
2 2 AI 5678 BOM DEL
3 3 SG 9101 BLR MAA
4 4 UK 1122 DEL CCU
5 1 AI 101 DEL BOM
6 2 6E 204 BOM HYD
7 1 AI 303 HYD DEL
8 3 SG 404 BLR MAA
i) To display airport name, city, flight id, flight number corresponding flights whose
departure is from delhi
ii) Display the flight details of those flights whose arrival is BOM, MAA or CCU
iii) To delete all flights whose flight number starts with 6E.
iv) (A) To display Cartesian Product of two tables
OR
(B) To display airport name,city and corresponding flight number
35 A table named Event in VRMALL database has the following structure: 4

Field Type
EventID int(9)
EventName varchar(25)
EventDate date
Description varchar(30)
Write the following Python function to perform the specified operations:
Input_Disp(): to input details of an event from the user and store into the table Event. The
function should then display all the records organised in the year 2024.

Assume the following values for Python Database Connectivity


Host-localhost, user-root, password-tiger

Q No. Section-E ( 2 x 5 = 10 Marks) Marks


36 Ms Joshika is the Lab Attendant of the school. She is asked to maintain the project 5
details of the project synopsis submitted by students for upcoming Board Exams.
The information required are:
-prj_id - integer
-prj_name-string
-members-integer
-duration-integer (no of months)
As a programmer of the school u have been asked to do this job for Joshika and define
the following functions.
i) Prj_input() - to input data of a project of student and append to the binary
file named Projects
ii) Prj_update() - to update the project details whose member are more than 3
duration as 3 months.
iii) Prj_solo() - to read the data from the binary file and display the data of all
project synopsis whose member is one.
37 P&O Nedllyod Container Line Limited has its headquarters at London and regional 5
office at Mumbai. At Mumbai office campus they planned to have four blocks for HR,
Accts, Logistics and Admin related work. Each block has number of computers
connected to a network for communication, data and resource sharing
As a network consultant, you have to suggest best network related solutions for the
issues/problems raised in (i) to (v), keeping in mind the given parameters

REGIONAL OFFICE MUMBAI

HR ADMIN
London Head
Head Head
Office
Accts Logistics

Distances between various blocks/locations:


Admin to HR 500m
Accts to Admin 100m
Accts to HR 300m
Logistics to Admin 200m
HR to logistics 450m
Accts to logistics 600m
Number of computers installed at various blocks are as follows:
Block No of computers
ADMIN 95
HR 70
Accts 45
Logistics 28
i) Suggest the most appropriate block to place the sever in Mumbai office.
Justify your answer.
ii) State the best wired medium to efficiently connect various blocks within
the Mumbai Office.
iii) Draw the ideal cable layout (block to block) for connecting these blocks
for wired connectivity.
iv) The company wants to conduct an online meeting with heads of regional
office and headquarter. Which protocol will be used for the effective voice
communication?
v) Suggest the best place to house the following
a) Repeater b) Switch
KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION
CLASS: XII SESSION: 2024-25
PREBOARD I MARKING SCHEME
COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70

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


1 False 1
(1 mark for correct answer)
2 iv) [2,14,3,7] 1
(1 mark for correct answer)
3 ii) 4.6 1
(1 mark for correct answer)
4 ii) ['', 'hinese ', 'ontinental'] 1
(1 mark for correct answer)
5 so ie 1
(1 mark for correct answer)
6 ii) 100 1
(1 mark for correct answer)
7 ii) print(farm[‘sheep’,’hen’]) 1
(1 mark for correct answer)
8 iii) Replace all occurrences of ‘e’ to ‘h’ 1
(1 mark for correct answer)
9 iii)2 1
(1 mark for correct answer)
10 file.seek(0) 1
(1 mark for correct answer)
11 iii) raise 1
(1 mark for correct answer)
12 ii) 5500.0%6000$ 1
(1 mark for correct answer)
13 ALTER (or ALTER TABLE) 1
(1 mark for correct answer)
14 iii) Customers details whose code’s second letter is A 1
(1 mark for correct answer)
15 i) (20,34) 1
(1 mark for correct answer)
16 c)count(col) 1
(1 mark for correct answer)
17 a)IP 1
(1 mark for correct answer)
18 c)Modem 1
(1 mark for correct answer)
19 Packet Switching 1
(1 mark for correct answer)
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 A) Both A and B are true and R is the correct explanation for A 1
(1 mark for correct answer)
21 D) A is False B is True 1
Q No. Section-B ( 7 x 2=14 Marks) Marks
22 Difference 1 mark 2
Example ½ mark each
23 a) Assignment Operators = += -= *= **= /= //= %= 2
b) Logical Operators not and or (any two from each)
(1/2 mark for each correct operator)
24 2
(i) A) L1.pop(4)
Or
B) a=max(L2) or print(max(L2)

(ii) (A) L1.append(L2)


OR
(B) L2.insert(1,15)
25 Identify the correct output(s) of the following code. Also write the minimum and the 2
maximum possible values of the variable Lot
Minimum value possible for Lot: 4
Maximum value possible for Lot: 8
Possible outputs are : i) and ii)
26 Identify Primary Key and Candidate Key present if any in the below table name 2
Colleges. Justify
Primary Key: Cid its unique
Candidate Key: Cid, Name, PhoneNumber as they are have unique values

27 (I) 2
(A) UNIQUE ,NOT NULL
OR
(B) NOT NULL (PRIMARY KEY CAN BE GIVEN MARK)
(II)
(A) ALTER TABLE flight ADD PRIMARY KEY(F_id);
OR
(B) ALTER TABLE CUSTOMER DROP REMARKS;
28 STAR Adv DisAdv ½ mark each 2
BUS Adv DisAdv ½ mark each
OR
DNS definition 1 mark, IP purpose 1 mark

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


29 a) Opening and closing file ½ mark 3
Read() ½ mark split() ½ mark
Loop ½ mark upper case checking ½ mark
Output display ½ mark
OR
b)
Opening and closing file ½ mark
Readlines() ½ mark
Loop ½ mark counting no of words ½ mark
Output display ½ mark
30 (1/2 for identifying even numbers) 3
(1/2 mark for correctly adding data to stack)
(1/2 mark for correctly poping data on the stack and 1/2 mark for checking
condition)
(1/2 mark for correctly displaying the data with none)
(1/2 mark for function call statements)
OR
(1 ½ mark for correct function body; No marks for any function header as it
was a part of the question)
31 ILENCE-^OPE-^UCCEs^^^14 correct o/p 3 mark 3

Q Section-D ( 4 x 4 = 16 Marks) Mar


No. ks
32 i) SELECT COUNT(DISTINCT VTYPE) FROM VEHICLE; 4
ii) SELECT VTYPE,COUNT(*) FROM VEHICLE GROUP BY VTYPE HAVING
MIN(COST)>80;
iii) UPDATE VEHICLE SET COST=45 WHERE COST IS NULL
iv) SELECT OWNER ,VTYPE,CONTACT FROM VEHICLE WHERE OWNER LIKE
“P%”;
OR
i)
+---------------------+-----------------+
| VTYPE | AVG(COST) |
+----------------------+-----------------+
| CAR | 65.0000 |
| truck | 125.0000 |
| Moter Cycle | NULL |
| SUV | 65.0000 |
| MOTOR CYCLE | NULL |
+----------------------+-----------------+
ii)
+--------------------+----------------------+------------------+
| OWNER | VTYPE | CONTACT |
+---------------------+----------------------+-----------------+
| Prem Sharma | Moter Cycle | 9987654321 |
| PRIYA REDDY | MOTOR CYCLE | 9123456789 |
+---------------------+----------------------+-----------------+
iii)
+---------------+
| COUNT(*) |
+--------------+
| 2|
+--------------+
iv)
+-----------------+
| MAX(COST) |
+-----------------+
| 125 |
+-----------------+

33 (½ mark for opening in the file in right mode) 4


(½ mark for correctly creating the reader object)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records)
OR
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correct use of counter)
(½ mark for correctly displaying the counter)
34 i) select airports.a_id,city,f_id,F_no from flights,airports where flights.f_id=airports.a_id 4
and departure="DEL";
ii) select * from flights where arrival="bom" or arrival="Maa" or arrival="ccu";
iii) delete from flights where F_no like "6E%";
iv) (A) select * from flights,airports;
OR
(b) select airports.a_id,city,flights.f_id from flights,airports where airports.a_id=flights.a_id;
35 4
#interface code
import mysql.connector as mn
def Input_Disp():
con=mc.connect(host="localhost",user="root",password="tiger",database="VRMALL")
cur=con.cursor()
print("Enter Event Details:")
eid=input("ID:")
ename=input("NAME:")
edate=input("DATE:")
des=input("Description:")
query="insert into Event values("+eid+",'"+ename+"','"+edate+"','"+des+"')"
cur.execute(query)
con.commit()
print("Record Inserted")

print("Details of Event organised in year 2024")


query="select * from Event where eventdate like '2024'"
cur.execute(query)
data=cur.fetchall()
print("ID NAME DATE DESCRIPTION")
for rec in data:
print(rec[0],rec[1],rec[2],rec[3],sep= " ")
con.close()
or any other relavant code
import ½ mark
Connectivity stmt ½ mark
Cursor creation query creation ,execute(), commit ½ mark each
Query creation, cursor execution ½ mark each
Fetching data and display loop ½ mark each
Q No Section-E ( 2 x 5 = 10 Marks) Mark
s
36 #binary file
def Prj_input():
file=open("Projects.dat","ab")
print("Enter Project Details:")
pid=int(input("ID:"))
pname=input("NAME:")
mem=int(input("MEMBERS:"))
dur=int(input("DURATION IN MONTHS:"))
rec=[pid,pname,mem,dur]
pickle.dump(rec,file)
file.close()
print("data inserted")
def Prj_update():
file=open("Projects.dat","rb+")
try:
while True:
pos=file.tell()
rec=pickle.load(file)
5
if rec[2]>3:
rec[3]=3
file.seek(pos)
pickle.dump(rec,file)
except EOFError:
pass
finally:
file.close()
print("Record modified")
def Prj_solo():
file=open("Projects.dat","rb")
try:
print("PROJECT DETAILS")
print("ID NAME MEMBERS DURATION")
while True:
import pickle ½ mark
rec=pickle.load(file)
input and ifclose ½ mark ,insert 1 mark
rec[2]==1:
try except block ½ mark loop ½ mark
print(rec[0],recc[1],rec[2],rec[3],sep=" ")
reading records , updation
file.seek(pos) ½ mark each
try catch block ½ mark
pickle.dump(rec,file)
loop except
½ markEOFError:
fetching and display ½ mark each
37 passi) Server to be placed in ADMIN block as it has maximum number of 5
file.close() computers(70 30 traffic rule)
ii) Coaxial cable/fiber optics
iii) Star topology or any other layout

LOGISTICS
ACCTS

ADMIN

HR

iv) VoIP Voice over internet Protocol


v)
a) Repeater –distance more then 90 m –all
..if fiber optical cable then no repeater
b) Switch- in each block as to connect computers

You might also like