0% found this document useful (0 votes)
86 views30 pages

CS Sample Paper 11-14

This document is a sample question paper for Computer Science, consisting of 35 questions divided into five sections (A to E) with varying marks assigned to each section. It includes a range of topics such as Python programming, SQL queries, and network-related concepts. The paper is designed for a maximum duration of 3 hours and a total of 70 marks.
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)
86 views30 pages

CS Sample Paper 11-14

This document is a sample question paper for Computer Science, consisting of 35 questions divided into five sections (A to E) with varying marks assigned to each section. It includes a range of topics such as Python programming, SQL queries, and network-related concepts. The paper is designed for a maximum duration of 3 hours and a total of 70 marks.
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

ProficiencyBui%9

O Stage Ill ExcellenceLev


(Without
Solution

SAMPLE
QUESTION PAPER 11
Computer Science
Instructions Time : 3 hrs Max.Marks
70

1. Please check trus question paper contains 35 questions.


2. The paper is divided into 5 Sections A B, C, D and E.
3. Section A consists of 18 questions (1 to 18). Each question carries 1 Mark.
4. Section B. consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C. consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

SectionA
1. State True or False
"Adictionary is immutable."
2. Which character is used to specify a multiline comment?

3. Which statement is a sequence of more than one


statements?
(a) Control statement (b) Compound statement
(c) Single statement (d) Sequence statement
4. Which statement is used for the condition
a loop is to be repeated 30 times?
(a) for j in range(0. 30) (b)for i in range(0. 30. +1):
(c) for i in range(l, 31, l): (d)Allofthese
5. Which of the following two Python codes
will give same output?

(ii)
(iii) pri :4]) (iv) print(tup1C-4:])
(b) ii, iv (c) ii, v
6. The method places the file pointer (d) i, iii
(a) read() to a specific position
(b) write() (c) writeline() in the file.
(d) seek()
Sample Paper 11
Isvcceed
o stage111
Excellence Levell 155
l. Constraintsare
(a) fields (b) tuples
(c)conditions [11
g which of the following category
of SQL
commands are used
(c) DDL
to create Schema objects? [11
9. The clause is used to
specify the
(a) end separator character
in a print statement [1]
(c) delim
10, A table is also called a (d)part
(a) field (b) relation
(c) attribute [1]
Fill in the blank : In the statement (d)key
f.write( ) , what can be the contents
(a) List (b) String of the blank?
(c) Dictionary [1]
(d) File
12. In the statement, SELECT * FROM
Emp GROUP BY
(a)Afield The blank can be [1]
(c) A Primary key field only (b) A record
(d) A value
13. State whether the following
statement is True or False. A
repeater is a transmission media. [1]
14. Find the output of the following code
num=123 [1]

> 3):
while(num
rem — num % 100
if (rem % 2 !
f + rem
s + rem
num / —100
print(f-s)
(a) 22 (b) 23 (c) 32 (d) Error
15. Amodem is connected in between a telephone line and a
[1]
16. It is a method of exchanging digital messages from sender to one or more recipients. [IJ
(a) Electronic messages (b) Electronic mail (c) Both (a) and (b) (d) None of these
DirectionsIn the question numbers 17 and 18, a statement ofAssertion (A) is followed by a statement ofReason
(R).Choosethe correct option.
17. Assertion (A) To read all lines from a text file a list type data structure is required [11

Reason (R) The readlines() function returns each line of a file as a list item.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is ü•ue but R is false.
(d) A is false but R is true.
and writing in Binary files.
18• Assertion (A) Python supports simultaneous reading
reading and writing.
Reason (R) The rb+ and wb+ modes allow both
explanation for A.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct
(c) A is u•ue but R is false.
(d) A is false but R is true.
Computer Science Class
12

156 ExcellenqeLev

Section B [1+1Q]
19. (i) Write a short note on protocol.
(ii) Write names of two protocols. small pans,
for dividing a file or message into very
or (i) Which part ofTCP/1P is responsible
topology in which there are bi-directional links between
(ii) Which is the name of the network
each possible node?
after removing the syntactical error(s), if any. Underlineeach
20. Rewrite the following program
correction
mul=3
value—IO
for i in range(1, 6, 1):
if (value %mul
print (value * multiply)

print (value + multiply)


conditions.
21. Construct logical expressions to represent the following
(a) Weight is greater than or equal to 115 but less than 125.
(b) Donation is in the range of 4000-5000or Guest is 1.
Or Find the output of the followingcode:
import random
x - [100, 75, 10, 125]
Go = random.rand int (0, 3)
For i in range (Go):
print (XCi], "$$,")
22. How is varchar a better data type than char data type? Explain.
Or Write the queries for the following questions using the table Item with the following fields.
(Item_Code, Item_Name,Quantity, Price)
(i) Display the price 500 of item having code as 106.
(ii) Display the names of all items with quantity greater than 50 and price less than 500.
23. Find the output of the following code:
first = 25
second = 30
for i in range(1, 3, 1):
print ("Output 1 first -3, "&", second+5)
print ("Output second+1, "&", first -5)
24. WhatareMembership operators? Write any two membership operators. Also, give anexample•
Or Predict the output.
(i) 'He1101235'.isdigit()
(ii) 'Hi Hello'.istitle()
(iii) 'This is nice. 'endswith("nice")
(iv)
25. Define sum() method with an example.
Sample Paper 11
*Stage 111
Excellence Levell 157
'SectionC
26. consider the tables SHOPPE and
ACCESSORIES given below
: [1x3=3]
TABLE : SHOPPE
Id
SName
SOOI Area
ABC Computeronics
S002 All Infotech Media
S003 Tech Shoppe
S004 Geeks Tecno Soft
S005 Nehru Place
Hitech Tech Store
Nehru Place
TABLE : ACCESSORIES
No Name Price
AOI Mother Board 12000 sol
A02 Hard Disk 5000 SOI
A03 Keyboard 500 S02
A04 Mouse 300 sol
A05 Mother Board 13000 S02
A06 Keyboard 400 soa
A07 LCD S04
T08 LCD 5500 S05
T09 Mouse 350 S05
TIO Hard Disk 4500 soa

Write SQL queries for statements (i) to (iii), with respect to the tables ACCESSORIESand
SHOPPE given above.
(i) To display Name and Price of all the Accessories in ascending order of their Price.
(ii) To display Id and SName of all Shoppe located in Nehru Place.
(iii)To display Minimum and Maximum Price of each Name of Accessories.
27. Write a definition of function that opens a file "output.txt" and find the frequency of the word
that is passed as parameter to the function in each line of the file. Now write each line number
and the frequency of the word in each line to a new file. [3]

Example if the file contains the following text


He is a good boy and he is also good by behaviour.
His result is also good.
Recently he is also selected for an award.
and the word passed IS IS
New file contents will be :
Line 1: 2
Line 2: 1
Line 3 : 1 Or
input a sentence and converts each word of the sentence
Write definition of a function that takes the converted words.
lowercase. Display
to uppercase, which are in
Example •
Input : HELLO how are YOU
output : HOW ARE
Computer Science
158 &stagelg ExcellenceLeve!

for (i) to (iii).


28. Study the followingtable and find solutions
TABLE: STORE LastBuy
Rate
ItemNo Item Scode Qty 31-JUN-09
60 8
2005 SharpenerClassic 23 01-FEB-IO
22 50 25
2003 Balls 24-FEB-IO
150 12
2002 Gel Pen Premium 21 11-MAR-09
250 20
2006 Gel Pen Classic 21 19-JAN-09
22 220 6
2001 Eraser Small 02-DEC-09
8
2004 Eraser Big 22 110
03-NOV-09
18
2009 Ball Pen 0.5 21 180

> "2009-12-01";
(i) SELECT SUM(Qty) FROMSTORE WHERELastBuy " %classic",
(ii) SELECT FROMSTORE WHEREITEM LIKE
(iii) SELECT MAX(LastBuy) FROMSTORE;
contains unique keys and values.
29. Write a program in Python to check whether a dictionary
Example :

Output :
Values are not Unique.
30. Write a user-defined function PushNames(n) that takes input a list of countries and pushesonly
those names into a stack,which are present in the list

• Section D
31. Consider the followingtable PRODUCTS:
Table : PRODUCTS
Code IName Price Company TCode
1001 DIGITAL PAD 121 120 11000 XENITA TOI
1006 LED SCREEN 40 70 38000 SANTORA T02
1004 CAR GPS SYSTEM 50 2150 GEOKNOW TOI
1003 DIGITAL CAMERA 160 DIGICLICK T02
1005 PEN DRIVE 32 GB 1200 STOREHOME T03

Which commands will be used for the following?


(a) Todecrease prices of Products by 30% whose Price is above 10000.
(b) To add record of a new Item.
(c) To display the name of item whose quantity is more than 500.
(d) To display all records.
32. Write a program in Python that defines and calls the following
user-defined functions:
ADD() To accept and add data of an employee to a CSV file
of a list with field elements as empid, name and mobile to 'record.csv'. Each record consists
and employee salary respectively. store employee id, employee
COUNTR()To count the number of records present in
the CSV file named 'record•CSV
Sample Paper 11
cc eed
OStage111
ExcellenceLevel 159
gsection E
33. Gargi Education Service Ltd. is an
campus at Nepal with its head educational
office at Mumbai.organisation. It is planning
The Nepal campus to set up its India
Youas a network expert have has 4 main buildings-
raised in (i) to (v), keeping to suggest the
in mind the best network related solutions for their problems
distance between the
buildings and other given
Nepal
Mumbai
Campus
Head Office
ENGINEERING

ADMIN

BUSINESS

MEDIA

Shortest distance between


various buildings
ADMIN To ENGINEERING
50 m
ADMINTo BUSINESS
80 m
ADMIN To MEDIA
45 m
ENGINEERING To BUSINESS
60 m
ENGINEERING To MEDIA
50 m
BUSINESS To MEDIA
45 m
Mumbai Head Office To Nepal Campus
2175 m
Number of computers installed at various buildings are as
follows
ADMIN 110
ENGINEERING 75
BUSINESS 40
MEDIA 10
Mumbai Head Office 20

(i) Suggest the most appropriate location of the server inside the Nepal Campus (out of 4
buildings), to get the best connectivity for maximum number of computers. Justify your
answer.
(ii) Suggest and draw the cable layout to efficiently connect various buildings within the Nepal
Campus for connecting the computers.
(iii) Which hardware device will you suggest to be procured by the company to be installed to
protect and control the Internet uses within the campus.
(iv) Which of the following will you suggest to establish the online face-to-face communication
between the people in the ADMIN office of Nepal Campus and Mumbai Head Office?
(a) Cable TV (b) E-mail
(c) Video Conferencing (d) Text Chat
(v) Expand the following
(b) PAN
(a) MAN
Computer Science Class
160 stage111
Excellence 12

34. (i) Explain Referential Integrity with respect to databases. 5]


(ii) Given the following table CollegeStuds
Table : CollegeStuds
Points Grade
SCODE Name Age Strcde
6 NULL
101 Amit 16 NULL
4
Arjun 13 3
102 1 NULL
103 Zaheer 14 2
2 NULL
104 Gagan 15 5
8 NULL
105 Kumar 13 6
students who are getting more than 8
Write the Python code to update grade to 'A' for all these as
points.
of the students.
Also,write the Python code to update grade to "B" for rest
Assume
Database : College
Host : localhost
Username : root
Password : college

(i) What is the role of key?


(ii) Consider the table : Tour as per following structure
TID Place StDate EndDate
Write the Python code to create the table and add a record to the table.
Database : TourDB
Host : localhost
Username : root
Password : tour@1407
35. (i) Write the use of dump() function for Binary files. [2+3=51

(ii) Write a program using two user defined functions as follows:


AddRecord() To add records of the following structure to a CSV file "Product.csv"and
display how many records were added.
ProductID Prodname Price
DisplayRecord(n) To display the records from the file "Product.csv" whose prices are above
n. Also, display count of such records.
Or
(i) Write the use of load() function of Binary files.
(ii) Write a Python program using two functions as follows :
AddStud() To add records ofthe following structure to a CSV file "Stud.csv" and displayhow
many records were added.
Stud1D Studname Class Percentage
SearchStud(n) To search and display the student record whose StudID is n from the CSVfile
"Stud.csv". Also, display count of all other records whose StudID is not n.

Answers
I. False
10. (b) 11. (b) 12. (a) QR
13. False 14.(b) 15. computer 16.(b) 17. (d) 18. (a)
SAMPLE
OUESTION PAPER 12
Computer Science

q A (_xvw•sts
c' c•nes
question. 2 Marks
quest"HIS V carnes Marks
t c•wsts c' s' cures 4 Muns
L ctnssts questions carnes S Marks
N •etc •niy

•%ction A

Py%iu.o bc

u' a '
S. L.AL.•uuaeti.E
R.n
4. Much (d) AND
NOT

u u• tik. lil
a
(b).nLd)
uwbb•'haauwi
7• Whichtransmission
Computer Science Class12
162 •staged' ExcellenceLeve(d
on the 2G and
oriented mobile data service
8. Which of the following technology is a packet
cellular communication? (d) GSM
(b) GPRS (c) WLL
(a) CDMA
snippet?
9. What is the output of the following code
def test(a):
for i in a:
print(i)
(d) None of these
(a) 3 45 3 7 4
5
3
7

the command will be


10. Todelete all the records from a table "Product",
(a) DEL FROMProduct; (b) DELETE FROMProduct:
(c) REMOVEALL FROMProduct; (d) DELETE ALL;

11. What will be the output of following code?


If Para.txt text is Life is beautiful.Live your life!!
file = open("para.txt""r")
a = file. read()
b = a. count('life')
print (b)
file. close()
The blank
12. In the statement, SELECT * FROM Product GROUP BY Type
can be
(b) ORDER (c) HAVING (d) DESCENDING
(a) WHERE

13. A network helps in


(a) Sending messages (b) Sharing resources (c) Cost reduction (d) All Ofthese

14. Evaluate the following expression and identify the correct answer.
16-(4 + 2) + *4
(a) 54 (b) 46 (c) 18 (d) 32

15. To group records , the grouping field must carry


(a) Common values (b) Distinct values (c) Numeric values only (d) Float values only

16. The file extension of binary file is


(a) .bt (b) .ban (c) .dat (d) .bin
Directions In the question numbers 17 and 18, a statement ofAssertion (A) is followed by a statement ofReaøn
(R).Choose the correct option.
17. Assertion (A) CSV files may be delimited by any character other than comma.
Reason (R) The writer object can be used to write records to a CSV file.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are ffue but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
Sample Paper 12
OStage111 Excellence Lev?!4
r5 163

Assertion (A) An user-defined


function can be
Reason(R) Python allows grouping used in multiple programs.
taggedto a folder that can be imported together of multiple
in other programs.
functions into a module, which are
(a) Both A and R are true and R is the
correct explanation
(b) Both A and R are true but R is not the of A.
true but R is false. correct explanationof
(c) A A.
(d) A is false but R is true.

'Section B
19. (i) Compare Star and Bus topologies.
(ii) It is a method of exchanging [1+1=2]
digital messages from sender
to one or more recipients.
(i) What can be possible the drawback of
E-mails?
(ii) What is used to translate domain name
into IP address?
20. What is the output of following code?
def test(): [2]
a=96
print(a)
test()
21. What will be the output of following Python code?
[2]

str1="6"
for i in list 1:
strl=strl+i
print(strl)
Or
How many times will the given loop iterate?

print ("Python")

22. Writethe syntax of ALTERcommand along with the clauses used with it. [21
Or
Charu has to create a database named MYEARTHin MySQL.
She now needs to create a table named CITYin the database to store the records of various cities
across the globe. The table CITYhas the following structure.
Table : CITY

Field Name Data Type Remarks


CITYCODE CHAR(5) Primary Key
CITYNAME CHAR(30)
SIZE INTEGER
AVGTEMP INTEGER
POPULATIONRATE INTEGER
POPULATION INTEGER

Help her to complete the task by suggesting appropriate SQL commands.


Computer Science Class12
164 Excellence Lev
111

which function is more suitable for print


23. A user wants random number between 1 and 200,
random number in Python?
24. What will be the output of below Python code?

tup=tup1*2
print(tup)
Or
What will be the output of the following Python code?
x-CI, 3, 6, [18]]
y=list(x)

print(y)
removing the syntactical errors (if any). Underline each
25. Rewrite the following code after
correction.
def chksum:
x = input ("Enter a number")
if x %2=0.
for i range (2 * x) :
print(i)
loop else:
print ("4k")

Section C
26. Consider the following tables STUDENTand STREAM.
Table : STUDENT
SCODE NAME AGE STRCDE POINTS GRADE
101 Amit 16 1 6 NULL
102 Arjun 13 3 4 NULL
103 Zaheer 14 2 1 NULL
105 Gagan 15 5 2 NULL
108 Kumar 13 6 8 NULL
109 Rajesh 17 5 8 NULL
110 Naveen 13 3 9 NULL
113 Ajay 16 2 3 NULL
115 Kapil 14 3 2 NULL
120 Gurdeep 15 2 6 NULL
Table : STREAM
STRCDE STRNAME
1 SCIENCE+COMP
2 SCIENCE+BIO
3 SCIENCE+ECO
4 COMMERCE+MATHS
5 COMMERCE+SOCIO
6 ARTS+MATHS
7 ARTS+SOCIO
Sample Paper 12 Excellence Leve
OStage111 165
ced

write SQL queries for statements (i) to (iii) , with respect to


the table Student and Stream .
(i) Update grades of students to "A"whose age is greater than 15.
(ii)Displaystudent name , age , points and corresponding stream name for students whose
name starts with "A"
(iii)Deleterecords of students who have "SCIENCE"in the stream name.
27.Writedefinition of a function writeText() that receives a list of lines as parameter and stores the
linesin a file "File.txt" , where frequency of the vowel 'a' is more than 10. [3]
Example :
:
List contents
aaaaa bbbbb ccc aaaaaa", "bbbbb cccc dddd aaaa","aaaa aaaa AAAAbb aaaa"]
file contents :
"aaaaaaa bbbbb ccc aaaaaa"
"aaaa aaaa AAAAbb aaaa"
OrWritedefinition of a function that takes input a dictionary as per following structure and
displaysonly those elements whose salaries are >56000.
Dictionarystructure:
{I:['John', 98000],2:['Smith',58000]
28. Studythe following table and find solutions for (i) to (iii)
Table : CLOTHES
GCODE DESCRIPTION PRICE FCODE READYDATE
10023 PENCIL SKIRT 1150 19-DEC-08
FORMAL SHIRT 1250 FOI 12-JAN-08
10001
INFORMAL SHIRT 1550 F02 06-JUN-08
10012
BABY TOP 750 F03 07-APR-07
10024
TULIP SKIRT 850 F02 31-MAR-07
10090
F03 06-JUN-08
10019 EVENING GOWN 850
1500 F02 20-0CT-08
10009 INFORMAL PANT
09.MAR-08
10007 FORMAL PANT 1350
850 F04 09-SEP-07
10020 FROCK
20-OCT-08
SLACKS 750
10089
"2007-DEC-31"•,
(i) SELECT FROMCLOTHES WHEREREADYDATE >
CLOTHES;
(ii) SELECT MAX(PRICE) , MIN(PRICE) FROM
CLOTHES WHEREFCODE
(iii) SELECT MAX(DESCRIPTION) FROM
as many hotel rooms as per following structure :
29. Writea program in Python to input details of storing room number as key and other details
Now, create a dictionary
Room No. , Type , Tariff.
as list of values.
Example :
Input
Room No. : 1
Type : Deluxe
Tariff : 1900
Room No. :2
'IYpe : AC
Tariff:2500
Dictionarycreated
Computer Science Class
166 Lev#
Excellence 12

a user-defined function
data of Kids . Write
30. Sunita has created a nested list : "KidsData" ,storing the details in the list and pushes them
The function checks
PushKids() with the list as parameter.
to the list , only if the kids are of "Nursery"
List Structure :
KidsData : [[KidID , Kidname , Age, Grade]]

Section D
[1 41
31. Consider the followingtable FOOD:
Table : FOOD
Brand Price
Did Dname
Coca-Cola 45
DOI Black Masala
Pepsi 55
Sweet Mango
Maaza 75
Instant Energy
Coca-Cola NULL
Roman Blue
Coca-Cola 85
Green Drink

Which command will be used to


(a) Remove the entire table with its records?
(b) To display all records?
(c) To find records who do not have a price?
(d) To add a new column remarks varchar(20)?
32. Write a program to read the content from a text file "status.txt",count and displaythe total
number of lines and blank spaces present in it.

Section E
33. Learn Togetheris an educationalNGO.It is setting up its new campus at Jabalpur forits
web-based activities. The campus has four compounds as shown in the diagram below:
[1 x 5=51

Resource Main
Compou pou

Training Finance
Compoun Compound

Centre to centre distance between various compounds as per architectural drawing (in m)isas
follows
Main Compound to Resource Compound
110m
Main Compound to Training Compound
115m
Main Compound to Finance Compound
35 m
Resource Compound to Training Compound
25 m
Resource Compound to Finance Compound
135m
Training Compound to Finance Compound
100m
d Sample Paper 12 Excellence Level
•stage 111 167
sgccee
i

Expectednumber of computers in each compound are as follows


Main Compound
5
Resource Compound
15
Training Compound
150
Finance Compound
20

(i) Suggest a cable layout of connections between the compounds.


(ii)suggest the most suitable place (i.e. compound) to house the server for this NGO. Also,
provide a suitable reason for your suggestion.
(iii)Suggest the placement of the following devices with justification:
(a) Repeater (b) Hub/Switch
(W)Which topology is best suited for this network?
(v)Expand the following
(a) LAN (b) PAN

34. (i) In a multiplex, movies are screened in different auditoriums. One movie can be shown in
more than one auditorium. In order to maintain the record of movies, the multiplex
maintains a relational database consisting of two relations viz. CINEMAand PEOPLE
respectively as shown below: [1+4= 5]
MovieName, ReleaseDate)
PEOPLE(AudiNo, Movie ID, Seats, ScreenType, TicketPrice)
then
Is it correct to assign Movie_IDas the primary key in the CINEMArelation? If no,
suggest an appropriate primary key.
Books •
(ii)Consider the table Books of following structure storing the details of
BookNo Author Publisher NoPages
Rohini BPB 450(Sample record)
books.
Write a Python code to update the publisher to "Arihant"for all
Database : BookDB
Host : localhost
Username : mysql
Password : book
Or
database EMP DEPENDENTto maintain following
(i)An organisation wants to create a
dependent.
details about its employees and their
Department,EmployeeID)
EMPLOYEE(AadharNumber, Name, Address,
Relationship)
DEPENDENT(EmployeeID, DependentName,
the table Patient storing details of patients as per following structure :
(ii) Consider Days
PNAME DEPT
PATID 5 (Sample record)
POI Sumit Ortho
Python code to add a column name Ward Varchar (15)
Write a
Database : BookDB
Host : localhost
Username : mysql
Password : book
168 StggelßExcellence Lev Computer Science Class
12

35. (i) Why are CSV files called


so?
(ii) Write a program using two user-defined functions as follows:
WriteRecord() To add records of furniture of the following structure to a binary file
"Furniture.dat".
FurlD Furname Type Price
The function should add records keeping the existing records.
SearchFur(p) To display the records from the file "Furniture.dat" whose type is "Wooden„
Or
(i) Write the advantage of using the "ab" mode over "wb" mode.
(ii) Write a Python program using two functions as follows :
CountData(Etype) To count and display records from the file "Emp.csv" of following
structure whose Etype is "Permanent"
Eno Empname Dept Etype Salary
AppendData() To accept data of as many employees and add them to the CSV file "Emp.csv„
preserving the existing employee data.

Answers
1. True
Solution scan QR code
10. (b) 11. (d) 12. (c)
13. (d) 14. (c) 15. (a) 16. (c) 17. (b) 18. (a)
Proficiency Building Zone
O Stage Ill Excellence Level
(Without Solutions)

SAMPLE
QUESTION PAPER 13
ComputerScience
Instructions Time : 3 hrs Max. Marks : 70

L Pleasecheck this question paper contains 35 questions.


is divided into 5 Sections A, B, C, D and E.
2.The paper
3.sectionA, consists of 18 questions (I to 18). Each question carries 1 Mark.
4.sectionB, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5.SéctionC, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6.sectionD, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7.SectionE, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8.Allprogramming questions are to be answered using Python Language only.

1Section A
[11
1. State True or False.
"Alist is immutable".
[1]
2. range(2,12) returns numbers from
(a) Ito 12 (b) 2 to 11 (c) 2 to 12 (d) None of these
[1]
3. Invalididentifier among the following is/are
(b) _ttt (c) break (d) Both (a) and (c)
(a) 123abc

4. Which of the following is Bitwise XOR operator?

5. Adictionary is ordered by
(c) Both (d) Not ordered
(a) keys (b) values
file.
6. The object is used to read data from a CSV
(c) load (d) readall
(a)reader (b) read
network is called
7• Geometric arrangement of devices on the
(c) media (d) LAN
(a)topology (b) protocols
Computer Science Class
170 Excellence Leveli
Astage 111
matching patterns.
characters for
8. The LIKE clause uses

9. Predict output of the following code :


while i <10:
if
break
print(i (d)3456
(b) 1 23 (c)345
(a) 12345
10. The basic purpose of URL is to locate (d) Node
(b) IP address (c) Web page
(a) Web server
11. Suppose the content of file "para.txt" is
Hello...How are you?
Hi...l am fine.
What are you doing now?
Hmm...nothing special.
What will be the output of following code?
def count():
f = open("para.txt","r")
lines
I = f. readlines()
for i in 1:
if iCO]
1ines+=l
print (lines) (d) None of these

12. Which of the following can not have duplicate values ?


[1]

(b) Foreign key (c) Candidate key (d) Alternate key


(a) Primary key
[1]
13. IP address is of bytes.
(d) Not fixed

14. Evaluate the expression


56/8 + 2 ** 3—4
(a) 11 (b)-14 (c) 14 (d) Error

15. Parameter of the GROUPBYclause is


(a) a value (b) a field (c) a record (d) a table
16. Identify the token that are available in Python.
(a) Identifiers (b) Keywords (c) Literals (d) All of these
Directions In the question numbers 17 and 18, a statement ofAssertion (A) is followed by a statement
(R). Choose the correct option.
17. Assertion (A) Multiple text files may be opened together for processing.
Reason (R) Python allows creation and association of multiple file objects linked to text files•
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
Sample Paper 13 Excellence Level! 171
—d
Assertion(A) A user-defined function that accepts 3 parameters where no parameter carries a
18.defaultvalue, must be called with 3 parameters.
Reason(R) Since, there are no default parameters, 3 parameters must be passed to the function.
R are true and R is the correct explanation of A.
(a) Both A and
R are true but R is not the correct explanation of A.
(b)BothA and
tille but R is false.
(c) A is
false but R is true.
(d)Ais

sectionB
how star topology is better in terms of fault detection. [1+1
19. i) State
(ii) In which topology, every node is connected to two other nodes?
Or
(i)Which guided media provides secure transmission amongst all of them?
(i) Arrangethe following network in ascending order of their area:
LAN, PAN, WAN, MAN
[2]
output of the following Python code?
20.Whatwill be the
x— C'ab', 'cd']
for i in x:
i. upper()
print(x)
[2]
Python code?
2L Whatwill be the output of the following
num=
= 18
= 16
= 22

for i in num:
sum+ = numCi]
print(len(num) + sum)
Or
Identifythe error and write the correct code.
60-a
while (a>50)
print(a)
a=a+10
with example to explain it. [2]
22' Writethe syntax of UPDATEcommand along
Or
Define its types.
Whatdo you mean by data independence?
23.How to traverse a string using for loop?
calculate the sum and mean of the elements which are entered by user. [2]
24' Writea program to
Or
Python code snippet?
Whatwill be the output of the following

for i in range(len(x)):
print(x)
Computer Science Class
12

172 Excellence Leve!


•stage 111

25. Write a program to ask for following as input:


Enter your first name:
Enter your last name:
Enter your date of birth:
And display output such as
Veer Mehra was born on 1991-8-4.

Section C
26. Consider the two tables given below :
Table : Student
Marks AddresslD
RollNo Name Class
12ScA 78.5
1 Rohan A2
11ComC 67.7
2 Smita A3
p riya 12HumA 82.6
3
Table : Address
State Contact
AddresslD Place
Delhi 9876745655
Pahargunj
WB 9434566778
A2 Kolkata
Punjab 9433534038
Barnala
the table Student and Address.
Write SQL queries for statements (i) to (iii), with respect to
for Students whose Name
(i) Display Student names, corresponding Places and AddressIDs
ends with "a".
(ii) Increase marks of students by 5.5 who belong to state of "Delhi"
(iii) Delete records of students of class 12.
27. Write a definition of a function Bfileread() that receives a filename and an ID as parameter
and

displays only those records from a file "Transaction.dat" who have transaction type (TType) as
"Deposit".
Assume the following record structure of the file:
fransaction.dat
TID Amount
T05 Withdrawl 55000(Sample record)
Example :
File contents
TID TlYpe Amount
T05 Withdrawl 55000
T02 Deposit 70000
Output :
T02 Deposit 70000
Or
Write definition of a Sportsread() that receives a filename and a gamename as
parameter and displays only those records from a file "Games.dat" who have type as "Indoor
Assume the following record structure of the file:
Games.dat
SID Gamename
sol Football Outdoor
Sample Paper 13 Excellence Level
estage 111 173
i511

Example:
Filecontents
SID
Gamename Type
sol Football Outdoor
s02 Indoor
Output :
s02 Indoor
following table and find solutions for (i) to (iii).
28. Studythe
Ronitawants to store the data of some products in a table product as follows:
Table : Product
PNO PName Qty Date_Of_Mfg
POI Pencil 20 2020-09-01
PC)2 Eraser 5 1990-09-11
P03 Book 16 200C04-03
Notebook 15 2016-12-11
Color 10 2015-02-04

She also wants to perform some operations and manipulations on the table. Help her to find
the solutions of following questions.
(i)A command that displays the details of all the products.
(ii)Which command she can use to add a new column to the table?
(iii) Write the command to display the field description of the table.
29.Writea program in Python to input details of as many guests as per following structure :
GuestlD, Guestname , Type , Location . Now, create a dictionary storing GuestlD as key and
other details as list of values, for only those Guests whose name starts and ends with a vowel.
[3]
Example :
Input
GuestlD Guestname IYpe Location
Rakesh Foreign Amsterdam
Amitabha National Kolkata
Dictionarycontents:
'Amitabha',' National','Kolkata']}
30• Nabojeet has created a dictionary: "Electronics" ,storing data of electronic products. Write a
. The function checks the
user-definedfunction Pushltems() with the dictionary as parameter whose price is above 10000.
detailsin the dictionary and pushes only those items into a stack
[3]
Dictionary Structure :
:C'LCD' 15000], Player'
Electronics .

nSection D
Write MySQL commands for the statements given
31•Consider the following table PREPAID. [Ix4 —4]
below:
Model Connection
S No C_Name
1 Nokia Artel
Sita
Samsung Idea
2 Geeta
LG BSNL
3 Ritesh
Micromax Reliance
4 Jayant
Computer Science Class12
174 Stagelll Excellence Level
take NULL values.
column does not
(a) Write a command so that the Model
(b) Display all records of table Prepaid.
(c) DELETE a column name Model. type is BSNL.
where Connection
(d) DELETE a customer record with following attributes:
of departments
32. Given a file "dept.dat", containing records
Candidate: Name of the candidates Math, Biology, etc.
Computer, Physics,
Department: Department name like: the file "dept.dat" and creates a file named
contents from
Write a method copy() that would read from "dept.dat" where the department name
is

"com.dat" copying only those records


in "dept.dat"
"Computer". Assume that '-' is a field separator

Section E up its new campus at Jaipur for its web-based


33. Vidya for all is an educational NGO. It is setting
in the diagram below:
activities. The campus has four buildings as shown

Main Resource
Building Building

drawing (in m) isas


Centre to centre distance between various buildings as per architectural
follows :
Main Building to Resource Building 120m
Main Building to Training Building
40 m
Main Building to Accounts Building 135m
Resource Building to Training Building 125 m
Resource Building to Accounts Building 45 m
Training Building to Accounts Building 110m

Expected number of computers in each building are as follows :


Main Building 15
Resource Building 25
Training Building 250
Accounts Building 10

(i) Suggest a cable layout of connection among the buildings.


(ii) Suggest the most suitable place (i.e. building) to house the server for this NGO. Also, provide
a suitable reason for your suggestion.
(iii) Suggest the placement of the following devices with justification:
(a) Repeater (b) Hub/Switch.
(iv) Write any one advantage of bus topology.
(v) Expand MODEM.
Sample Paper 13
OStage111
ExcellenceLeve 175
34. (a) why FOREIGN keys are allowed to
have NULL values?
(b) consider the table Explain. [1+4=51
Tax of following
structure storing the details
of taxpayers:
Desig Taxslab
EOI Mr. Das
Director 3(Sample data)
Writea python code to update the
Taxslab to 4 for employees
Director of designation "Director" or "Sr
Note :
Database : TaxDB
Host : localhost
Username : mycode
Password : sqlpwd
Or
(a) Mention any limitation of DBMS. Write
names of two DBMS softwares.
(b) consider the table Computer storing
details of computer systems as per followingstructure :
SID Type Config Price
Sll Micro Pentium 26000(Sample record)
Write a Python code to increase Price by 2%
for computer systems whose configuration is
"Pentium".
Note :
Database : CompDB
Host : localhost
Username : root
Password : comp@200
35. (i) Differentiate between reader and writer objects for CSVfiles. [2+3 = 5]
(ii)Write a program using two user defined functions as follows:
Flushtofile(fname, n) To accept n records of following structure into the binary file
"fname.dat" storing details of electronics , where fname is a parameter to the function.
ItemID Itemname Wattage Qty
Displaydata(fname) To display all the records from the file "fname.dat" whose Qty is above
100.
If there are no such records , a proper message is to be displayed.
Or
(i) How are CSV files different from text files?
(ii)Write a Python program using two functions as follows :
CountAcc()To count and display records from the file "Accessories.csv"
of following
structure whose Accessorie name's length is greater than 20. The file stores records of some
computer accessories.
AID Aname Price Category
SearchAcc(cat) To display from the file 'Accessories.csv" the accessories whose category is
same as 'cat' , that is supplied as a parameter to the function.

Answers
I, False 90 . @
Por Solution scan QRcode
11. (a) 12. (a)
10. (b)
17. (a) 18. (a)
14. (a) 15. (b) 16. (d)
proficiency Building
O Stage Ill ExcellenceLeve
(Without Solutions

SAMPLE
QUESTION PAPER 14
Computer Science
Instructions Time : 3 hrs Max.Marks 70
1. Please check this question paper contains 35 questions.
2. The paper is divided into 5 Sections A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries I Mark.
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question cames 5 Marks.
8. All programming questions are to be answered using b'thon Language only.

SectionA
1. State True or False.
"The extend method extends the 1st list with the 2nd list contents."
2. The continue statement
(a) Stops the loop (b) Stops the current iteration
(c) Stops the program execution (d) None of these
3. Invalid keyword among the following is
(a) break (b) for (c) while (d)jump
4. x=2
y=-2
x ** y returns
(a) 0.25 (b) 0.5 (c) Error
5. A dictionary can have maximum
(a) 3 Keys (b) 4 keys (c)Any cf keys (d) None of these
6. The function creates a cursor object.
(a) cursor() (b) createcursor() (c) loadO
(d)
7. The primary key constraint can be applied to
(a) one column (b) two columns (c) three colum1B
(d) many columns
Sample Paper 14
Excellence Lev
estage 111 177
character with LIKE clause
8. The matches multiple unknown characters.

be the output of the following Python


9 Whatwill code? [1]
num
= 18
- 16
= 22
sum-O
for i in num:
sum num[i]
print (sum)
(a) 54 (b) 38 (c) 33 (d) 56

10. Thefloat / double/decimal type columns require [1]


(a)width only (b) width and decimal places
(c)onlydecimal places (d) either width or decimal place

B. Thecontent of file 'arihant.txt' is as follows [1]


Welcome to Arihant!
Welcometo your one-step solutions for all your study,
practice and assessment needs for various competitive &
recruitment examinations and school segment.

Whatwill be the output of following code?


myfile = open('arihant.txt','r')
s —myfi1e.read(15)
print(s)
myfile.close()
(a)Welcome to Arihan (b) Welcome to Arih
(c) Welcome to Arihant (d) Welcome to Arihant!

12. Whichoperator is used to compare a value to a specified list of values? [1]


(a)
ANY (b) BETWEEN (c) ALL (d) IN

13. Whichproperty about cookies is incorrect? [1]

(a)They are created by user. (b) They are temporary.


(c)Theyare created by the web site. (d) Both (a) and (b) are incorrect.

14. Evaluate the expression : [1]

(c) 45 (d) 40

speeds depending on the


Which of the following device may operate at different network
protocol standard they support?
(a) Router (b) Ethernet card
(c) RJ45 Connector (d) None of these
same kind of information whenever a user visits? [1]
16•Which of the following web page displays
(a) Dynamic web page (b) Static web page
(c) Both (a) and (b) (d) None of these
Computer Science Class
178 ExcellenceLevec 12

(A) is followed bya statement


Directions In the question numbers 17 and 18, a statement ofAssertion
(R). Choose the correct option.
supersedes the default values in function
17. Assertion (A) In a function call the actual parameter
definition.
when the actual parameters are
Reason (R) Default values are meant only for the instances not
passed in function call.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
method.
18. Assertion (A) A file that is opened must be closed by the close()
desired.
Reason (R) If the file is not closed, the program will not perform as
(a) Both A and R are u•ueand R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

Section B
19. (i) Name one commonly used open source internet browser and one commonly used open
source operating system. 11+1=21

(ii) What is used to translate domain name into IP address?


Or (i) What is WWW?
(ii) Write one characteristics of 2G.
20. What is the output of the code?
z-100
def f():
global z
print('z is:' , z)
z-50
printCNewvalue of global z is:' , z)
print('Va1ueof z is:' , z)
21. find the output of the following code from given options.
def calcresult ():

while i > 1:
if
x=iX2
print(x)
Or Find the output of following code

print(i)
d Sample Paper 14 Excellence Level
'Stage 111 179
i5ij

ExplainCROSS JOIN with an example. [2]


22.
consider the table MOVIEDETAILS given below.
or
Table : MOVIEDETAILS

MOVIEID TITLE
LANGUAGE RATING PLATFORM
MOOI Minari
Korean 5 Netflix
MGR Magan
Tamil 4 Hotstar
M010 Kaagaz Hindi 3 Zee5
MOII Harry Potter and the Chamber of Secrets
English 4 Prime Video
M015 Uri Hindi 5 Zee5
M020 Avengers: Endgame English 4 Hotstar

(i) Identify the degree and cardinality of the table.


(ii) Which field should be made the primary key? Justify your answer.
23. What do you mean by type conversion? Name two type conversion. [2]

24. Find the result of following code [2]


ends "
(i) Str.capitalise() (ii) Str.upper()
Or
What will be the output of the following Python code?
listl = [11, 12, 13, 14, 15]
for i in range(l, 5):
= listlCi]
for i in range(0, 5):
print(listl[i] , end =

25. Observethe following Python code very carefully and rewrite it after removing all syntactical
errors with each correction underlined. [2]
DEF execmain ( ) :
x = input ("Enter a number")
if (abs(x) = x):
print ("You entered a positive number:")
else:

print ("Numbermadepostive : " x)


execmain ( )

•SectionC
26. Considering the following tables :
Table : STUDENT
Class Section ProjectNo
RollNo Name
Xl 1 101
11 Mohan
Sohan Xl 2 102
12
1 103
John Xll
21
Meena Xll 2 104
22
Xll 2 103
23 Juhi
Computer Science Class12
180 E8cetlence Level
OStage 111

Table : PROJECT
Submission_Date
ProjectNo PName
12/01/2018
101 Airline Database
12/01/2018
102 Library Database
15/01/2018
103 Employee Database
12/01/2018
104 Student Database
15/01/2018
105 Inventory Database
15/01/2018
106 Railway Database

the names, ProjectNo of Section 2 students.


(i) Write a query to display
to 3
(ii) Change the Section of class XII students name ends with
corresponding project names for students whose
(iii) Display student names ,

receives a filename and a rollno as parameter and


27. Write a definition of a function csvread() that
"result.csv" who have status as "Success"
displays only those records from a file
Assume the following record structure of the file.
"Result.csv"
RollNo Status
1784 Success(Sample Record)
Or
a filename and a collegename as
Write a definition of a function Sportsread() that receives who have collegenameas
parameter and displays only those records from a file "College.dat"
"11T".
Assume the following record structure of the file.
College.dat
AdmNo College Branch
A098 11T Electrical(Sample record)
28. Write SQL commands for (i) to (iii) on the basis of the table SPORTS.
Table : SPORTS
STUDNO CLASS NAME GAMEI GRADE GAME2 GRADEI
10 7 Sameer Cricket B Swimming
11 8 Sujit Tennis A Skating c
12 7 Kamal Swimming B Football
13 7 Veena Tennis c Tennis
14 9 Archana Basketball Cricket
15 10 Arpit Cricket A Athletics c

(i) Display the games taken up by the students, whose name starts with 'A'.
(ii) Write a query to add a new column named MARKS.
(iii) Write a query to assign a value 200 for Marks for all those, who are getting grade 'B' or grade
'A'in both GAMEI and GAME2.
29. Write a program in Python to input a sentence and a word. Now, search the word in the sentence
and add each occurrence of the word as value of a dictionary and the key as the index where
are found.
Sample Paper 14 Excellence Level*
OStage 111 181
pcceed

Example
Input : "He is such a boy who is very good in studies.
Dictionary contents :
21:'is' }
{ 3:'is',
30.Jitendrawas told by his teacher to pick certain elements from a dictionary: "Garment" and push
intoa stack selectively the garment items whose price is above
• 5000. The structure of the
dictionaryis given below [3]
Garment {'1' : 15000]}

'Section D
31.Writethe SQL commands for (a) to (d) on the basis of the table HOSPITAL.
Table: HOSPITAL
No Name Age Department Dateofadm Charges Sex
1 Sandeep 65 Surgery 23/02/98 300
2 Ravina 24 Orthopaedic 20/01/98 200
3 Karan 45 Orthopaedic 19/02/98 200
4 Tarun 12 Surgery 01/01/98 300
5 Zubin 36 ENT 12/01/98 250
6 Ketaki 16 ENT 24/02/98 300
7 Ankita 29 Cardiology 20/02/98 800
8 Zareen 45 Gynaecology 22/02/98 300
9 Kush 19 Cardiology 13/01/98 800
10 Shailya 31 Nuclear Medicine 19/02/98 400
Writethe for the following :
(a)Toget the department wise number of patients.
(b)Toget the department names that end with "ogy".
(c)Toremove all the records of the table along with the table structure.
(d)Toget the maximum charges among all
32.Writea program to show the detail of the student who scored the highest marks.
Data stored in
"Data.csv"is given below: [4]
Rollno,Name, Marks
1. Aman, 35
2. Kanak, 1
3. Anuj, 33
4.Suman, 25

nSection E
33' Eduminds University of India is starting its campus in a small town Parampur of
Central India
with its centre admission office in Delhi. The university has three major buildings
Adminbuilding, Academic building and Research building in 5 km area campus. comprising of
Computer Science Class 12

182 Excellence Leveli


Steve111
plan as per (i) to (v) to the authorities
the network
As a network expert, you need to suggestgiven parameters.
keeping in mind the distances and other
Eduminds Research
University Building
Delhi Parampur
Admission Campus
Office
Academic Admin
Building Building

various locations
Expected wire distance between
90 m
Research Building to Admin Building
80 m
Building
Research Building to Academic
15 m
Academic Building to Admin Building
Campus 1450 km
Delhi Admission Office to Parampur
various locations in the university areas
Expected number of computers to be installed at
follows 20
Research Building
150
Academic Building
35
Admin Building
5
Delhi Admission Office
buildings inside the University
(i) Suggest the authorities, the cable layout amongst various
campus for connecting the buildings.
server of this organisations
(ii) Suggest the most suitable place (i.e. building) to house the
with a

Il
suitable reason.
each of the building to connect
(iii) Suggest an efficient device for the following to be installed in
all the computers
(a) Gateway (b) Modem (c) Switch
(iv) Suggest the most suitable (very high speed) service to provide data connectivity between
admission building located in Delhi and the campus located in Parampur from the following
options:
(a) Telephone line
(b) Fixedline dial-up connection
(c) Co-axial cable network
(d) GSM
(e) Leased line
(f) Satellite connection.
(v) University is planning to connect its campus in Delhi which is less than 100 km. Whichtype
of network will be formed?
34. (a) Write differences between equi join and cross join. [1+4=5)

(b) Consider the table Project of following structure storing the details of some ongoing
software projects.
ProjCode ProjName Team SubmissionDate
POI Electrification 105 2023-12-05(Sample data)
sample Paper 14 OStage111Excellence Leve! 183

Writedefination of a function ChangeData(Pcode,val)that will receive a project code and a


value and increase the "Team" field by the value received, for those projects whose
projectCodematches with the Pcode received.
Note :
Database ProjDB
Host localhost
Username root
Password sqlpwd
Or
(a)Whatare records ? What is the other name of records?
(b)consider the table Defence storing details of Defence personnel as per following structure :
Did Wing Rank Grade
ArmoI Army Major 3 (Sample record)
Writea Python code to display the wing and grade of those personnel whose Rank is "Major
or "Brigadier"
Note : Database : DefDB
Host : localhost
Username : root
Password : Arm@2021
35. (i) How is read(size) different from read()? [2+ 3=51
(ii)Write a program using two user-defined functions as follows:
StoreSoftware() To accept as many software records of following structure and store them to
a csv file "Software.csv" , only if the software type is "Web".
SoftlD Softname Type Manhours
SearchSoft(Manhours) To display all the records from the file "Software.csv" whose
Manhoursis above 10000.
If there are no such records , a proper message is to be displayed.
Or
(i)Whatis the other parameter to the seek() function other than the number of bytes?
(ii)Write a Python program using two functions as follows :
AddEbill()To accept electricity bill paid details of consumers and append them to a binary
file "Electricity.dat".Also, display names of the consumers whose bill amount is less than
1000.
ConsumerID MeterNo BillAmt Paystatus
Showreport() To read the binary file "Electricity.dat"and display a report of customers
whose pay status is "Unpaid"

You might also like