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
Time: 2 Hours
Maximum Marks: 35
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
(2 Marks Each)
Question 1.
Give any two characteristics of stacks.
Answer:
Characteristics of Stacks:
- The insertion and deletion happens at one end i.e. from the top of the stack
- Stack is a linear data structure based on LIFO (Last In First Out) order
Question 2.
(a) Expand the following:
SMTP , XML
Answer:
- SMTP: Simple Mail Transfer Protocol
- XML: Extensible Mark Up Language
(b) Out of the following, which is the fastest wired and wireless medium of transmission?
Infrared, coaxial cable, optical fibre, microwave, Ethernet cable
Answer:
Wired: Optical Fibre Wireless: Microwave
Question 3.
Differentiate between char(n) and varchar(n) data types with respect to databases.
Answer:
char(n):
- Â Stores a fixed length string between 1 and 255 characters.
- Â If the value is of smaller length, adds blank spaces.
- Â Some space is wasted.
varchar(n):
- Stores a variable length string.
- No blanks are added even if value is of smaller length.
- No wastage of space.
Question 4.
A result set is extracted from the database using the cursor object (that has been already created) by giving the following statement.
My data = cursor. fetchone()
(a) How many records will be returned by fetchone() method?
Answer: One record
(b) What will be the datatype of Mydata object after the given command is executed?
Answer: Tuple
Question 5.
Write the output of the queries (a) to (d) based on the table, Furniture given below:
FID | NAME | DATE OF PURCHASE | COST | DISCOUNT |
B001 | Double Bed | 03-Jan-2018 | 45000 | 10 |
T010 | Dining Table | 10-Mar-2020 | 51000 | 5 |
B004 | Single Bed | 19-Ju 1-2021 | 22000 | 0 |
C003 | Long Back Chair | 30-Dec-2016 | 12000 | 3 |
T006 | Console Table | 17-Nov-2019 | 15000 | 12 |
B006 | Bunk Bed | 01-Jan-2021 | 28000 | 14 |
(a) SELECT SUM (DISCOUNT)
FROM FURNITURE WHERE COST>15000;
Answer: 29
(b) SELECT MAX(DATEOFPURCHASE)
FROM FURNITURE;
Answer: 19 – July – 2021
(c) SELECT * FROM FURNITURE
WHERE DISCOUNTS AND FID LIKE “T%”;
Answer:
T006 | Console Table | 17-Nov-2019 | 15000 | 12 |
(d) SELECT DATEOFPURCHASE FROM FURNITURE
WHERE NAME IN (“Dining Table”, “Console Table”);
Answer:
- 10-Mar-2020
- 17-Nov-2019
Question 6.
a) Which command is used to view the list of tables in a database?
Answer:
SHOW TABLES;
(b) Give one point of difference between an equi-join and a natural join.
Answer:
Equi- join:
- The join in which columns from two tables are compared for equality.
- Duplicate columns are shown.
Natural Join:
- The join in which only one of the identical columns existing in both tables is present.
- No duplication of columns.
Question 7.
Consider the table, MOVIEDETAILS given below:
Table of MovieDetails
MOVIEID | TITLE | LANGUAGE | RATING | PLATFORM |
M001 | Minari | Korean | 5 | Netflix |
M004 | MGR Magan | Tamil | 4 | Hotstar |
M010 | Kaagaz | Hindi | 3 | Zee5 |
M011 | Harry Potter and the Chamber of Secrets | English | 4 | Prime Video |
M015 | Uri | Hindi | 5 | Zee5 |
M020 | Avengers: Endgame |
English | 4 | Hotstar |
(a) Identify the degree and cardinality of the table.
Answer:
- Degree: 5
- Cardinality: 6
(b) Which field should be made the primary key? Justify your answer.
Answer:
MOVIEID should be made the primary key as it uniquely identifies each record of the table.
OR
(a) Identify the candidate key(s) from the table MOVIEDETAILS.
Answer:
MOVIEID AND TITLE
(b) Consider the table SCHEDULE given below:
Table of Schedule
SLOTID | MOVIED | TIMESLOT |
S001 | M010 | 10 AM To 12PM |
S002 | M020 | 2PM To 5PM |
S003 | M010 | 6PM To 8PM |
S004 | M011 | 9PM To 11PM |
Which field will be considered as the foreign key if the tables MOVIEDETAILS and SCHEDULE are related in a database.
Answer:
MOVIEID
Section – B
(3 Marks Each)
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, “JAI”:45, “BOB”:89, “ALI”:65, “ANU”:90,
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 following 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
Answer:
# Question No 8 (first option)
R={“OM”:7 6, “JAI”:45, “BOB”:89, “ALI”:65, “ANU”:90, “TOM”:82} def PUSH(S,N):
S.append(N) def POP(S): if S! = [] :
return S.popO 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.popO else:
return None
ST=[]
for k in N: if k%2==0:
PUSH(ST,k) while True:
if ST!=[]:
print (POP(ST),end=” “) else: break
Question 9.
(a) 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.
Answer:
ALTER TABLE Item ADD (Discount INT);
(b) Categorize following commands into DDL and DML commands?
INSERT INTO, DROP TABLE, ALTER TABLE, UPDATE, SET
Answer:
- DDL: DROP TABLE, ALTER TABLE
- DML: 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 | DATATYPE | REMARKS |
CITY CODE | CHAR(5) | Primary Key |
CITY NAME | CHAR(30) | |
SIZE | INTEGER | |
AVGTEMP | INTEGER | |
POLUTION RATE | INTEGER | |
POPULATION | INTEGER |
Help her to complete the task by suggesting appropriate SQL commands.
Answer:
CREATE DATABASE MYEARTH;
CREATE TABLE CITY
(
CITYCODE CHAR(5)PRIMARY KEY,
CITYNAME CHAR(30),
SIZE INT,
AVGTEMP INT,
POPULATIONRATE INT,
POPULATION INT,
) ;
Section – C
(4 Marks Each)
Question 11.
Write queries (a) to (d) based on the tables EMPLOYEE and DEPARTMENT given below:
Table: EMPLOYEE
EMPID | NAME | Â Â Â DOB | DEPITED | DESIG | SALARY |
120 | Alisha | 23-Jan-1978 | D001 | Manager | 75000 |
123 | Nitin | 10-Oct-1977 | D002 | AO | 59000 |
129 | Navjot | 12-Jul-1971 | D003 | Supervisor | 40000 |
130 | Jimmy | 30-Dec-1980 | D004 | Sales Rep | |
131 | Faiz | 06-Apr-1984 | D001 | Dep Manager 65000 |
Table: DEPARTMENT
DEPITED | DEPTNAME | FLOOORNO |
D001 | Personal | 4 |
D002 | Admin | 10 |
D003 | Production | 1 |
D004 | Sales | 3 |
(a) To display the average salary of all employees, department wise.
Answer:
- SELECT AVG (SALARY)
- FROM EMPLOYEE
- GROUP BY DEPTID;
(b) To display name and respective department name of each employee whose salary is more than 50000.
Answer:
- SELECT NAME, DEPTNAME FROM EMPLOYEE, DEPARTMENT WHERE
- EMPLOYEE.DEPTID=
- DEPARTMENT.DEPTID
- AND SALARY>50000;
(c) To display the names of employees whose salary is not known, in alphabetical order.
Answer:
- SELECT NAME FROM EMPLOYEE
- WHERE SALARY IS NULL
- ORDER BY NAME;
(d) To display DEPTID from the table EMPLOYEE without repetition.
Answer:
SELECT DISTINCT DEPTID FROM EMPLOYEE;
Question 12.
(a) Give two advantages and two disadvantages of star topology.
OR
Define the following terms: WWW, Web hosting
Answer:
Advantages
- Ease of service.
- Centralized control.
- Easy to diagnose faults.
- One device per connection.
Disadvantages
- Long cable length.
- Difficult to expand.
- Central node dependency.
OR
WWW: A set of protocols that allow you to access any document on the internet through the naming systems based on URLs.
Web hosting:
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.
(b) How is Packet Switching different from Circuit Switching?
Answer:
Packet switching:
- Uses store and forward concept to send messages.
- No physical path is actually establishes.
- Message is divided into smaller parts, known as packets and then sent forward.
- Tight upper limit on block size.
- Each data unit knows only the final receiver’s address.
Circuit switching:
- Physical connection is established between sender and receiver.
- Each data unit knows the entire path from sender to receiver.
- Â It does not follow store and forward concept.
Question 13.
Be Happy 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Â Â 40 m
B to CÂ Â Â 120 m
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
(a) Suggest and draw the cable layout to efficiently connect various blocks of buildings within the Noida centre for connecting the digital devices.
Answer:
(b) Suggest the placement of the following device with justification:
(i) Repeater
(ii) Hub/Switch
Answer:
- Repeater: between C and D as the distance between them is 100 mts.
- Hub/ Switch: In each block as they help to share data packets within the devices of the network in each block.
(c) Which kind of network (PAN/LAN/WAN) will be formed if the Noida office is connected to its head office in Mumbai?
Answer:
WAN
(d) Which fast and very effective wireless transmission medium should preferably be used to connect the head office at Mumbai with the centre at Noida?
Satellite