Computer SQP 2023-24
Computer SQP 2023-24
[1]
Options:
a. PYTHON-IS-Fun
b. PYTHON-is-Fun
c. Python-is-fun
d. PYTHON-Is -Fun
5 In MYSQL database, if a table, Alpha has degree 5 and cardinality 3, and 1
another table, Beta has degree 3 and cardinality 5, what will be the
degree and cardinality of the Cartesian product of Alpha and Beta?
a. 5,3 b. 8,15
c. 3,5 d. 15,8
6 Riya wants to transfer pictures from her mobile phone to her laptop. She 1
uses Bluetooth Technology to connect two devices. Which type of
network will be formed in this case?
a. PAN b. LAN
c. MAN d. WAN
7 Which of the following will delete key-value pair for key = “Red” from a 1
dictionary D1?
a. delete D1("Red")
b. del D1["Red"]
c. del.D1["Red"]
d. D1.del["Red"]
8 Consider the statements given below and then choose the correct output 1
from the given options:
pride="#G20 Presidency"
print(pride[-2:2:-2])
[2]
Options
a. ndsr
b. ceieP0
c. ceieP
d. yndsr
Options:
a.
RED*
WHITE*
BLACK*
[3]
RED*
b.
YELLOW*
WHITE*
BLACK*
RED*
c.
WHITE* WHITE*
YELLOW* YELLOW*
BLACK* BLACK*
RED* RED*
d.
YELLOW*
WHITE*WHITE*
BLACK* BLACK* BLACK*
RED* RED* RED* RED* RED*
[4]
Which of the following statements should be given in the blank for
#Missing Statement, if the output produced is 110?
Options:
a. global a
b. global b=100
c. global b
d. global a=100
SECTION B
19 (i) Expand the following terms: 1+1=2
POP3 , URL
(ii) Give one difference between XML and HTML.
20 The code given below accepts a number as an argument and returns the 2
reverse number. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.
[6]
LONDON
NEW YORK
OR
Write a function, lenWords(STRING), that takes a string as an
argument and returns a tuple containing length of each word of a string.
For example, if the string is "Come let us have some fun", the
tuple will have (4, 3, 2, 4, 4, 3)
22 Predict the output of the following code: 2
23 Write the Python statement for each of the following tasks using BUILT- 1+1=2
IN functions/methods only:
(i) To insert an element 200 at the third position, in the list L1.
(ii) To check whether a string named, message ends with a full
stop / period or not.
24 Ms. Shalini has just created a table named “Employee” containing 2
columns Ename, Department and Salary.
After creating the table, she realized that she has forgotten to add a
primary key column in the table. Help her in writing an SQL command to
add a primary key column EmpId of integer type to the table
Employee.
Thereafter, write the command to insert the following record in the table:
[7]
EmpId- 999
Ename- Shweta
Department: Production
Salary: 26900
25 Predict the output of the following code: 2
SECTION C
26 Predict the output of the Python code given below: 3
27 Consider the table CLUB given below and write the output of the SQL 1*3=3
queries that follow.
[8]
CID CNAME AGE GENDER SPORTS PAY DOAPP
5246 AMRITA 35 FEMALE CHESS 900 2006-
03-27
4687 SHYAM 37 MALE CRICKET 1300 2004-
04-15
1245 MEENA 23 FEMALE VOLLEYBALL 1000 2007-
06-18
1622 AMRIT 28 MALE KARATE 1000 2007-
09-05
1256 AMINA 36 FEMALE CHESS 1100 2003-
08-15
1720 MANJU 33 FEMALE KARATE 1250 2004-
04-10
2321 VIRAT 35 MALE CRICKET 1050 2005-
04-30
[9]
P_ID Name Desig Salary Allowance
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 Supervisors who have salary greater than
25000
30 A list, NList contains following record as list elements: 3
[City, Country, distance from Delhi]
Each of these records are nested together to form a nested list. Write the
following user defined functions in Python to perform the specified
operations on the stack named travel.
(i) Push_element(NList): It takes the nested list as an
argument and pushes a list object containing name of the city
and country, which are not in India and distance is less than
3500 km from Delhi.
(ii) Pop_element(): It pops the objects from the stack and displays
them. Also, the function should display “Stack Empty” when
there are no elements in the stack.
[10]
For example: If the nested list contains the following data:
NList=[["New York", "U.S.A.", 11734],
["Naypyidaw", "Myanmar", 3219],
["Dubai", "UAE", 2194],
["London", "England", 6693],
["Gangtok", "India", 1580],
["Columbo", "Sri Lanka", 3405]]
The stack should contain:
['Naypyidaw', 'Myanmar'],
['Dubai', 'UAE'],
['Columbo', 'Sri Lanka']
The output should be:
['Columbo', 'Sri Lanka']
['Dubai', 'UAE']
['Naypyidaw', 'Myanmar']
Stack Empty
SECTION D
31 Meticulous EduServe is an educational organization. It is planning to setup 1*5=5
its India campus at Chennai with its head office at Delhi. The Chennai
campus has 4 main buildings – ADMIN, ENGINEERING, BUSINESS and
MEDIA
[11]
ADMIN BUSINESS 90 m
ADMIN MEDIA 50 m
ENGINEERING BUSINESS 55 m
ENGINEERING MEDIA 50 m
BUSINESS MEDIA 45 m
DELHI HEAD CHENNAI 2175 km
OFFICE CAMPUS
a) Suggest and draw the cable layout to efficiently connect various blocks
of buildings within the CHENNAI campus for connecting the digital
devices.
b) Which network device will be used to connect computers in each block
to form a local area network?
c) Which block, in Chennai Campus should be made the server? Justify
your answer.
d) Which fast and very effective wireless transmission medium
should preferably be used to connect the head office at DELHI with the
campus in CHENNAI?
e) Suggest a device/software to be installed in the CHENNAI
Campus to take care of data security.
32 (i) Differentiate between r+ and w+ file modes in Python. 2+3=5
(ii) Consider a file, SPORT.DAT, containing records of the following
structure:
[12]
[SportName, TeamName, No_Players]
Write a function, copyData(), that reads contents from the file
SPORT.DAT and copies the records with Sport name as “Basket
Ball” to the file named BASKET.DAT. The function should return the
total number of records copied to the file BASKET.DAT.
OR
(Option for part (ii) only)
A Binary file, CINEMA.DAT has the following structure:
{MNO:[MNAME, MTYPE]}
Where
MNO – Movie Number
MNAME – Movie Name
MTYPE is Movie Type
Write a user defined function, findType(mtype), that accepts mtype
as parameter and displays all the records from the binary file
CINEMA.DAT, that have the value of Movie Type as mtype.
33 (i) Define the term Domain with respect to RDBMS. Give one 1+4=5
example to support your answer.
(ii) Kabir wants to write a program in Python to insert the following
record in the table named Student in MYSQL database,
SCHOOL:
rno(Roll number )- integer
name(Name) - string
DOB (Date of birth) – Date
Fee – float
Note the following to establish connectivity between Python and
MySQL:
Username - root
Password - tiger
[13]
Host - localhost
The values of fields rno, name, DOB and fee has to be accepted
from the user. Help Kabir to write the program in Python.
SECTION E
34 Consider the tables PRODUCT and BRAND given below: 1*4=4
Table: PRODUCT
PCode PName UPrice Rating BID
P01 Shampoo 120 6 M03
P02 Toothpaste 54 8 M02
P03 Soap 25 7 M03
P04 Toothpaste 65 4 M04
P05 Soap 38 5 M05
P06 Shampoo 245 6 M05
Table: BRAND
BID BName
M02 Dant Kanti
M03 Medimix
M04 Pepsodent
M05 Dove
[14]
35 Vedansh is a Python programmer working in a school. For the Annual 4
Sports Event, he has 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.
[15]
Marking Scheme
Class XII
SECTION A
1 False 1 mark for 1
correct
answer
[1]
ceieP0
WHITE*
BLACK*
RED*
[2]
17 Option d 1 mark for 1
A is false but R is True correct
answer
SECTION B
19 (i) ½ mark for 1+1=2
each correct
POP3 – Post Office Protocol 3 expansion
(ii)
21 ½ mark for 2
correct
function
header
½ mark for
correct loop
½ mark for
correct if
statement
½ mark for
displaying
OR
the output
½ mark for
correct
function
header
½ mark for
using split()
½ mark for
adding to
tuple
Note: Any other correct logic may be marked ½ mark for
return
statement
[4]
22 4*L ½ mark for 2
each correct
33*4
line of output
21*S
10*6
23 (i) L1.insert(2,200) 1 mark for 1+1=2
each correct
(ii) message.endswith('.') statement
As the primary key is added as the last field, the command for
1 mark for
inserting data will be: correct
INSERT
INSERT INTO Employee command
VALUES("Shweta","Production",26900,999);
OR
INSERT INTO
Employee(EmpId,Ename,Department,Salary)
VALUES(999,"Shweta","Production",26900);
25 10.0$20 1 mark for 2
each correct
10.0$2.0###
line of output
SECTION C
26 ND-*34 ½ mark for 3
each correct
character
27
[5]
1 mark for 1*3=3
each correct
(i)
output
COUNT(DISTINCT SPORTS)
4
(ii)
CNAME SPORTS
AMINA CHESS
(iii)
CNAME AGE PAY
AMRIT 28 1000
VIRAT 35 1050
28 1 mark for 3
correctly
opening and
closing files
½ mark for
correctly
reading data
1 mark for
correct loop
and if
statement
OR
½ mark for
displaying
data
[6]
1 mark for
correctly
opening and
closing the
files
½ mark for
correctly
reading data
1 mark for
correct loop
and if
statement
Note: Any other correct logic may be marked
½ mark for
displaying
the output.
(ii)
SELECT Name, Salary+Allowance AS
"Total Salary" FROM Personal;
(iii)
DELETE FROM Personal
WHERE Salary>25000
[7]
30 1 ½ marks for 3
each function
SECTION D
31 a) 1 mark for 1*5=5
each correct
Bus Topology
answer
ENGINEERING
Admin
BUSINESS
MEDIA
b) Switch
c) Admin block, as it has maximum number of computers.
d) Microwave
e) Firewall
32 (i) 1 mark for 2+3=5
each correct
r+ mode:
difference
Primary function is reading
( minimum
File pointer is at beginning of file two
differences
if the file does not exist, it results in an error
should be
w+ mode: given)
[8]
primary function is writing
if the file does not exist, it creates a new file.
If the file exists, previous data is overwritten
File pointer is at the beginning of file
(ii) ½ mark for
correctly
opening and
closing files
½ mark for
correct try
and except
block
½ mark for
correct loop
1 mark for
correctly
copying data
½ mark for
correct
return
statement
OR
(Only for option ii)
½ mark for
correctly
opening and
closing files
½ mark for
correct try
and except
block
½ mark for
correct loop
[9]
½ mark for
correct if
statement
Note: Any other correct logic may be marked
1 mark for
correctly
displaying
data
33 (i) Domain is a set of values from which an attribute can ½ mark for 1+4=5
correct
take value in each row. For example, roll no field can
definition
have only integer values and so its domain is a set of
½ mark for
integer values correct
example
1 mark for
correct
connect()
½ mark for
correctly
accepting the
input
1 ½ mark for
Note: Any other correct logic may be marked correctly
executing the
query
½ mark for
correctly
using
commit()
[10]
SECTION E
34 (i) 1 mark for 1*4=4
each correct
SELECT PName, BName FROM PRODUCT P,
query
BRAND B WHERE P.BID=B.BID;
(ii)
DESC PRODUCT;
(iii)
SELECT BName, AVG(Rating) FROM PRODUCT
P, BRAND B
WHERE P.BID=B.BID
GROUP BY BName
HAVING BName='Medimix' OR
BName='Dove';
(iv)
SELECT PName, UPrice, Rating
FROM PRODUCT
ORDER BY Rating DESC;
35 ½ mark for 4
accepting
data
correctly
½ mark for
opening and
closing file
½ mark for
writing
headings
½ mark for
writing row
[11]
½ mark for
opening and
closing file
½ mark for
reader object
½ mark for
print heading
½ mark for
printing data
[12]