0% found this document useful (0 votes)
121 views15 pages

Comp - SC - QP - (Set - 3)

Uploaded by

M A N J I L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views15 pages

Comp - SC - QP - (Set - 3)

Uploaded by

M A N J I L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

SET - 3

Candidates must write the Set No. on


Roll No. the title page of the answer book.

SAHODAYA PRE-BOARD EXAMINATION (2023-24)


 Please check that this question paper contains 15 printed pages.
 Set number given on the right hand side of the question paper should be written on the
title page of the answer book by the candidate.
 Check that this question paper contains 35 questions.
 Write down the Serial Number of the question in the left side of the margin before
attempting it.
 15 minutes time has been allotted to read this question paper. The question paper will be
distributed 15 minutes prior to the commencement of the examination. The students will
read the question paper only and will not write any answer on the answer script during
this period. Students should not write anything in the question paper.

CLASS- XII
SUB : COMPUTER SCIENCE (083)
Time: 3 hours Maximum Marks: 70
General Instructions :-
1. Please check this question paper contains 35 questions.
2. All questions are compulsory.
3. This question paper is divided into 5 sections- A, B, C, D and E.
4. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
5. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
6. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
7. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
8. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
9. All programming questions are to be answered using Python Language only.

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 1 of 15


SECTION-A

1. What is the output of the following code : 1


T=(200)
print(T*2)
(a) (200,200) (b) Error (c) 400 (d) [200,200]

2. Given a Tuple tup1= (10, 20, 30, 40, 50, 60, 70, 80, 90) 1
What will be the output of print (tup1 [3:7:2])?
(a) (40,50,60,70,80) (b) (40,50,60,70)
(c) [40,60] (d) (40,60)
3. Which of the following functions can not be used with a tuple? 1
(a) max( ) (b) sort (c) count (d) sorted
4. Select the correct output of the code: 1
str=“computer is fun”
p=len(str)
substr=“fun”
print(str.find(substr, 0, p))
(a) 13 (b) 12 (c) -1 (d) 0

5. When is the finally block executed? 1


(a) When there is no exception
(b) When there is an exception
(c) Only if some condition that has been specified is satisfied
(d) Always

6. What output will be produced by the following expression? 1


print ((2+3) *5/4+(4+6)//2)

(a) 11.0 (b) 11.25 (c) 11 (d) 11.5


7. Which of the following network devices amplify the incoming signal and forwards it in 1
LAN?
(a) Repeater (b) Gateway c) Router (d) Modem

8. State whether the following statement is True or False: 1


While writing a program all exceptions must be handled as the system cannot handle
Exceptions on it’s own.

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 2 of 15


9. Which out of the following Network devices is used to connect dissimilar networks 1
(different protocols)?
(a) Hub (b) Router (c) Bridge (d) Gateway

10. What will be the output of the following code? 1


import random
List=["Delhi","Mumbai","Chennai","Kolkata"]
for y in range(4):
x = random.randint(1,3)
print(List[x],end="#")

(a) Delhi#Mumbai#Chennai#Kolkata#
(b) Mumbai#Chennai#Kolkata#Mumbai#
(c) Mumbai# Mumbai #Mumbai # Delhi#
(d) Mumbai# Mumbai #Chennai # Mumbai
11. Write the output of the following code? 1

t = (100, 200 , 300 , [560, 780], 900)


t[3][-1] = [400 , 500]
print(t)
12. If cross product is done on two tables Table1 (2 tuples and 3 attributes) and Table2 1
(2 attributes and 3 tuples) then what will be the cardinality of the resultant table?
13. Select the correct output of the code: 1
quote= "Mission Chandrayan-3"
a=quote.split( "a" )
print(a[0],"++",a[3])
(a) Mission Ch++3
(b) Mission Ch++ ndrayan-3
(c) Mission Ch++ yan-3
(d) Mission Ch ++ n-3
14. Which of the following is a valid identifier in Python? 1

(a) False (b) var- (c) 15CBSE (d) _sahodaya1


15. Fill in the blank: 1
______ command is used to remove a column from a table in SQL.

(a) update (b) remove (c) alter (d) delete

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 3 of 15


16. Fil in the blank: 1
The _______________ statement when combined with table name returns the
structure of the table.

(a) DESC (b) UNIQUE (c) DISTINCT (d) NULL


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) : A function is a block of organized and reusable code that is used 1
to perform a single, related action.
Reason (R) : Function provides better modularity for your application and a
high degree of code reusability.
18. Assertion (A) : CSV (Comma Separated Values) is a file format for data storage 1
which looks like a text file.
Reason (R) : The information is organized with one record on each line and
each field is separated by comma.
SECTION-B
19. Given is a Python string declaration: 1+1=2

