Back to papers
CBSE · 083Class XII

Computer Science · 2022

7 June 2022 · Term-2 paper

Questions
13
Total marks
35
Sections
3
A

Section A

14 q · 18 marks
01

"Stack is a linear data structure which follows a particular order in which the operations are performed."

- What is the order in which the operations are performed in a Stack ? - Name the List method/function available in Python which is used to remove the last element from a list-implemented stack. - Also write an example using Python statements for removing the last element of the list.

[2]
Answer

Order of operations performed in a Stack is LIFO (Last In First Out).

The List method in Python used to remove the last element from a list-implemented stack is pop() (or pop(-1)).

Example :

python
L = [10, 20, 30, 40]
L.pop()        # OR L.pop(-1)
Explanation

A stack is a LIFO data structure — the most recently pushed element is the first one popped. Python's list.pop() with no argument removes and returns the last element, mirroring stack pop. (FILO — First In Last Out — is also accepted.)

2i

Expand the following :

- VoIP - PPP

[1]
Answer

- VoIP : Voice over Internet Protocol - PPP : Point to Point Protocol

Explanation

Standard networking-protocol acronyms. VoIP carries voice traffic over IP networks; PPP is a data-link-layer protocol used over serial links and dial-up.

2ii

Riya wants to transfer pictures from her mobile phone to her laptop. She uses Bluetooth technology to connect two devices. Which type of network (PAN/LAN/MAN/WAN) will be formed in this case ?

[1]
Answer

PAN (Personal Area Network)

Explanation

Bluetooth has a short range (about 10 m) and is used for device-to-device communication within a person's immediate vicinity, which is the defining characteristic of a PAN.

03

Differentiate between the terms Attribute and Domain in the context of Relational Data Model.

[2]
Answer

- Attribute — A column/field of a table (relation). Each attribute has a name and represents one property of the entity stored in the table. - Domain — The set of permissible values from which an attribute can take its value.

Example :

NameClassMarks
aaaXII90
bbbX99

Here Name, Class and Marks are *attributes*. The attribute Class has the domain {X, XII}.

Explanation

Attribute is the column/field name; Domain is the underlying set of values that column is allowed to take.

04

Consider the following SQL table MEMBER in a SQL Database CLUB :

Table : MEMBER

M_IDNAMEACTIVITY
M1001AminaGYM
M1002PratikGYM
M1003SimonSWIMMING
M1004RakeshGYM
M1005AvneetSWIMMING

Assume that the required library for establishing the connection between Python and MySQL is already imported. Also assume that DB is the database connection object for the database CLUB.

Predict the output of the following code :

python
MYCUR = DB.cursor()
MYCUR.execute("USE CLUB")
MYCUR.execute("SELECT * FROM MEMBER WHERE ACTIVITY='GYM' ")
R = MYCUR.fetchone()
for i in range(2):
    R = MYCUR.fetchone()
    print(R[0], R[1], sep="#")
[2]
Answer
text
M1002#Pratik
M1004#Rakesh
Explanation

