Solved CS12 Term2 2021-2022 Paper 1
Solved CS12 Term2 2021-2022 Paper 1
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?
C= db.cursor()
MYSQL="SELECT Ino, Item FROM STOCK"
C.execute(MYSQL)
R=C.fetchall()
print(len(R))
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 |
+----------------+
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.
PAGE #2/8
● NOT NULL
● UNIQUE
● PRIMARY KEY
(ii) Give one point of difference between Primary key and Foreign key. (1)
OR
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
def POP(Stack):
if Stack!=[]:
NM=Stack.pop()
else:
NM=None
return 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]
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
(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)
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
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
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
PAGE #8/8