Students can access the CBSE Sample Papers for Class 12 Computer Science with Solutions and marking scheme Term 2 Set 1 will help students in understanding the difficulty level of the exam.

## CBSE Sample Papers for Class 12 Computer Science Term 2 Set 1 with Solutions

Maximum Marks: 35
Time: 2 hours

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)

Question 1.
Give any two characteristics of stacks.
A stack is an abstract data type that holds an ordered, linear sequence of items. The characteristics of stack are

1. It is a Last In First Out (LIFO) data structure which means the item which is inserted last in the stack will be the first one to delete from the Stack.
2. The insertion and deletion happens at one end i.e. from the top of the stack.

Question 2.
(i) Expand the following
(a) SMTP

• SMTP stands for Simple Mail Transfer
• Protocol. It is an internet standard communication protocol for electronic mail transmission.

(b) XML
XML stands for extensible Markup Language. It consists of a set of codes, or tags, that describe the text in a digital document where the tags are not predefined.

(ii) Out of the following, which is the fastest wired and wireless medium of transmission? Infrared, Coaxial cable, Optical fibre, Microwave, Ethernet cable

• Wired → Optical fibre
• Wireless → Microwave

Question 3.
Differentiate between char(n) and varchar(n) data types with respect to databases.

 char(n) varchar(n) It stores a fixed length string between 1 and 255 characters. It stores a variable length string. If the value is of smaller length, then it adds blank spaces. length. Some space is wasted in it. in varchar(n).

Question 4.
A resultset is extracted from the database using the cursor object (that has been already created) by giving the following statement.

Mydata = cursor.fetchone()

(i) How many records will be returned by fetchone() method?
fetchone() method retrieves the next row of a query result set and returns a single sequence, or none if no more rows are available.So one record will be returned by fetchone() method.

(ii) What will be the datatype of Mydata object after the given command is executed?
tuple is the datatype of Mydata object after the given command is executed. Tuples are used to store heterogeneous elements, which are elements belonging to different data types.

Question 5.
Write the output of the queries (i) to (iv) based on the table FURNITURE given below.
Table : FURNITURE

(i) SELECT SUM(DISCOUNT) FROM FURNITURE WHERE C0ST>15000;

(ii) SELECT MAX(DATEOFPURCHASE) FROM FURNITURE;

(iii) SELECT * FROM FURNITURE WHERE DISCOUNTS AND FID LIKE “T%”;

(iv) SELECT DATEOFPURCHASE FROM FURNITURE WHERE NAME IN (“Dinning Table”, “Console Table”);

Question 6.
(i) Which command is used to view the list of tables in a database?
SHOW TABLES, command is used to view the list of tables in a database.

(ii) Give one point of difference between an equi-join and a natural join.
Differences between equi-join and a natural join are as follows:

 equi-join natural join The join in which columns from two tables are compared for equality. The join in which only one of the identical columns existing in both tables is present. Duplicate columns are shown. No duplication of columns.

Question 7.
Consider the table MOVIEDETAILS given below
Table: MOVIEDETAILS

(i) Identify the degree and cardinality of the table.
(ii) Which field should be made the primary key? Justify your answer.
Or
(i) Identify the candidate key(s) from the table MOVIEDETAILS.
(ii) Consider the table SCHEDULE given below.
Table: SCHEDULE

 SLOTID MOVIEID TIMESLOT S001 M010 10 AM to 12 PM S002 M020 2 PM to 5 PM S003 M010 6 PM to 8 PM S004 M011 9 PM to 11 PM

Which field will be considered as the foreign key if the tables MOVIEDETAILS and SCHEDULE are related in a database?
(i) Degree is the number of attributes or columns present in a table, So Degree is 5. Cardinality is the number of tuples or rows present in a table. So, Cardinality is 6.

(ii) MOVIEID should be made the primary key as it uniquely identifies each record of the table.
Or
(i) Candidate key in SQL is a set of attributes that uniquely identify tuples in a table. The Primary key should be selected from the candidate keys. Every table must have at least a single candidate key. So, MOVIEID and TITLE are the candidate keys in table MOVIEDETAILS.

(ii) A foreign key is a column or combination of columns that is used to establish and enforce a link between the data in two tables to control the data that can be stored in the foreign key table. So MOVIEID is the foreign key if the tables MOVIEDETAILS and SCHEDULE are related in a database.

Section – B
(Each question carries 3 Marks)

Question 8.
Julie has created a dictionary containing names and marks as key value pairs of 6 students. Write a program, with separate user defined functions to perform the following operations

• Push the keys (name of the student) of the dictionary into a stack, where the corresponding value (marks) is greater than 75.
• Pop and display the content of the stack.

For example If the sample content of the dictionary is as follows
R={“OM”:76/ “JAr’:45, “BOB”:89, “ALI”:65, “ANU”:90, “TOM”:82}
The output from the program should be
TOM ANU BOB OM
Or
Alam has a list containing 10 integers. You need to help him create a program with separate user-defined functions to perform the given operations based on this list.

