0% found this document useful (0 votes)
76 views8 pages

Solved CS12 Term2 2021-2022 Paper 1

The document describes a computer science exam paper with three sections (A, B, C). Section A has 7 short answer questions worth 2 marks each. Section B has 3 questions worth 3 marks each. Section C has 3 questions worth 4 marks each. The paper tests knowledge of topics like SQL, Python, databases, and data structures like stacks. It provides sample code and tables to use in answers.

Uploaded by

Aryan Gadhok
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)
76 views8 pages

Solved CS12 Term2 2021-2022 Paper 1

The document describes a computer science exam paper with three sections (A, B, C). Section A has 7 short answer questions worth 2 marks each. Section B has 3 questions worth 3 marks each. Section C has 3 questions worth 4 marks each. The paper tests knowledge of topics like SQL, Python, databases, and data structures like stacks. It provides sample code and tables to use in answers.

Uploaded by

Aryan Gadhok
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/ 8

Delhi Public School R.K.

Puram
Term-II Paper 1
COMPUTER SCIENCE (Code: 083)
Maximum Marks: 35 Time: 2 hours
General Instructions
● The question paper is divided into 3 sections – A, B and C
● Section A, consists of 7 questions (1-7). Each question carries 2 marks.
● Section B, consists of 3 questions (8-10). Each question carries 3 marks.
● Section C, consists of 3 questions (11-13). Each question carries 4 marks.
● Internal choices have been given for question numbers 7, 8 and 12.
Section -A
Each question carries 2 marks
Q. Part Question Marks
No No.
1. Give any two characteristics of SQL. (2)
Ans Any two:
● Easy to learn
● Wide variety of commands DDL, DML
● Union operations on tables
● Joins operations on tables
● Supports connectivity with Python and other languages
2. (i) Expand the following: (1)
HTML, XML
Ans ● HTML - HyperText Markup Language
● XML - eXtensible Markup Language
(ii) Out of the following, which is the most economic and most expensive (1)
medium of communication?

microwave, Ethernet cable, optical fiber, satellite,


radiowave
Ans Most economic: Ethernet
Most Expensive: Satellite
3. Differentiate between int and float data types with respect to databases. (2)
Ans int - The data type for storing integer values (i.e. without decimal places)
float - The data type for storing real numbers (i.e. with decimal places)
4. Observe the following Python code and answer the questions below (2)
assuming the table STOCK is containing 31 rows in it.

C= db.cursor()
MYSQL="SELECT Ino, Item FROM STOCK"
C.execute(MYSQL)
R=C.fetchall()
print(len(R))

(a) What will be the output of the code?


(b) What will be the datatype of the R object after the given
command is executed?

PAGE #1/8
Ans (a) 31
(b) tuple
5. Write the output of the queries (a) to (d) based on the table, (2)
Training given below:
Table: TRAINING
TId Name Topic City Fee
U01 Khwaja IT Tools Gurugram 5000
D01 Anubha Cyber Security Faridabad 3000
D01 Atin Cyber Security Delhi 7000
D02 Inder IT Tools Delhi 5000
U02 Jones Cyber Security Gurugram NULL
(a) SELECT AVG(FEE) FROM TRAINING ;
(b) SELECT COUNT(TID),CITY FROM TRAINING GROUP BY CITY;
(c) SELECT * FROM TRAINING WHERE NAME LIKE "J%";
(d) SELECT DISTINCT TOPIC FROM TRAINING;

Ans (a)
+-----------+
| AVG(FEE) |
+-----------+
| 5000.0000 |
+-----------+
(b)
+------------+-----------+
| COUNT(TID) | CITY |
+------------+-----------+
| 2 | Gurugram |
| 1 | Faridabad |
| 2 | Delhi |
+------------+-----------+
(c)
+------+-------+----------------+----------+------+
| TID | NAME | TOPIC | CITY | FEE |
+------+-------+----------------+----------+------+
| U02 | Jones | Cyber Security | Gurugram | NULL |
+------+-------+----------------+----------+------+
(d)
+----------------+
| TOPIC |
+----------------+
| IT Tools |
| Cyber Security |
+----------------+

Note: Writing column heading is not must

6. (i) What do you understand by constraint? Name any one constraint. (1)

Ans SQL constraints are used to specify rules for the data in a table. Constraints
are used to limit the type of data that can go into a table.

Any one example out of the following

PAGE #2/8
● NOT NULL
● UNIQUE
● PRIMARY KEY

