You are on page 1of 8

CHENNAI SAHODAYA SCHOOLS COMPLEX

(General Instructions)

 Please check that this question paper contains 8 printed pages.


 Please check that this question paper contains 35questions.
 Please write down the serial number of the question before attempting it.
 Reading time of 15 minutes is given to read the question paper alone. No writing during this time.
 This question paper contains five sections, Section A to E.
 All questions are compulsory.
 Section A has 18 questions carrying 01 mark each.
 Section B has 07 Very Short Answer type questions carrying 02 marks each.
 Section C has 05 Short Answer type questions carrying 03 marks each.
 Section D has 02 Long Answer type questions carrying 04 marks each.
 Section E has 03 questions carrying 05 marks each. One internal choice is
given
 All programming questions are to be answered using Python Language only.

COMMON EXAMINATION-2024
Class-12
(COMPUTER SCIENCE 083)
Roll No.: Maximum Marks:70
Date: / / Time allowed: 3 hours
SECTION A
1 s="hello" 1
print(s.index('a'))
in the above code what will be the exception that is thrown ?

2 Which of the following is the valid variable name? 1


(a) f %2 (b) 20ans (c) ans (d) $ans

3 Given tp = (1,2,3,4,5,6). Which of the following two statements will give the same output? 1
1. print(tp[:-1]) 3.print(tp[0:5])
2. print(tp[0:4]) 4. print(tp[-4:])
(a) Statement 1 and 2 (b)Statement 2 and 4
(c ) Statement 1 and 4 (d)Statement 1 and 3
4 l=[0,True,False,1] 1
l.sort(reverse=1)
print(l)
5 Select the correct output of the code: 1
Str=“Computer”
Str=Str[-4:]
print(Str*2)
a. Uter b. uterretu c.uteruter d.None of these

6 Name the file attribute to check whether the file is closed or not ? 1
7 Fill in the blank 1
command is used to modify the attribute datatype or size in a table structure.

8 The following SQL is which type of join: 1


select customer.cust_id,order.cust_id,name, order_id from customer, order;

9 Fill in the blank:


constraint is used to restrict entries in other table’s non key attribute, whose values
are not existing in the primary key of reference table.

10 Identify the error in the following code rectify the same and predict the output? 1

print(round(sum((30.678,),[1,2,3,]),2))

Page 1 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX

11 A text file student.txt is stored in the storage device. Identify the correct option out of the 1
following options to open the file in read mode.
i. myfile = open('student.txt','rb')
ii. myfile = open('student.txt','w')
iii. myfile = open('student.txt','r')
iv. myfile = open('student.txt')
a) only (i) b) both (i) and (iv ) c) both (iii) and (iv) d) both (i) and (iii)
12 Fill in the blank: 1
A database is a special control structure that facilitates the row by row processing
of records in the resultset.
(a) fetch b)table c) cursor d)query
13 Fill in the Blank 1
is the networking device that connects computers in a network by using
packet switching to receive, and forward data to the destination.
14 Predict the output of the following code 1
l=['1','2','3']
m=str(l)
print(m)
print(m.find('2'))
15 The language used in application programs to request data from the DBMS is referred to as the 1
-------------------.
16 To create a connection between MYSQL database and Python application connect() function 1
is used. Which of the following are mandatory arguments required to connect any database
from Python.
a) Username, Password, Hostname, Database Name, Port
b) Username, Password, Hostname
c) Username, Password, Hostname, Database Name
d) Username, Password, Hostname, Port
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
a) Both A and R are true and R is the correct explanation for A
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
17 Assertion (A):- All the keyword arguments passed must match one of the arguments accepted by 1
the function
Reasoning (R):- You cannot change the order of appearance of the keyword.
18 Assertion (A): CSV file is a human readable text file where each line has a number of fields, 1
separated by commas or some other delimiter.
Reason (R): writerow() function can be used for writing into writer object.
SECTION B
Amit is trying to write a program to find the factorial of a number passed to the function and he 2
19 has written the following code but it’s not working and producing errors. Help Amit to correct this
and rewrite the corrected code. Also underline the corrections made.
Def fact(num):
factorial = 1
if num < 0:
print("Sorry, factorial does not exist for negative numbers")
else num == 0
print("The factorial of 0 is 1")
else:
for i in range(1,num + 1):
factorial = factorial*i
print("The factorial of",num,"is",factorial)

20 Write two points of difference between Switch and Router. 2


OR
Write two points of difference between star topology and bus topology

Page 2 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX

21 What possible outputs(s) are expected to be displayed on screen at the time of execution of the 2
program from the following code. Select which option/s is/are correct
import random
print(random.randint(15,25) , end=' ')
print((100) + random.randint(15,25) , end = ' ' )
print((100) -random.randint(15,25) , end = ' ' )
print((100) *random.randint(15,25) )
(i) 15 122 84 2500 (ii) 21 120 76 1500
(iii) 105 107 105 1800 (iv) 110 105 105 1900
22 Explain the use of ‘Primary Key’ in a Relational Database Management System. Give an example 2
to support your answer.
23 (a) Write the full forms of the following: 2
(i) POP3 (ii) TCP/IP iii) IMAP iv) EDGE
(b) What is the use of VoIP?
24 Predict the output of following code and also identify the whether id of both x and g are same or 2
not If same or not , say it is Deep copy or Shallow copy for both case as well
def fun(x):
x[0] = 5
return x
g = [10,11,12]
print(fun(g),g)
OR
i)test_list = [5, 6, 7]
test_tup = (9, 10)
res = tuple(list(test_tup) + test_list)
print(str(res))
ii) Predict the output?
Tup1 =((1,2),)*7
print(len(Tup1[3:8]))
25 Differentiate between char and varchar in SQL with appropriate examples. 2
OR
What are different types of SQL Aggregate Functions? Give two examples.
SECTION C
26 (a) Consider the following tables – Uniform and cost: 1
Uniform
UCODE UNAME UCOLOR
1 Shirt White
2 Pant Grey
3 Tie Blue
4 Shocks Blue
Cost
UCODE SIZE PRICE
1 L 580
1 M 600
2 L 800
2 M 810
2
(b)Write the output of the queries (i) to (iv) based on the table “Product”, showing details of
products being sold in a grocery shop.

Pcode Pname Uprice Manufacuer


P01 Washing Powder 120 Surf
P02 Toothpaste 54 Colgate
P03 Soap 25 Lux
P04 Toothpaste 65 Pepsodent
P05 Soap 38 Dove
P06 Shampoo 245 Dove

Page 3 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX

i) SELECT PName, Average (UPrice) FROM Product GROUP BY Pname;


ii) SELECT DISTINCT Manufacturer FROM Product;
iii) SELECT COUNT (DISTINCT PName) FROM Product;
iv) SELECT PName, MAX(UPrice), MIN(UPrice) FROM Product GROUP BY PName;

27 Write a function countwords() in Python that counts the number of words containing digits in it 3
present in a text file “myfile.txt”.

Example: If the “myfile.txt” contents are as follows:


This is my 1st class on Computer Science. There are 100 years in a Century. Student1 is
present in the front of the line.

The output of the function should be: 3


OR
Write a function countwords() in Python, which should count the occurrences of word ‘me’ and
‘my’ in the text file ‘myfile.txt’.

Example: If the “myfile.txt” contents are as follows:

“I will have nothing more to do with you and you are no longer my friend, no longer my 'faithful
slave,' as you call yourself! Keep the third piece of wisdom for your own use, and let me have the
gold.”
The output of the function should be: No of words ‘my’ is 2
No. of Words ‘me’ is 1

28 Define a function SWAP(SCORES) to swap all those values in the list of SCORES, which are 3
alternate elements.
For example:
If the SCORES contain [200, 456, 300, 100, 234, 678]

The output should be displayed as 300 200 100 456 678 234

29 Consider the table Personal given below: 3


Table: Personal
P_ID Name Desig Salary Allowance
P01 Rohit Manager 89000 4800
P02 Kashish Clerk NULL 1600
P03 Mahesh Supervisor 48000 NULL
P04 Salil Clerk 31000 1900
P05 Ravina Supervisor NULL 2100

Based on the given table, write SQL queries for the following:

i) Increase the salary by 5% of personals whose allowance is


known.
ii) Display Name and Total Salary (sum of Salary and Allowance) of all
personals. The column heading ‘Total Salary’ should also be
displayed.
iii) Delete the record of personals who have salary greater than 25000

Page 4 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX

30 A list contains following record of a student: [Rno, Name, Dob, Class] 3


Write the following user defined functions to perform given operations
on the stack named ‘status’:
(i) Push_element() - To Push a record of student to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also, display
“Stack Empty” when there are no elements in the stack.

OR

Write a function in Python, Push(book) where, book is a dictionary containing the details of a
book in form of {bookno : price}.
The function should push the book in the stack whose price is greater than 300. Also display the
number of elements pushed into the stack.

For example:
If the dictionary contains the following data:

Dbook={"Python":350,"Hindi":200,"English":270,"Physics":600,
“Chemistry”:550} The stack should contain
Chemistry
Physics
Python

The output should be:


The count of elements in the stack is 3

SECTION D
31 a) Predict the output from the following table:
FOOD COMPANY
COMPANY_ID COMPANY_NAME
ITEM_ID ITEM_NAME COMPANY_ ID 15 Jack Hill
1 Chex Mix 16 16 Akas Foods
6 Cheez-It 15 17 Foodies
2 BN Biscuit 15 19 sip-n-Bite
4 Pot Rice 15
i) SELECT FOODS.ITEM_ID, FOOD.ITEM_NAME, COMPANY.COMPANY_ID,
COMPANY.COMPANY_NAME FROM FOODS, COMPANY 4
WHERE FOODS.COMPANY_ID=COMPANY.COMPANY_ID;
ii) SELECT * FROM Foods NATURAL JOIN Company

b) Given below are the tables for a database Events:

Table: Student
RollNo Name Class Event_Id
1101 Roshan XII XII_122010
1102 Mohan XI XI_111010
1103 Robin XII XII_123011
1104 Meena XII XII_122011
1105 Kanti XI XI_110101
Table: Event
EventCode EName Event_Date
E-1010 IT-quiz 12/01/2024
E-1011 GruopDebate 12/01/2024
E-1012 Programming 15/01/2024
E-1013 TechToday 16/01/2024
E-1014 DreamTech 16/01/2024
E-1015 IT-Presentaion 15/01/2024

Page 5 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX

Table: Event_Assigned
Event_Id EventCode
XII_122010 E E-1011
XI_111010 E E-1012
XII_123011 E E-1013
XII_122011 E E -1014
XI_110101 E E -1015

a) Find the degree and Cardinality of Student X Event_Assigned and also mention the
type of the SQL operation depicted by Student X Event_Assigned .
b) Identify the Primary keys and Candidate Keys of the table Student and Foreign Key of
the table Event_Assigned with proper justification

32 Vedansh is a Python programmer working in a school. For the Annual Sports Event, he has 4
created a csv file named Result.csv, to store the results of students in different sports events.
The structure of Result.csv is : [St_Id, St_Name, Game_Name, Result]
Where St_Id is Student ID (integer) ST_name is Student Name (string) Game_Name is name of
game in which student is participating(string) Result is result of the game whose value can be either
'Won', 'Lost' or 'Tie'
For efficiently maintaining data of the event,
Vedansh wants to write the following user defined functions
: Accept() – to accept a record from the user and add it to the file Result.csv.
The column headings should also be added on top of the csv file.
wonCount() – to count the number of students who have won any event
. As a Python expert, help him complete the task.

SECTION E
33 Eduminds University of India is starting its first campus in a small town Parampur of central India 5
with its center admission office in Delhi. The university has three major buildings comprising of 5
Admin Building, Academic Building and Research Building in the 5 km area campus.
As a network expert, you need to suggest the network plan as per (a) to (e) to the authorities
keeping in mind the distance and other given parameters.

Expected wire distances between various locations:


Research Building to Admin Building 90m
Research Lab to Academic Building 80m
Academic Building to Admin Building 15m
DelhiAdmissionOfficetoParampurcampus 1450km
Expected number of computers to installed at various locations in the university are as follows:
Research Building 20
Academic Building 150
Admin Building 35
Delhi Admission Office 5
a. Suggest the authorities, the cable layout amongst various blocks inside university campus
for connecting the buildings
b. Suggest the most suitable place (i.e. block) to house the server of this university with
a suitable reason
c. Suggest an efficient device from the following to be installed in each of the blocks
to connect all the computers
d. Suggest the placement of a Repeater (if any) in the network with justification.

Page 6 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX

e. Suggest the most suitable (very high speed) service to provide data connectivity
between Admission Building located in Delhi and the campus located in
parampur.

34 5
a) Predict the output of the following code:

def div5(n):
if n%5==0:
return n*5
else:
return n+5

def output(m=5):
for i in range(0,m):
print(div5(i),'@',end='',sep=',')
print('')
output(7)
output()
output(3)

b) The code given below inserts the following record in the table Employee:
Empno – integer
EName- String
Desig– String
Salary– integer
Note the following to establish connectivity between Python and MYSQL:

 Username is root Password is Password


 The table exists in a MYSQL database named Bank.
 The details (Empno, Ename, Design and Salary) are to be accepted from the user.

Write the following missing statements to complete the code:

Statement 1 – to form the cursor object


Statement 2 – to query string.
Statement 3- to execute insert query for employee table
Statement 4- to incorporate the changes done to the employee table

import mysql.connector
mydb=mysql.connector.connect(host='localhost',user='root',passwd='Password',database='bank')
mycursor= ___________________ # statement1
eno=int(input('enter Employee no'))
nm=input('enter Employee name')
d=input('enter Designation)
s=int(input(‘Enter salary’))
rtup=(eno,n,d,s)
rq=’’’insert into Employee (Empno, Ename, Design,Salary)
values ( )’’’#statement2
mycursor _________________ #statement 3
mydb.-----------#statement4
print("Data Added successfully")

Page 7 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX

35 a. i)What is the use of tell() function? 5


For which operation of binary file tell() is mostly used.

ii)Write the mode by which the file pointer can be moved in both direction.
Write the syntax of seek().

b. Write a program in Python that defines and calls the following user defined functions:

i) Add():
To add the record of a student to a binary file “record.dat”. Each record should be
with field elements [admno,sname,class]

ii) Count():
To count the number of students studying in class xii and also display those student
name starts with the letter ‘A’

OR

a. Give a difference between dump and load function also write the syntax of both the
functions.

b. Write a program in Python that defines and calls the following user defined functions:

i. Add():
To add the record of an animal to a binary file “animal.dat”. Each record
should be with field elements [animal name, animal type, animal food]

ii. Search():
To search and copy all the animal names who eat grass as their food to an
another file animal1.dat

END OF PAPER

Page 8 of 8

You might also like