S="Digital India @@ 2023"


Write the output of:

print(S.replace('2','2+1'))

print(S[::-2]))

20. What will be the output of the following Python code? 2

def Findoutput():
L="Program"
X=""
L1=[ ]
count = 1
for i in L:
if i in ['a', 'e', 'i', 'o', 'u']:
X=X+i.swapcase()
else:
if count%2 != 0:
X=X+str(len(L[:count]))

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 4 of 15


else:
X=X+i
count=count+1
print(X)
Findoutput()

OR

What will be the output of the following Python code?

def Display(str):
m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2!=0:
m=m+str[i-1]
else:
m=m+"$"
print(m)
Display('Python3.10')
21. Rewrite the following code in Python after removing all syntax error(s). Underline each 2
correction done in the code.
value=30
for res in range(0, value)
If res%4==0:
print(res*4)
elseif res%5==0:
print(res+3)
else:
print(res+10)

22. Write the Python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
(a) Sort the elements of a tuple Tup in ascending order.
(b) Remove an element present at index 3 of a List Li.
OR

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 5 of 15


(a) Convert the input to the type of element as entered.
(b) Find the total of values in a list of integers.

23. Write the output of the following code snippet.


V=70 2
def display(N):
global V
V=35
if N%9==0:
V=V*N
else:
V=V/N
print(V, end="*")
display(15)
print(int(V))

24. Arjun has created a table SMS containing SRoll_no, Sname, SClass, SPhone_no and 2
percent. Later, he realizes that the field Sphone_no may have duplicate values. Help him
to write a SQL command to set the property of this field to deny duplicate values. Also
he needs help to write SQL command to see the structural detail of the table SMS.
OR
Ms. Trisha of a software company created a table Clients under a database Company.
After creating table, she now wants to add an additional column CPortfolio to store
textual information containing maximum of 100 characters and that can’t be blank. Also
she wants to view all the tables present under the database Company. Help her to write
the SQL commands to complete the above tasks.
25. (a) Expand the following terms: 2
IMAP, GSM
(b) Give one difference between LAN and WAN.
OR
(a) Define the term Telnet with respect to networks
(b) How is server different from client?

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 6 of 15


SECTION-C
26. (a) Write the outputs of the SQL queries (i) to (iv) based on the relations PRODUCT 2+1=3
and ORDER.

Table: PRODUCT
PID BRAND CITY_STORE PNAME PRICE
111 SONY DELHI TV 70000
222 NOKIA MUMBAI MOBILE 50000
333 ONIDA DELHI TV 30000
444 SONY MUMBAI MOBILE 35000
555 BLACKBERRY CHENNAI MOBILE 25000
666 DELL DELHI LAPTOP 20000

Table: ORDER
CID CNAME QTY PID
101 ROHAN SHARMA 20 222
102 DEEPAK KUMAR 10 666
103 MOHAN KUMAR 5 111
104 SAHIL BANSAL 3 333
105 NEHA SONI 7 444
106 SONAL AGARWAL 5 333
107 ARUN SINGH 15 666

(i) SELECT COUNT(*) , CITY_STORE FROM PRODUCT


GROUP BY CITY_STORE;
(ii) SELECT AVG(QTY) FROM ORDER WHERE CNAME LIKE “%R%”;
(iii) SELECT CNAME, BRAND FROM PRODUCT, ORDER
WHERE PRODUCT. PID = ORDER.PID AND PNAME= “MOBILE”;
(iv) SELECT CNAME, QTY FROM ORDER
WHERE QTY NOT BETWEEN 5 AND 20;
(b) Write a command in SQL to view all the Tables present in a database named
‘SCHOOL’;

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 7 of 15


27. Observe the following table and answer the parts (a) to (c): 3
Table: Store
ItemCode ItemName Qty Rate
10 Gel Pen Classic 1150 25
11 Sharpner 1500 10
12 Ball Pen 0.5 1600 12
13 Eraser 1600 5
15 Ball Pen 0.25 800 20

(a) Identify the most appropriate column, which can be considered as Primary key
of the Table Store.
(b) If three columns are added and one row is deleted from the table Store, then what
will be the new degree and cardinality of the above table?
(c) Write the SQL statement to delete the record of item having Rate less than 10.