(ii) Give one point of difference between Primary key and Foreign key. (1)

Ans Primary Key: An attribute/group of attributes in a table that identifies a


tuple uniquely is known as a Key.

Foreign Key: A Foreign Key is a column or a combination of columns whose


values match a Primary Key of a different table. The relationship between
two tables matches the Primary Key in one of the tables with a Foreign Key
in another table.

7. Consider the table, Vehicle given below:

Table: VEHICLE (2)


MID NAME BRAND CAPACITY COLOR
M015 Creta Hyundai 5 WHITE
M004 XUV500 Mahindra 5 BLUE
M001 Innova Toyota 7 SILVER
M011 I10 Hyundai 5 BLUE
M020 WagonR Maruti 5 RED
M010 Fortuner Toyota 7 WHITE
(a) Identify the degree and cardinality of the table Vehicle.
(b) Which field should be made the primary key? Justify your answer.

Ans (a) Degree: 5 Cardinality: 6


(b) MID - Its values identify each tuple uniquely (non repeated
values).

OR

(a) Identify the candidate key(s) from the table VEHICLE.


(b) Which command is used to display the structure of the above
table Vehicle.

Ans (a) MID and NAME


(b) DESC

SECTION - B
Each question carries 3 marks

8. Ram has stored the details about the book collection he has along with its
genre in a dictionary object. Write a program to
● Store the names of the books whose genre is either “Fiction”,
“Thriller”, or “Horror” in a stack using the Push function.
● Pop and display the names of the books stored in the stack using the
POP function.
For example:
If the sample content of the dictionary is as follows:
Book={"THE HELP":"FICTION", "WATCHMAN":"COMIC", "CARRIE":
"HORROR","CIRCLE":"FANTASY","BIRD BOX":"HORROR"}

PAGE #3/8
The output from the program should be:
BIRD BOX CARRIE THE HELP

Ans def PUSH(Stack,Name):


Stack.append(Name)

def POP(Stack):
if Stack!=[]:
NM=Stack.pop()
else:
NM=None
return NM

Book={"THE HELP":"FICTION", "WATCHMAN":"COMIC", "CARRIE":


"HORROR","CIRCLE":"FANTASY","BIRD BOX":"HORROR"}
ST=[]
for nm in Book:
if Book[nm] in ["FICTION", "THRILLER", "HORROR"]:
PUSH(ST,nm)

while True:
N=POP(ST)
if N != None:
print(N, end=" ")
else:
break

OR

Ram has a list containing 10 numbers. You need to help him create a program
with separate user defined functions to perform the following operations based
on this list.
● Traverse the content of the list and push the numbers between 10 and 20
(including both) into a stack.
● Pop and display the content of the stack
For Example:
If the sample Content of the list is as follows:
N=[10,12.67,7.7,9.99,34,10.6,16.45,20.12,19.99,54]

Sample Output of the code should be:


19.99 16.45 10.6 12.67 10

Ans def PUSH(Stack,Num):


Stack.append(Num)

def POP(Stack):
if Stack!=[]:
NM=Stack.pop()
else:
NM=None
return NM

N=[10,12.67,7.7,9.99,34,10.6,16.45,20.12,19.99,54]
ST=[]

PAGE #4/8
for n in N:
if n>=10 and n<=20:
PUSH(ST,n)

while True:
N=POP(ST)
if N != None:
print(N, end=" ")
else:
break

9. (i) A table, PRODUCT has been created in a database with the following (1)
fields:
ID, PROD, QTY, PRICE, DOM

Give the SQL command to add Primary key constraint to the ID


Column of the PRODUCT table.

Ans ALTER TABLE PRODUCT


ADD PRIMARY KEY (ID);

(ii) What is the difference between DELETE and DROP TABLE commands of SQL? (2)
Also, specify their categories out of DDL and DML for these commands.

Ans DELETE - It is a DML command used to delete ROW(s) from a table. Even
after deletion of all the rows, the structure of the table remains.

DROP TABLE - It is a DDL command used to delete the table. It deletes rows
as well as columns of the table.

10 Reema has to create a table named PLANTS to store the records of the
plants in her nursery within the NURSERY database. Write the SQL command
to create the PLANTS table which has the following structure:

Table: PLANTS
FIELD NAME DATA TYPE REMARKS
PID CHAR(4) Primary Key
PLANTNAME CHAR(35)
PRICE FLOAT
QTY INTEGER
TYPE VARCHAR(20)

