CS
CS
CS
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-B (7 x 2 =14M)
22 Rewrite the following code in python after removing all syntax errors. Underline each 2
correction done in the code:
Def Calc(a):
for i in (0,a):
if i%2 =0:
s=s+1
else if i%5= =0
m=m+2
else:
n=n+i
print(s,m,n) Calc(15)
23 Give two examples of each of the following: 2
(I) keywords (II) Mutable Datatypes
24 Write a suitable Python statement for each of the following tasks using built-in 2
functions/methods only:
a) To delete an element Mumbai:50 from Dictionary D.
b) To display words in a string S in the form of a list
OR
a)To insert an element 100 at the Second position, in the list L 1
b) To sort the elements of list L1 in ascending order.
25 What possible outputs(s) are expected to be displayed on screen at the time of execution of 2
the program from the following code? Also specify the maximum values that can be assigned
to each of the variables BEG and END.
import random
heights=[10,20,30,40,50]
beg=random.randint(0,2)
end=random.randint(2,4)
for x in range(beg,end):
print(heights [x],end=’@’)
(a) 30 @
(b) 10@20@30@40@50@
(c) 20@30
(d) 40@30@
26 Explain the Relational Database Management System terminologies- Degree and Attribute of 2
a relation. Give example to support your answer
OR
Explain the use of ‘Foreign Key’ in a Relational Database.Give an example to support your
answer.
27 Give difference between DROP and DELETE command in SQL 2
OR
Name the aggregate functions which work only with numeric data, and those that work with
any type of data.
28 Differentiate between Star Topology and Bus Topology. Write two points of difference. 2
OR
(i) Expand the following terms:
POP3 , URL
(ii) Give one difference between XML and HTML.
SECTION-C (3 x 3 = 9 M)
29 Write a user defined function in python that displays the number of lines starting with word 'It' 3
in the file Poetry.txt
OR
write a user defined function Transfer() that copies a text file "source.txt" onto “destination.txt"
barring the lines starting with # sign.
30 A list named as Record contains following format of for students: [student_name, class, city]. 3
Write the following user defined functions to perform given operations on the stack named
‘Record’:
(i) Push_record(Record) – To pass the list Record = [ ['Rahul', 12,'Delhi'],
[‘Kohli',11,'Mumbai'], ['Rohit',12,'Delhi'] ] and then Push an object containing Student name,
Class and City of student belongs to ‘Delhi’ to the stack Record and display and return the
contents of stack
(ii) Pop_record(Record) – To pass following Record [[“Rohit”,”12”,”Delhi”] [“Rahul”, 12,”Delhi”]
] and then to Pop all the objects from the stack and at last display “Stack Empty” when there
is no student record in the stack. Thus the output should be: -
[“Rohit”,”12”,”Delhi”]
[“Rahul”, 12,”Delhi”]
Stack Empty
OR
Mr. Rakesh has created a list of elements. Help him to write a program in python with
functions, PushElement(element) and PopElement(element) to add a new element and
delete an element from a List of element Description, considering them to act as push and
pop operations of the Stack data structure . Push the element into the stack only when the
element is divisible by 7.
For eg:if LIST=[1,9,12,48,56,63]
then stack content will be 63 56
31 Ridhi is working in a mobile shop and assigned a task to create a table MOBILES with record 3
of mobiles as Mobile code, Model, Company, Price and Date of Launch. After creation of the
table, she has entered data of 5 mobiles in the MOBILES table.
MOBILES
SECTION-D (4 x 4 = 16 M)
Table: Cloth
CCode CName
C01 Polyester
C02 Cotton
C03 Silk
C04 CottonPolyester
Write SQL queries for the following:
i. Display unique quantities of garments.
ii. Display sum of quantities for each CCODE whose numbers of records are more than 1.
iii. Display GNAME, CNAME, RATE whose garments name starts with S.
iv. Display average rate of garment whose rate ranges from 1200 to 2000 (both values
included)
35 A table named `EMPLOYEES` is created in a database named `COMPANY`. The table
contains multiple columns whose details are as shown below:
- `EmpID` (Employee ID) - integer
- `EmpName` (Employee Name) - string
- `Salary` (Employee Salary) - float
- `Department` (Employee Department) - string
Note the following to establish connectivity between Python and MySQL:
- Username: root
- Password: school123
- Host: localhost
Write the following Python function to perform the specified operation: ChecknDisplay():
To input details of an employee and store it in the table EMPLOYEES. The function should
then retrieve and display all records display details of all such employees from the table
EMPLOYEES whose salary is more than 50000.
SECTION-E (2 x 5 = 10 M)
a) Suggest the most suitable place (i.e., Block/Center) to install the server of this University
with a suitable reason.
b) Suggest an ideal layout for connecting these blocks/centers for a wired connectivity.
c) Which device will you suggest to be placed/installed in each of these blocks/centers to
efficiently connect all the computers within these blocks/centers?
d) Suggest the placement of a Repeater in the network with justification.
e) The university is planning to connect its admission office in Delhi, which is more than
1250km from university. Which type of network out of LAN, MAN, or WAN will be formed?
Justify your answer.
KENDRIYA VIDYALAYA SANGATHAN: BHUBANESWAR REGION
FIRST PRE-BOARD EXAMINATION 2024-25
CLASS XII - COMPUTER SCIENCE (083)
MARKING SCHEME
Time allowed: 3 Hours Maximum Marks: 70
Or
Foreign Key: Foreign Key is a non-key attribute derived from primary key of some other table.
A table can have 0 or more foreign keys.
(2 mark for correct answer)
27 DELETE is used for deleting records from a table. DROP is used to delete the entire schema of 2
any database object like table.
e.g. DELETE FROM STUDENT WHERE ROLL = 5;
DROP TABLE STUDENT;
(2 mark for correct answer)
Or
SUM() and AVG ()-which work only with numeric data
MAX(),MIN(),COUNT()-which work with numeric data and Non-Numeric Data
(2 mark for correct answer)
28 Star topology 2
In Star topology all the devices are connected to a central hub/node.
In Star topology if the central hub fails then the whole network fails.
Bus Topology
In Bus topology each device in the network is connected to a single cable which is known as
the backbone
In Bus topology the failure of the network cable will cause the whole network to fail.
(2 mark for correct answer)
Or
(i) POP3 -POST OFFICE PROTOCOL 3
URL -UNIFORM RESOURCE LOCATOR
(ii) Give one difference between XML and HTML.
HTML(Hyper Text Markup Language):
Hyper Text Markup Language (HTML) is a language which is used to design standardized Web
Pages, so that the Web contents can be read and under stood from any computer using web
browser.
Basic structure of every web page is designed using HTML. HTML uses tags to define the way
page content should be displayed by the web browser. Web pages are stored as .html or
.htm files.
Extensible Markup Language (XML): Extensible Markup Language is a markup language and
file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules
for encoding documents in a format that is both human-readable and machine-readable.
(1 mark for each correct answer)
SECTION-C (3 x 3 = 9 M)
29 def display_lines(): 3
fin = open('Poetry.txt','r')
count=0
lst=fin.readlines()
for line in lst:
l = line.strip().split()
if l[0]=='It':
count = count+1
print(count)
fin.close()
½ mark for opening file in correct mode
½ mark for readlines function
½ mark for loop
½ mark for strip and split function
½ mark for condition and increment
½ mark for display and close
Other working code is also allowed
Or
def Transfer (oldfile, newfile):
fin = open(oldfile, "r")
fout =open(newfile, "w")
while True:
text= fin.readline( )
if len(text) != 0:
if text[e] != "#":
fout.write(text)
fin.close()
fout.close()
Transfer("source.txt", "destination.txt")
(½ mark for correct function header)
(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
( ½ mark for checking condition)
(1 mark for correctly copying data from one file to another)
30 def Push_record(): # (1½ mark for correct push element) 3
for i in List:
if i[2]=="Delhi":
Record.append(i)
print(Record)
def Pop_record(): # (1½ mark for correct push element)
while True:
if len(Record)==0:
print('Empty Stack')
break
else:
print(Record.pop())
OR
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
def PushElement(S,N):
S.append(N)
def PopElement(S):
if S!=[ ]:
return S.pop()
else:
return None
ST=[]
for k in N:
if k%7==0:
PushElement(ST,k)
while True:
if ST!=[ ]:
print(PopElement(ST),end=" ")
else:
break
1- Mark for Push and 2-Mark for Pop functions.
31 (i)MCODE unique values (1 mark) 3
(ii) Degree = 4 (after removing one column) (1/2 mark)
Cardinality = 7 (after 2 more record added) (1/2 mark)
iii. mysql>alter table MOBILES add GST int; (1 mark)
OR
(i) mysql>update MOBILES set GST=(PRICE*0.18) (1 mark)
(ii) mysql>insert into MOBILES values(‘M06’,’iPHONE13’,’APPLE’,110000,’2022-03-01’);
(1 mark)
(iii) mysql>delete from MOBILES where MODEL=’NARZO50’; (1 mark)
SECTION-D (4 x 4 = 16 M)
32 I. TypeError exception raised when an operation or function is applied to an object of
inappropriate type,
ii.def get_numeric_input(prompt):
while True:
try:
value = float(input(prompt))
return value
except ValueError:
print("Error: Invalid input. Please Input a valid number.")
except:
print("Some Error Ocurred")
OR
i.The raise keyword is used to manually raise an exception like exceptions are raised by
Python itself. That means, as a programmer can force an exception to occur through raise
keyword. It can also pass a custom message to your exception handling module.
ii.a = int( input("Enter value for a :"))
b = int( input("Enter value for b :"))
try:
if b == 0:
raise ZeroDivisionError # raising exception using raise keyword
print(a/b)
except ZeroDivisionError:
print("Please enter non-zero value for b.")
(or any suitable code)
(3x 1 mark for each correct part – try, except, except)