28. A list contains following record of a ‘Computerʼ: [MACAddress, Brand, Price, RAM] 3

Write separate user defined functions to perform given operations on the stack named
‘Systemʼ:

(i) Push_element() - To Push an object containing Brand and Price of computers


whose RAM capacity is more than 4GB.

(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.

For example:

If the lists of computer details are:

[“M001”, “Lenovo”, 75000, 16]

[“M002”, “HP”, 72000, 8]

[“M003”,”Apple”, 110000, 16]

[“M004”, “Compaq”, 50000, 4]

The stack should contain

[“Lenovo”, 75000]

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 8 of 15


[”Apple”, 110000]

The output should be:

[“Lenovo”, 75000]

[”Apple”, 110000]

Stack Empty

OR
BCCI has created a dictionary containing top players and their runs as key value pairs of
cricket team. Write a program, with separate user defined functions to perform the
following operations:

● Push the keys (name of the players) of the dictionary into a stack, where the
corresponding value (runs) is greater than 49.

● Pop and display the content of the stack.

For example:

If the sample content of the dictionary is as follows:

SCORE={"KAPIL":40, "SACHIN":55, "SAURAV":80, "RAHUL":35, "YUVRAJ":110}

The output from the program should be:

YUVRAJ SAURAV SACHIN

29. (a) Refer the tables given below: 3


Table: Book
Code Sub
B1 English
B2 Physics
B3 History
B4 Science

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 9 of 15


Table B: Stock
SCode Pub Qty Code
P01 Gyan Chand 250 B1
P02 Pustak House 340 B2
P03 Arora 470 B3
P04 Sonka 245 B5

Predict the output for the following query:


SELECT * FROM Book NATURAL JOIN Stock ;

(b) Consider the following tables WORKER and PAYLEVEL and write the output
of the following SQL queries (i) to (iv) .
Table : WORKER
ECODE NAME DESIGN PLEVEL DOJ DOB
11 Radhe Shyam Supervisor P001 13-Sep-2004 23-Aug-1981
12 Chander Nath Operator P003 22-Feb-2010 12-Jul-1987
13 Fizza Operator P003 14-Jun-2004 14-Oct-1983
15 Ameen Ahmed Machanic P002 21-Aug-2006 13-Mar-1984
18 Sanya Clerk P002 19-Dec-2005 09-Jun-1987

Table: PAYLEVEL

PLEVEL PAY ALLOWANCE


P001 26000 12000
P002 22000 10000
P003 12000 600

(i) SELECT COUNT(PLEVEL), PLEVEL FROM WORKER


GROUP BY PLEVEL;
(ii) SELECT MAX (DOB), MIN(DOJ) FROM WORKER;
(iii) SELECT NAME, PAY FROM WORKER W, PAYLEVEL P
WHERE W. PLEVEL= P. PLEVEL AND W.ECODE <13;
(iv) SELECT PLEVEL, PAY+ALLOWANCE FROM PAYLEVEL
WHERE PLEVEL= ‘P003’;

30. Write a function RevText() to read a text file “ Story.txt “ and Print the word(s) starting 3
with ‘I’ in reverse order, rest of the words will be printed as it is.

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 10 of 15


Example: If content of the text file is: INDIA IS MY COUNTRY Output will be:
AIDNI SI MY COUNTRY
OR
Write a function countmy( )in Python to read the text file “Data.txt” and count the
number of times “my” or “My” occurs in the file.
For example if the file “Data.txt” contains:
“This is my website. I have displayed my preferences in the CHOICE section.”
The countmy( ) function should display the output as:
my occurs 2 times.

SECTION-D
31. Consider the following tables ITEM and CUSTOMER, write SQL commands for the 1*4=4
statements (a) to (d)

TABLE: ITEM

I_ID Item _Name Manufacturer Price


PC01 Personal Computer ABC 35000
LC05 Laptop ABC 55000
PC03 Personal Computer XYZ 32000
PC06 Personal Computer MNO 37000
LC03 Laptop PQR 57000

TABLE: CUSTOMER

C_ID Customer_Name City I_ID


01 N Roy Delhi LC03
06 H Singh Mumbai PC03
12 R Pandey Delhi PC06
15 C Sharma Delhi LC03
16 K Agrawal Bangalore PC01

(a) To display the details of those Customers whose city is Delhi in the descending
order of Customer_Name.
(b) To display the details of Items whose Price is not in the range of 35000 to 55000
(Both values included).

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 11 of 15


(c) To display the Customer_Name, City from table CUSTOMER and Item_Name
and Price from table ITEM, with their corresponding matching I_ID.
(d) To increase the Price of all items by 1000 in the table ITEM.

32. Given below is a CSV file named as ‘Student.csv’. Write the statement 1 to 4 4
to complete the program code.
import csv
fh = open( _____ , ______ , newline='') #Statement-1
stuwriter = csv. ___________ #Statement-2
data = [ ]
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class =input("Enter Class : ")
section =input("Enter Section : ")
rec = [ _________ ] #Statement-3
data.append(rec)
stuwriter.________ #Statement-4
fh.close()

(a) Identify the missing code for blank space in line marked as Statement-1?
(i) "Student.csv","r+"
(ii) "Student.csv","w"
(iii) "Student.csv","r"
(iv) "Student.csv","wb"
(b) Choose the function name (with argument) that should be used in the blank
space of line marked as Statement-2
(i) reader(fh)
(ii) reader(MyFile)
(iii) writer(fh)
(iv) writer(MyFile)

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 12 of 15


(c) Identify the suitable code for blank space in line marked as Statement-3.
(i) 'ROLL_NO', 'NAME', 'CLASS', 'SECTION'
(ii) ROLL_NO, NAME, CLASS, SECTION
(iii) 'roll_no','name','Class','section'
(iv) roll_no,name,Class,sectionc)
(d) Choose the function name that should be used in the blank space of line
marked as Statement-4 to create the desired CSV File?
(i) dump(data,fh)
(ii) load(fh)
(iii) writerows(data)
(iv) writerow(data)