Ans CREATE TABLE PLANTS (


PID CHAR(4) PRIMARY KEY,
PLANTNAME CHAR(35),
PRICE FLOAT,
QTY INT,
TYPE VARCHAR(20));

Section C
Each question carries 4 marks

11 Write queries (a) to (d) based on the tables STUDENT and SUPW given (4)
below:

PAGE #5/8
Table: STUDENT
SID NAME CLASS SUPWCODE SEC PER
1023 NEHA 12 101 A 89.5
3045 SHIKHA 11 102 B 78.5
2305 RAVI 11 101 A 87
1205 FAIZAL 12 100 C 63
1055 KUNAL 12 103 B 90
Table: SUPW
SUPWCODE SNAME
100 DANCE
101 MUSIC
102 THEATER
103 PHOTOGRAPHY

(a) To display the count of students in each class.


(b) To display the name and respective SUPW name of each student whose
percentage is more than 77.
(c) To display the names of those students which have ‘I’ as the third
character in the name.
(d) To display NAME, SUPWCODE, SNAME, SEC from the tables STUDENT
and SUPW.

Ans (a) SELECT CLASS,COUNT(*) FROM STUDENT GROUP BY CLASS;


(b) SELECT NAME, SNAME FROM STUDENT A, SUPW B
WHERE A.SUPWCODE=B.SUPWCODE AND PER>77;
(c) SELECT NAME FROM STUDENT WHERE NAME LIKE "__I%";
(d) SELECT NAME, A.SUPWCODE, SNAME, SEC
FROM STUDENT A, SUPW B
WHERE A.SUPWCODE=B.SUPWCODE; .
12. (i) Give two advantages and two disadvantages of BUS topology (2)
Ans Advantages
● Simple layout
● Economic
Disadvantages
● Slow
● Damage in cable anywhere stops the entire connectivity
OR
Define the following terms:
XML , web Server
Ans XML (eXtensible Markup Language): XML is a programming language that
enables designers to create their own tags to indicate specific information.
XML is one of the most widely-used formats for sharing structured
information today.

Web server: It is a computer that stores Web documents and makes them

PAGE #6/8
available to the rest of the world. A server may be dedicated, meaning its
sole purpose is to be a Web server, or non-dedicated, meaning it can be used
for basic computing in addition to acting as a server.
(ii) What is the difference between IP address and Domain Name? (2)
Ans IP Address: An Internet Protocol address (IP address) is a numerical label
such as 192.0.2.1 that is connected to a computer network that uses the
Internet Protocol for communication.

Domain Name: It is the unique name that identifies an Internet site. Domain
Names always have 2 or more parts, separated by dots (or periods). The part
on the left is the most specific, and the part on the right is the most
general. A given machine may have more than one Domain Name but a given
Domain Name points to only one machine. Example: w3schools.com,
microsoft.co.in, cbse.nic.in
13. BMP University is setting up its academic blocks at Navi Mumbai and is (4)
planning to set up a network. The University has 3 academic blocks and one
Human Resource Center as shown in the diagram below:
BMP University

Center to Center distances between various blocks/center is as follows:


Block to Block Distance In Mtrs
Law Block to business Block 40
Law block to Technology Block 80
Law Block to HR center 105
Business Block to technology Block 30
Business Block to HR Center 35
Technology block to HR center 15

Number of computers in each of the blocks/Center is as follows:


Law Block 15
Technology Block 40
HR center 115
Business Block 25
(a) Suggest the most suitable place (i.e., Block/Center) to install the server of
this University with a suitable reason. Draw the cable layout too.
Ans HR Center

PAGE #7/8
(b) Suggest the placement of the following device with justification
(i) Repeater
(ii) Hub/Switch
Ans (i) Repeater should be placed between HR Center and Law Block as the
distance more than 70 m

(ii) Hub/Switch should be installed in each of the block for connecting all
the computers

(c) Which device will you suggest to be placed/installed in each of these


blocks/centers to efficiently connect all the computers within these
blocks/centers.
Ans Switch
(d) The university is planning to connect its admission office in Delhi, which is
more than 1250 km from the university. Which type of network out of LAN,
MAN, or WAN will be formed? Justify your answer.
Ans Type of network will be WAN as it is other than the Navi Mumbai

LAN covers max. 1 KM


MAN covers one city

PAGE #8/8

You might also like