The SELECT returns the 3 GYM members in order: Amina, Pratik, Rakesh. The first fetchone() consumes Amina (but doesn't print). The loop then fetches and prints the next two rows — Pratik and Rakesh — joining M_ID and NAME with '#'.

5a

Table: VACCINATION_DATA

VIDNameAgeDose1Dose2City
101Jenny272021-12-252022-01-31Delhi
102Harjot552021-07-142021-10-14Mumbai
103Srikanth432021-04-182021-07-20Delhi
104Gazala752021-07-31NULLKolkata
105Shiksha322022-01-01NULLMumbai

Write the output of the SQL query: SELECT Name, Age FROM VACCINATION_DATA WHERE Dose2 IS NOT NULL AND Age > 40;

[1]
Answer
NameAge
Harjot55
Srikanth43
Explanation

Selects records where Dose2 is not null and Age is greater than 40.

5b

Write the output of the SQL query: SELECT City, COUNT(*) FROM VACCINATION_DATA GROUP BY City;

[1]
Answer
CityCOUNT(*)
Delhi2
Mumbai2
Kolkata1
Explanation

Groups the data by City and counts the number of records for each city.

5c

Write the output of the SQL query: SELECT DISTINCT City FROM VACCINATION_DATA;

[1]
Answer
City
Delhi
Mumbai
Kolkata
Explanation

Selects unique City names from the table.

5d

Write the output of the SQL query: SELECT MAX(Dose1), MIN(Dose2) FROM VACCINATION_DATA;

[1]
Answer
MAX(Dose1)MIN(Dose2)
2022-01-012021-07-20
Explanation

Finds the latest date in Dose1 and the earliest date in Dose2.

6a

Table: DOCTOR

DNODNAMEFEES
D1AMITABH1500
D2ANIKET1000
D3NIKHIL1500
D4ANJANA1500

Table: PATIENT

PNOPNAMEADMDATEDNO
P1NOOR2021-12-25D1
P2ANNIE2021-11-20D2
P3PRAKASH2020-12-10NULL
P4HARMEET2019-12-20D1

Write the output of the SQL query: SELECT DNAME, PNAME FROM DOCTOR NATURAL JOIN PATIENT;

[1]
Answer
DNAMEPNAME
AMITABHNOOR
ANIKETANNIE
AMITABHHARMEET
Explanation

Performs a natural join on the common column DNO and selects Doctor and Patient names.

6b

Table: DOCTOR

DNODNAMEFEES
D1AMITABH1500
D2ANIKET1000
D3NIKHIL1500
D4ANJANA1500

Table: PATIENT

PNOPNAMEADMDATEDNO
P1NOOR2021-12-25D1
P2ANNIE2021-11-20D2
P3PRAKASH2020-12-10NULL
P4HARMEET2019-12-20D1

Write the output of the SQL query: SELECT PNAME, ADMDATE, FEES FROM PATIENT P, DOCTOR D WHERE D.DNO = P.DNO AND FEES > 1000;

[1]
Answer
PNAMEADMDATEFEES
NOOR2021-12-251500
HARMEET2019-12-201500
Explanation

Joins the tables on DNO and filters for records where Fees are greater than 1000.

07

Differentiate between Candidate Key and Primary Key in the context of Relational Database Model.

[2]
Answer

Candidate Key: A table may have more than one or a combination of attribute(s) that identifies a tuple uniquely. All such attribute(s) are known as Candidate Keys. Primary Key: Out of all the Candidate keys, the most appropriate one, which is used for unique identification of the Tuples, is called the Primary Key.

Explanation

Candidate Keys are all possible unique identifiers; the Primary Key is the specific one chosen to identify rows.

7a(or)

Consider the following table PLAYER : Table : PLAYER

PNONAMESCORE
P1RISHABH52
P2HUSSAIN45
P3ARNOLD23
P4ARNAV18
P5GURSHARAN42

Identify and write the name of the most appropriate column from the given table PLAYER that can be used as a Primary key.

[1]
Answer

PNO

Explanation

PNO (Player Number) is the unique identifier for each player in the table.

7b(or)

Consider the following table PLAYER : Table : PLAYER

PNONAMESCORE
P1RISHABH52
P2HUSSAIN45
P3ARNOLD23
P4ARNAV18
P5GURSHARAN42

Define the term Degree in relational data model. What is the Degree of the given table PLAYER ?

[1]
Answer

Degree: Total number of columns/attributes in a table/relation is known as its Degree. The Degree of the given table is 3.

Explanation

Degree refers to the number of columns. The table has 3 columns: PNO, NAME, SCORE.

B

Section B

7 q · 12 marks
08

Write the definition of a user defined function PushNV(N) which accepts a list of strings in the parameter N and pushes all strings which have no vowels present in it, into a list named NoVowel.

Write a program in Python to input 5 words and push them one by one into a list named All. The program should then use the function PushNV() to create a stack of words in the list NoVowel so that it stores only those words which do not have any vowel present in it, from the list All. Thereafter, pop each word from the list NoVowel and display the popped word. When the stack is empty display the message 'EmptyStack'.

[3]
Answer
python
def PushNV(N):
    for W in N:
        for C in W:
            if C.upper() in 'AEIOU':
                break
        else:
            NoVowel.append(W)

All = []
NoVowel = []
for i in range(5):
    All.append(input('Enter a Word: '))
PushNV(All)
while NoVowel:
    print(NoVowel.pop(), end=' ')
else:
    print('EmptyStack')
Explanation

The code iterates through the input list, checks each word for vowels using a for-else construct, and pushes vowel-free words onto the stack. The while-else then pops every word and prints 'EmptyStack' when done.

08(or)

Write the definition of a user defined function Push3_5(N) which accepts a list of integers in a parameter N and pushes all those integers which are divisible by 3 or divisible by 5 from the list N into a list named Only3_5.

Write a program in Python to input 5 integers into a list named NUM. The program should then use the function Push3_5() to create the stack of the list Only3_5. Thereafter pop each integer from the list Only3_5 and display the popped value. When the list is empty, display the message 'StackEmpty'.

[3]
Answer
python
def Push3_5(N):
    for i in N:
        if i%3 == 0 or i%5 == 0:
            Only3_5.append(i)

NUM = []
Only3_5 = []
for i in range(5):
    NUM.append(int(input('Enter an Integer: ')))
Push3_5(NUM)
while Only3_5:
    print(Only3_5.pop(), end=' ')
else:
    print('StackEmpty')
Explanation

The function checks each integer for divisibility by 3 or 5 and pushes matching values onto the stack. The while-else then pops and displays each value, printing 'StackEmpty' when the stack is exhausted.

9i

A SQL table ITEMS contains the following columns : INO, INAME, QUANTITY, PRICE, DISCOUNT Write the SQL command to remove the column DISCOUNT from the table.

[1]
Answer

ALTER TABLE ITEMS DROP COLUMN DISCOUNT;

Explanation

Uses ALTER TABLE to modify the structure and DROP COLUMN to remove the specific column.

9ii

Categorize the following SQL commands into DDL and DML : CREATE, UPDATE, INSERT, DROP

[2]
Answer

DDL Commands : CREATE, DROP DML Commands : INSERT, UPDATE

Explanation

DDL commands define structure (Create, Drop), while DML commands manipulate data (Insert, Update).

10a

Rohan is learning to work upon Relational Database Management System (RDBMS) application. Help him to perform following tasks : (a) To open the database named 'LIBRARY'.

[1]
Answer

USE LIBRARY ;

Explanation

The USE command is used to select and open a specific database.

10b

Rohan is learning to work upon Relational Database Management System (RDBMS) application. Help him to perform following tasks : (b) To display the names of all the tables stored in the opened database.

[1]
Answer

SHOW TABLES;

Explanation

SHOW TABLES lists all the tables present in the currently selected database.

10c

Rohan is learning to work upon Relational Database Management System (RDBMS) application. Help him to perform following tasks : (c) To display the structure of the table 'BOOKS' existing in the already opened database 'LIBRARY'.

[1]
Answer

DESCRIBE BOOKS ;

Explanation

DESCRIBE (or DESC) command shows the columns, types, and constraints of a table.

C

Section C

11 q · 14 marks
11a

Table: PASSENGER

PNONAMEGENDERFNO
1001SureshMALEF101
1002AnitaFEMALEF104
1003HarjasMALEF102
1004NitaFEMALEF103

Table: FLIGHT

FNOSTARTENDF_DATEFARE
F101MUMBAICHENNAI2021-12-254500
F102MUMBAIBENGALURU2021-11-204000
F103DELHICHENNAI2021-12-105500
F104KOLKATAMUMBAI2021-12-204500
F105DELHIBENGALURU2021-01-155000

Write a query to change the fare to 6000 of the flight whose FNO is F104.

[1]
Answer

UPDATE FLIGHT SET FARE=6000 WHERE FNO='F104';

Explanation

UPDATE command modifies existing records. SET specifies the new value, WHERE identifies the row.

11b

Table: PASSENGER

PNONAMEGENDERFNO
1001SureshMALEF101
1002AnitaFEMALEF104
1003HarjasMALEF102
1004NitaFEMALEF103

Table: FLIGHT

FNOSTARTENDF_DATEFARE
F101MUMBAICHENNAI2021-12-254500
F102MUMBAIBENGALURU2021-11-204000
F103DELHICHENNAI2021-12-105500
F104KOLKATAMUMBAI2021-12-204500
F105DELHIBENGALURU2021-01-155000

Write a query to display the total number of MALE and FEMALE PASSENGERS.

[1]
Answer

SELECT GENDER, COUNT(*) FROM PASSENGER GROUP BY GENDER;

Explanation

Groups the passengers by GENDER and counts the occurrences of each group.

11c

Table: PASSENGER

PNONAMEGENDERFNO
1001SureshMALEF101
1002AnitaFEMALEF104
1003HarjasMALEF102
1004NitaFEMALEF103

Table: FLIGHT

FNOSTARTENDF_DATEFARE
F101MUMBAICHENNAI2021-12-254500
F102MUMBAIBENGALURU2021-11-204000
F103DELHICHENNAI2021-12-105500
F104KOLKATAMUMBAI2021-12-204500
F105DELHIBENGALURU2021-01-155000

Write a query to display the NAME, corresponding FARE and F_DATE of all PASSENGERS who have a flight to START from DELHI.

[1]
Answer

SELECT NAME, FARE, F_DATE FROM PASSENGER P, FLIGHT F WHERE F.FNO= P.FNO AND START = 'DELHI';

Explanation

Joins PASSENGER and FLIGHT tables on FNO and filters results where START is 'DELHI'.

11d

Table: PASSENGER

PNONAMEGENDERFNO
1001SureshMALEF101
1002AnitaFEMALEF104
1003HarjasMALEF102
1004NitaFEMALEF103

Table: FLIGHT

FNOSTARTENDF_DATEFARE
F101MUMBAICHENNAI2021-12-254500
F102MUMBAIBENGALURU2021-11-204000
F103DELHICHENNAI2021-12-105500
F104KOLKATAMUMBAI2021-12-204500
F105DELHIBENGALURU2021-01-155000

Write a query to delete the records of flights which end at Mumbai.

[1]
Answer

DELETE FROM FLIGHT WHERE END = 'MUMBAI';

Explanation

DELETE command removes rows where the END column matches 'MUMBAI'.

12i

Differentiate between Bus Topology and Tree Topology. Also, write one advantage of each of them.

[2]
Answer

Bus Topology: In bus topology, each communicating device connects to a single transmission medium, known as bus. Advantage: It is very cost-effective.

Tree Topology: It is a hierarchical topology, in which there are multiple branches and each branch can have one or more basic topologies like star, ring and bus. Advantage: It is easier to set-up multi-level plans for the network.

Explanation

Bus topology uses a single backbone cable, while Tree topology is hierarchical. Bus is cheap; Tree handles expansion well.

12i(or)

Differentiate between HTML and XML.

[2]
Answer

HTML: It stands for HyperText Markup Language. It contains predefined tags which are used to design webpages. XML: It stands for eXtensible Markup Language. It contains user defined tags to describe and store the data.

Explanation

HTML is used for displaying data on web pages, while XML is used for storing and transporting data.

12ii

What is a web browser ? Write the names of any two commonly used web browsers.

[2]
Answer

A Web browser is a software/tool, which allows us to view/access the content of WebPages. Examples: Google Chrome, Microsoft Edge, Mozilla Firefox.

Explanation

A web browser is a client application for retrieving and displaying information from the World Wide Web.

13a

Galaxy Provider Ltd. is planning to connect its office in Texas, USA with its branch at Mumbai. The Mumbai branch has 3 Offices in three blocks located at some distance from each other for different operations – ADMIN, SALES and ACCOUNTS.

As a network consultant, you have to suggest the best network-related solutions for the issues/problems raised in (a) to (d), keeping in mind the distances between various locations and other given parameters.

Layout of the Offices in the Mumbai branch:

Shortest distances: ADMIN to SALES: 300 m SALES to ACCOUNTS: 175 m ADMIN to ACCOUNTS: 350 m MUMBAI to TEXAS: 14000 km

Computers: ADMIN: 255 ACCOUNTS: 75 SALES: 30 TEXAS: 90

(a) It is observed that there is a huge data loss during the process of data transfer from one block to another. Suggest the most appropriate networking device out of the following, which needs to be placed along the path of the wire connecting one block office with another to refresh the signal and forward it ahead.

[1]
Answer

(c) REPEATER

Explanation

A Repeater regenerates the received signal and retransmits it to extend the transmission distance.

13b

(b) Which hardware networking device out of the following, will you suggest to connect all the computers within each block ?

[1]
Answer

(a) SWITCH

Explanation

A Switch connects devices within a network (LAN) and filters/forwards packets between them.

13c

(c) Which service/protocol out of the following will be most helpful to conduct live interactions of employees from Mumbai Branch and their counterparts in Texas ?

[1]
Answer

(d) VoIP

Explanation

VoIP (Voice over Internet Protocol) allows for voice communications and multimedia sessions over Internet Protocol networks.

13d

(d) Draw the cable layout (block to block) to efficiently connect the three offices of the Mumbai branch.

[1]
Answer
End of paper
Source · CBSE Class XII Computer Science (083) · 2022