SECTION-E

33. (a) Differentiate between cardinality and degree of a relation. 1+4=5


(b) Nirnaya is learning Python and facing difficulty in interfacing python with MySQL.
He wants to fetch all the records from a table School having the fields as ANo, SName,
NOS, State, Address and display them.
The following are the details to establish connectivity between Python and MySQL:
* User - student
* Password - quick
* Host - localhost
* Database- Mydb
Help Nirnaya to write a program and complete the desired task.
OR
(a) Define Primary key with example.
(b) Anisha has created a table named Teacher in MySQL database School:
* Teacher’s Id(TId) - integer
* Teacher’s name(TName) - string
* DOA(Date of Appointment) – Date
* Salary – float
Other details to establish connectivity between Python and MySQL are as follows:
* Username - root
* Password - tiger
* Host - localhost

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 13 of 15


Anisha wants to display the names of those teachers whose salary is less than
1,00,000. As a Python expert you need to help her to complete the task.
34. “Sikshya for All” is an educational NGO. It is setting up its new campus at Jaipur for its 1*5=5
web-based activities. The campus has four buildings as shown in the diagram below:

Main Resource

Training
Accounts

Centre to Centre distances between various buildings as per architectural drawings


(in meters) is as follows:
Main Building to Resource Building 120 m
Main Building to Training Building 40 m
Main Building to Accounts Building 135 m
Resource Building to Training Building 125 m
Resource Building to Accounts Building 45 m
Training Building to Accounts Building 45 m
Expected number of Computers in each building:
Main Building 15
Resource Building 25
Training Building 250
Accounts Building 10
Answer the following questions based on the above information
(a) Suggest a cable layout of connections between the buildings.
(b) Suggest the most suitable place (i.e. building) to house the server of this NGO.
Also, provide a suitable reason for your answer.
(c) Suggest the placement of the following devices with justification:
(i) Repeater (ii) Hub/Switch

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 14 of 15


(d) The NGO is planning to connect its international office situated in Delhi. Which
out of the following wired communication links, will you suggest for a very
high-speed connectivity?
(i) Telephone Analog line
(ii) Optic Fibre
(iii) Ethernet cable
(e) Which of the following should be used to protect unauthorized access in the
network.
(i) Telnet (ii) Firewall (iii) Router
35. (a) Write any two differences between Text file and Binary file. 2+3=5
(b)Write a function in python to search and display details, whose destination is
“Cochin” from binary file “Bus.dat”. Assuming the binary file is containing the
following elements in the list:
 Bus Number
 Bus Starting Point
 Bus Destination
OR
(a) Write any two differences between ‘rb’ and ‘ab’ modes w.r.t. Binary files.
(b) A binary file “salary.dat” has structure [employee id, employee name, salary]. Write
a function CountRec() in Python that would read contents of the file “salary.dat” and
display the details of those employee whose salary is above 20000.

SAHODAYA PREBOARD/ COMPUTER SCIENCE / XII / SET-3 Page 15 of 15

You might also like