• Traverse the content of the list and push the even numbers into a stack.
• Pop and display the content of the stack.

For example, If the sample content of the list is as follows
N=[12,13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
38 22 98 56 34 12

R={" 0M": 76 , "JAI":45, "B0B":89, ”ALI": 65 , "ANU":90 , "T0M":82) def PUSH(S,N):
S.append(N)
def POP(S):
if S!=[]:
return S.pop()
else:
return None
ST=[ ]
for k in R:
if R[k]>=75:
PUSH(ST, k)
while True:
if ST!=[]:
print(POP(ST),end=" ")
else:
break

Or

N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
def PUSH(S, N):
S.append(N)
def POP(S):
if S!=[]:
return S.pop()
else:
return None
ST=[ ]
for k in N:
if k%2==0:
PUSH(ST, k)
while True:
if ST!=[ ]:
print(P0P(ST),end=" ”)
else:
break

Question 9.
(i) A table, ITEM has been created in a database with the following fields
ITEMCODE, ITEMNAME, QTY, PRICE
Give the SQL command to add a new field, DISCOUNT (of type Integer) to the ITEM table.

ALTER TABLE ITEM ADD Discount INT;

(ii) Categorize following commands into DDL and DML commands?
INSERT INTO, DROP TABLE, ALTER TABLE, UPDATE…SET
DDL means ‘Data Definition Language’. It is used to create and modify the structure of database objects in SQL. So, DDL commands are DROP TABLE, ALTER TABLE. *
DML is ‘Data Manipulation Language’ which is used to manipulate data itself.
So, DML commands are INSERT INTO, UPDATE…SET.

Question 10.
Charu has to create a database named MYEARTH in MySQL.
She now needs to create a table named CITY in the database to store the records of various cities across the globe. The table CITY has 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.
Command to create database
CREATE DATABASE MYEARTH;

Command to create table

CREATE TABLE CITY(
CITYCODE CHAR(5) PRIMARY KEY,
CITYNAME CHAR(30),
SIZE INT,
AVGTEMP INT,
POPULATIONRATE INT,
POPULATION INT,
);

Section – C
(Each question carries 4 Marks)

Question 11.
Write queries (i) to (iv) based on the tables EMPLOYEE and DEPARTMENT given below
Table : EMPLOYEE

Table: DEPARTMENT

 DEPTID DEPTNAME FLOORNO D001 Personal 4 D002 Admin 10 D003 Production 1 D004 Sales 3

(i) To display the average salary of all employees, department wise.
SELECT AVG(SALARY)
FROM EMPLOYEE ,
GROUP BY DEPTID;

(ii) To display name and respective department name of each employee whose salary is more than 50000.
SELECT NAME, DEPTNAME
FROM EMPLOYEE, DEPARTMENT
WHERE ’
EMPLOYEE.DEPTID=DEPARTMENT.DEPTID
AND SALARY>50000;

(iii) To display the names of employees whose salary is not known, in alphabetical order.
SELECT NAME FROM EMPLOYEE
WHERE SALARY IS NULL
ORDER BY NAME;

(iv) To display DEPTID from the table EMPLOYEE without repetition.
SELECT DISTINCT DEPTID FROM
EMPLOYEE

Question 12.
(i) Give two advantages and two disadvantages of star topology.
Or
Define the following terms:
(a) www
(b) Web hosting
Advantages of Star Topology are:

• Ease of service All the data passes through the hub. The hub makes it easy to troubleshoot by offering a single point for error connection.
• Centralized control Computers are connected by cable segments to centralized component, called a hub or switch.

Disadvantages of Star Topology are:

• Long cable length Requires more cable than a linear bus.
• Difficult to expand Extra hardware is required (hubs or switches) which adds to cost.

Or
(a) WWW is a set of protocols that allow you to access any document on the internet through the naming systems based on URLs.
(b) Web hosting is a service that allows organizations and individuals to post a website or web page onto the server, which can be viewed by everyone on the Internet.

(ii) How is packet switching different from circuit switching?
Differences between packet switching and circuit switching are as follows:

 Packet Switching Circuit Switching It uses store and forward concept to send messages. It does not follow store and forward concept. Each data unit knows only the final receiver’s address. Each data unit knows the entire path from sender to receiver. No physical path is established in packet switching. Physical connection is established between sender and receiver.

Question 13.
BeHappy Corporation has set up its new centre at Noida, Uttar Pradesh for its office and web-based activities. It has 4 blocks of buildings.

Distance between the various blocks is as follows:

 A to B 40m B to C 120m C to D 100m A to D 170m B to D 150m A to C 70m

Numbers of computers in each block
Block A – 25
Block B – 50
Block C -125
Block D -10
(i) Suggest and draw the cable layout to efficiently connect various blocks of buildings within the Noida centre for connecting the digital devices.
Cable layout to efficiently connect various blocks

(ii) Suggest the placement of the following device with justification
(a) Repeater
(b) Hub/Switch