WEST CHENNAI SAHODAYA CLUSTER SCHOOLS
EXAMINATION 2023-24
SUBJECT : COMPUTER SCIENCE - CODE : 083
Time allowed: 3 Hours Maximum Marks: 70
General Instructions:
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.
All programming questions are to be answered using Python Language only.
SECTION A
1. State True or False: 1
Assignment operator can be used in place of equality operator in test condition.
(True/False)
2. Which of the following commands will delete the table from MYSQL 1
database?
a) drop table b) delete table c) remove table d) truncate table
3. What will be the output of the following statement? 1
print(12%3**4//5+6)
a) 8 b) 6 c) 18 d) 7
4. Select the correct output of the code: 1
s="10,20,30,40"
t=tuple(list(s.split(',')))
for i in t[:3]:
if int(i) > 10:
t+=(int(i),)
print(t)
a) ('10', '20', '30', '40', 20, 30)
b) ('10', '20', '30', '40', 20)
('10', '20', '30', '40', 20, 30)
c) (10, 20, 30, 40, 20)
(10, 20, 30, 40, 20, 30)
d) ('10', '20', '30', '40', 20)
5. What will be the output for the following code: 1
list1=['abc',30,120,[6,7,8]]
list2=list1
list1[0]=list1[0][:2]+'stract'
print(list2)
Page 1
a) ['abc',30,120,[6,7,8]]
b) Gives error as 'str' object does not support item assignment
c) ['abstract', 30, 120, [6, 7, 8]]
d) ['stract', 30, 120, [6, 7, 8]]
6. Given two tables Student and Drama as follows: 1
Table Student:
RollNo Name
1 Rohan
2 Jaya
3 Teena
Table Drama:
DramaId Play
1 Hamlet
2 Sunshine
What will be the cardinality and the degree of Cartesian product of Student and
Drama?
a) 5, 6 b) 6, 4 c) 6, 5 d) 4, 6
7. Which of the following networks uses Bluetooth technology? 1
a) Wide Area Network
b) Virtual Private Network
c) Local Area Network
d) Personal Area Network
8. What will be the output of the following Python code? 1
T=(1,2,4,3)
print(T[1:-1]
a) (1, 2) b) (1, 2, 4) c) (2, 4) d) (2, 4, 3)
9. What will be the output for the following code: 1
d1 = {"john":40, "peter":45}
print(45 in d1)
a) False b) True c) Error d)peter
10. Choose the correct output for the following code: 1
import random
print(random.randrange(0,91,5))
a) 10 b) 18 c) 79 d) 95
11. What does TCP/IP stand for? 1
a) Telephone Control Protocol/Internet Protocol
b) Transmission Control Protocol/Internet Protocol
c) Transmission Control Protocol/International Protocol
d) Transfer Control Protocol/Internet Protocol
12. Find the missing statement for the following code which shows the output as 13: 1
Page 2
def f1():
_________ # missing statement
x+=1
x=12
f1()
print(x)
a) x=12
b) global x=12
c) global x
d) No need for a statement
13. The errors encountered when a user violates the syntax of a programming 1
language while writing a code are termed as ______________.
a) Compile time error
b) Logical error
c) Runtime error
d) Exception
14. Which of the following is not the advantage of database? 1
a) Sharing of data
b) Reduce data inconsistency
c) Increase data inconsistency
d) Data security
15. Which of the following allows you to connect and login to a remote 1
computer?
a) SMTP
b) HTTP
c) FTP
d) Telnet
16. Which of the following modes write data to a file even if the file does not 1
exist?
a) w+ b) r+ c) a+ d) both a and c
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):
In Python, strings, lists and tuples are called sequences. 1
Reasoning(R) :
Sequence is referred to as an ordered collection of values having similar or
Page 3
different data types.
18. Assertion(A):import test imports the module ‘test’ and creates a reference to 1
that module.
Reasoning (R) :After executing this statement, you can use test.name to refer to
the objects defined in module ‘test’.
Section B
19. i) Expand the following terms: 2
PPP and XML
ii) Give one difference between a web server and a web browser.
OR
i) What is web hosting?
ii) How is FTP different from HTTP?
20. The code given below accepts N_Terms as an argument and prints fibonacci 2
series until N_Terms. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.
Def Fibo(N_Terms):
a,b=-1,1
for i in N_Terms:
c=a+b
print c
a,b=b,c
N_Terms=5
Fibo()
21. Write a function DISPLAY(PRODUCTS) in Python, that takes the dictionary, 2
PRODUCTS as an argument and displays the product names of PRODUCTS
whose Quantity is more than 20.
For example, Consider the following dictionary
PRODUCTS={‘Kellogs Muesli’:25,’Kissan Jam Mixed Fruit’:20,’Amul
Cheese Slices’:35}
The output should be:
Kellogs Muesli
Amul Cheese Slices
OR
Write a function, DISPLAY(STRING), that takes a string as an argument and
returns the longest substring from the string. Also print the returned string. For
example, if the string is "My rhythms fly in time", it should print ‘rhythms’.
22. Predict the output of the following code: 2
s1='Hello World'
d={}
for i in range(len(s1)):
if s1.index(s1[i]) == i and not s1[i].isspace():
d[s1[i]]=s1.count(s1[i])
Page 4
print(d)
23. Write the Python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
(i) To add a list called lst2 to the existing list lst1.
(ii) To check if there is any element in a tuple t.
OR
A list named L contains some integers. Write the Python command to import
the required module and (by using appropriate method) to display the random
integer value in the range of minimum and maximum values from the list L.
24. Ajay wants to create a table with some constraints. Help him to write a SQL 2
query to create the ‘Sales’ table from the given data:
Table:Sales
ColumnName Data type Size Constraint
OrderId Integer Primary key
PName varchar 20 Not Null
Quantity Integer
Also ,write a command to insert the following record in the table:
OrderId – 1999
PName – Biscuits
Quantity - 500
OR
Kiran wants to write an SQL query to increase the size of the ‘name’ column in
‘student’ table to accommodate 30 characters. However, he commits an error in
the SQL syntax. Rewrite the SQL statement after removing the errors.
ALTER student TABLE INCREASE name varchar(30);
Also modify existing name field with new value, assuming there is only one
record in the table.
25. Predict the output of the following code: 2
def function(a,b=15,c=20):
a=a+15
b=b+10
c=c+5
print(a,b,c,end='#')
return c
x=20
y=10
z=function(x,y)
print(x,y,z,sep=',')
Page 5
SECTION C
26. Predict the output of the Python code given below: 3
def Change(Str):
Str2=''
for i in range(1,len(Str),2):
if i%2==0 and Str[i].isupper():
Str2+=Str[i-1]
elif Str[i].isdigit():
Str2+=Str[i]*2
elif Str[i].isspace():
Str2+='@'
else:
Str2+=Str[i]
print(Str2)
Text='GrAdE 12 exAM'
Change(Text)
27. Consider the table Details given below and write the output of the SQL queries 3
that follow.
Table :Details
Sno Name Date_of_joining
1001 Jack 2009-02-10
1002 Jill 2009-02-01
1003 Teresa 2008-12-31
1004 Ivan 2007-01-06
1005 Kristy 2007-01-01
i) select min(Date_of_joining), max(Date_of_joining) from Details;
ii) select * from details where name like "%y";
iii) select name from details where date_of_joining between '2008-01-01'
and ' 2009-12-31';
28. Write a program to display the words in a text file ‘school.txt’ which are less 3
than 5 characters and their second letter is a vowel.
Example :
If the contents of ‘school.txt’ is:
New column in the book of history
Inhale and exhale during exercise
The output should be :
New
book
Page 6
OR
Write a program to display the lines of a given text file ‘Trial.txt’ which has
less than 3 words in it.
Example: If the contents of ‘Trial.txt’ is:
Pick up speed and follow your feet
Move up
Keep up pace
The output should be :
Move up
29. Given a table Games with the following data: 3
GameNo GameName Points1 Points2
10 FootBall 20 25
11 LawnTennis 35 15
12 Cricket Null 45
Write SQL queries for the following:
i) Increase Points1 by 10 whose GameName is ‘FootBall’.
ii) Display GameName and total of Points1 and Points2 with a proper
heading “Total Points” of those records who are given points for
Points1.
iii) Delete those records which have a letter ‘i' in GameName from Games
table.
30 A list EmpList contains following record as list elements. 3
[EmpId, Empname, BasicPay]
Each of these records together form a nested list. Write the user defined
functions to perform the specified operations on the stack named Emp.
Push(EmpList)-It takes EmpList as an argument and pushes those employee
records from EmpList whose BasicPay is lesser than 50000.
Pop() - It pops the objects from the stack Empand displays them. Also, the
function should display “Stack Empty” when there are no elements in the stack.
For Example , if EmpList contains following data:
EmpList=[[101,’Ankita’,80000],[112,’GeetaPriya’,30000],[99,’Santosh’,42000]]
Then , the stack Emp should contain:
[112,’GeetaPriya’,30000]
[99,’Santosh’,42000]
The output should be:
[99,’Santosh’,42000]
Page 7
[112,’GeetaPriya’,30000]
Stack Empty
SECTION D
31 Consider the following DEPT and WORKER tables. Write SQL queries for (i) 4
to (iv)
Table : DEPT
DCODE DEPARTMENT CITY
D01 MEDIA DELHI
D02 MARKETING DELHI
D03 INFRASTRUCTURE MUMBAI
D05 FINANCE KOLKATA
D04 HUMAN RESOURCE MUMBAI
Table : WORKER
WNO NAME Date_Joined DOB GENDER DCODE
1001 GEORGE 2013-09-02 1991-09-01 MALE D01
1002 SEN 2012-12-11 1990-12-15 FEMALE D03
1003 JHA 2014-01-17 1984-10-19 MALE D04
1004 KRISH 2013-11-18 1987-07-03 MALE D05
i) To display name, department, city for all employees whose WNO(worker
number) is below 1003
ii) To display the CITY along with count of all workers in each CITY
containing more than one employee.
iii)To display WNO and Name of those workers who joined in the year 2013.
iv)To display WNO,CITY and department of FEMALE workers.
32. A school librarian needs help to maintain books in the libraryin the form of csv 4
file called books.csv. Each book is stored as a list called Book with the fields -
[BookId(int), BookName(String),Author(String),Copies(int)]. The following
functions need to be implemented.
Create() – To input N Book details and write them in Books.csv.
Display(Author) – To input Author from the user and read the Book details
from the file and display only those records whose Author is same as the one
input by the user and Copies more than 5.As a Python expert, help the librarian
complete the task.
SECTION E
Page 8
33. Sony has set up its Branch at Srinagar for its office and web-based activities. It 5
has four zones of buildings as shown in the diagram:
ZONE ZONE Z
X
ZONE ZONE
Y U
Branch-to-branch distance is:
Zone X to Zone Z 40 m
Zon Zone Z to Zone Y 60 m
Zone Y to Zone X 135 m
Zone Y to Zone U 70 m
Zone X to Zone U 165 m
Zone Z to Zone U 80 m
Number of Computers:
Zone X 50
Zo Zone Z 130
Zone Y 40
Zone U 15
a) Suggest the most suitable cable layout and Networking Topology of
connections between the zones.
b) Suggest the most suitable place (i.e., Zone) to house the Server of this
organization. Give a suitable reason with justification.
c) Suggest the placement of the following devices with justification:
(i) Repeater (ii) Hub/Switch
d) Which is the most economic type of cable for the selected topology?
e) Suggest a device/software to be installed in each branch to take care of data
security.
34. i) When a file is opened for output, what happens if the mentioned file 1
a) exists b) does not exist?
ii) Consider a file, STUDENT.DAT, containing records of the following 4
structure:
[Student_Id, Student_Name, Marks]
Write a function, PrintData(), that reads contents from the file STUDENT.DAT
and prints those records whose Marks is greater than 75 , Otherwise display
message,”No records whose Marks greater than 75”.
OR
i) What is serialization with respect to binary files?
ii) Consider a file, PRODUCT.DAT, containing records of the following
structure: [Product_Id, Product_Name, Price]
Write a function, CopyData(), that reads contents from the file
PRODUCT.DAT and copies those records whose Price is lesser than 250 to
Page 9
another file PRODUCT2.DAT.
35. i) What is the difference between DDL and DML commands with respect to 1
the tables in a database?
ii) Kala wants to write a program in Python to display those records whose 4
Place_type is ‘Hill Station’ from the table named PLACES in MYSQL
database, TRAVEL. The table structure is as follows:
Place_Name - String
Distance_from_chennai - integer
Place_type – String (contains ‘Heritage, ‘Beaches’ or ’Hill Station’)
Note the following to establish connectivity between Python and MySQL:
Username - root
Password - tiger
Host - localhost
OR
i) Differentiate between candidate key and alternate key.
ii) Kshitij wants to write a program in Python to insert the following record
in the table named CUSTOMER with the following fields from database
CUST:
CustId(Customer Id )- integer
CustName(Customer Name) - string
Phone - int
Note the following to establish connectivity between Python and MySQL:
Username - root
Password - tiger
Host - localhost
The values of fields Custid, Custname, and Phone have to be accepted from the
user. Help Kshitij to write the program in Python.
**End of Paper**
Page 10