QP-Computer Science-12-Practice Paper-1
QP-Computer Science-12-Practice Paper-1
QP-Computer Science-12-Practice Paper-1
(General Instructions)
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 ?
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.
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)
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.
Page 3 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX
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”.
“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
Based on the given table, write SQL queries for the following:
Page 4 of 8
CHENNAI SAHODAYA SCHOOLS COMPLEX
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
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
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.
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:
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
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