Sample Question Paper 1: Class Xii Computer Science (083) Term Ii
Sample Question Paper 1: Class Xii Computer Science (083) Term Ii
CLASS XII
COMPUTER SCIENCE (083)
TERM II
Maximum Marks: 35 Time Allowed: 2 Hours
General Instructions:
1. The question paper is divided into 3 sections – A, B and C.
2. Section A consists of 7 questions (1–7). Each question carries 2 marks.
3. Section B consists of 3 questions (8–10). Each question carries 3 marks.
4. Section C consists of 3 questions (11–13). Each question carries 4 marks.
5. Internal choices have been given for question numbers 1, 3, 8 and 12.
Section A
Each question carries 2 marks
1. What is a stack? Write two operations that can be performed on the stack. 2
Ans. A stack is a basic data structure that follows the Last In First Out (LIFO) principle where insertion and
deletion of data take place at one end called the top of the stack. The two operations that can be
performed on the stack are:
(i) PUSH – to insert an element
(ii) POP – to delete an element from the stack.
2. (i) Expand the following terms: 1
VoIP, NIC
Ans. VoIP: Voice over Internet Protocol
NIC: Network Interface Card
(ii) Which device is used to regenerate the weak signals for long-distance transmission? 1
Ans. Repeater
3. Consider a table ‘Online_Class’ with the following structure: 2
Meeting_Id Date_of_Class Student_Name Charges
121100991 2022-01-12 Kavya Sethi 500.00
(i) Identify the data types of Date_of_Class and Charges columns.
(ii) If a column ‘passcode’ contains only 4 letters password information like ‘1#a4’ then out of char or
varchar,which data type is suitable for this column. Justify your answer.
Sample Question Paper 1 Term II
A.1
5. Write the output of the queries (i) to (iv) based on the table Product given below: 2
PId P_Name P_Price P_Qty Date_Of_Purchase
P001 Keyboard 800 3 2022-01-01
P002 Mouse 380 6 2021-12-23
P003 Speaker 1800 3 2022-01-01
P004 Headphone 1000 6 2021-10-02
P005 Stylus 3000 2 2022-01-19
(i) Select P_Name, P_Price from Product Where P_Price>1500;
(ii) Select PId, P_Name, P_Price * P_Qty from Product Where P_Name Like ‘%e’;
(iii) Select Max(Date_Of_Purchase) from Product Where P_Price>500;
(iv) Select Sum(P_Price) from Product Where P_Price * P_Qty >3000;
Ans. (i)
P_Name Price
Speaker 1800
Stylus 3000
(ii)
PID P_Name P_Price * P_Qty
P002 Mouse 2280
P004 Headphone 6000
(iii)
Max(Date_Of_Purchase)
2022-01-19
(iv)
Sum(P_Price)
5800
6. (i) Which command is used to create a database in SQL? 1
Ans. create database <database_name>;
(ii) How will you calculate columns and rows in a cross join? 1
Ans. The total number of columns in the resultant table is the sum of the number of columns and the total
number of rows is the product of the number of rows in all tables.
7. Consider the table Employee with the following records: 2
Emp_ID Emp_Name Designation Salary Date_of_Joining
E101 Kanishk Arya Manager 80000 2010-09-01
Computer Science with Python–XII
A.2
Consider the table PF_Details and answer the following questions:
PF_No Date_of_Birth email-id Emp_ID
12255 1990-09-09 [email protected] E101
13366 1991-10-08 [email protected] E102
11188 1994-01-02 [email protected] E103
55599 1997-02-09 [email protected] E104
(i) Identify the Primary and Foreign keys of table PF_Details if the Employee table given above is linked to
this table.
(ii) Can we delete the record of any employee from the table PF_Details?
Ans. (i) Inserting a new row in the table Employee gives an error because we are trying to insert a duplicate
value ‘E104’ in the column Emp_ID that is already present in the table and Emp_ID is the primary
key of the table that cannot accept duplicate value for this column.
(ii) Cardinality -7
Degree – 5
OR
(i) The Primary key of the table PF_Details is PF_No and the Foreign key is Emp_ID.
(ii) No, we cannot delete the record of any employee from the table because of referential integrity. In
table PF_Details, the column Emp_ID is the Foreign key which is linked to the table Employee that
rejects the deletion operation in the PF_Details table.
Section – B
Each question carries 3 marks
8. Pankaj has to create a record of books containing BookNo, BookName and BookPrice. Write a user-
defined function to create a stack and perform the following operations: 3
• Input the Book No, BookName and BookPrice from the user and Push into the stack.
• Display the status of stack after each insertion.
OR
Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this list push all numbers
divisible by 3 into a stack implemented using a list. Display the stack if it has at least one element,
otherwise display appropriate error message.
Ans. def Book(st):
bookid=input(‘Enter Book id’)
bookname=input(‘Enter book name’)
bookPrice=int(input(‘Enter book Price’))
st.append([bookid,bookname,bookPrice])
i=len(st-1)
while i>0:
Sample Question Paper 1 Term II
print(st[i])
i-=1
OR
Ans.
def PUSH(Arr):
s=[]
for x in range(0,len(Arr)):
if Arr[x]%3==0:
s.append(Arr[x])
if len(s)==0:
print("Empty Stack")
else:
A.3
print(s)
9. (i) A table Voter_list is created with the following columns: 1
V_ID, V_Name, V_Address, V_Age, V_AreaCode, V_Gender, V_Phone_No
Write an SQL command to delete column V_Phone_No from the table Voter_list.
Ans. Alter Table Voter_list
Drop V_Phone_No;
(ii) Differentiate between Alter and Update commands with the help of examples. 2
Ans.
Alter Command Update Command
(i) It is used to change the columns of the (i) It is used to change the records of the table
existing table such as: adding a new specified by a condition.
column, deleting a column, renaming
a column name and changing the data
type of the column.
(ii) It is a DDL command. (ii) It is a DML command.
(iii) For example, to add a new column (iii) For example, to change the records of student
in a table, Update Student
Alter table student Set Marks=Marks+5;
Add Contact_No Varchar (20);
10. Rashmi has to create a table in SQL to store the records of students and their projects submission
information. The structure of the table Project_Info is: 3
Table: Project_Info
Field Name Data Type Size Remarks
Stud_Roll_No Integer 8
Name Varchar 30 NOT NULL
Project_Name Varchar 35
No_of_Students Integer 3
Help Rashmi to complete the following tasks:
(i) To create the table Project_Info.
(ii) She has forgotten to add the Primary key to this table. Write a command to add Primary key to column
Stud_Roll_No.
Ans. (ii) Create Table Project_Info(
Stud_Roll_No integer(8),
Name varchar(30) NOT NULL,
Project_Name varchar(35),
No_of_Students integer(3));
(ii) Alter Table Project_Info
Computer Science with Python–XII
is used by the client to view websites. Examples of web browsers—Google Chrome, Firefox, Microsoft
Edge, Safari, Opera, etc.
Protocol: A protocol means the rules that are applicable for a network, or a common set of rules used
for communication in the network. Some of the examples of protocols are FTP, SMTP, TCP/IP, etc.
(ii) Differentiate between Client-Server and Peer-to-Peer networks. 2
Client-Server networks: In Client-Server network, multiple clients, or workstations, are connected
to at least one central server. A server is a powerful computer with all applications and hardware
installed in it and a client is a computer which is seeking any resource from another computer.
When clients need access to these resources, they access them from the server. This network is
used for larger networks.
A.5
Peer-to-Peer networks: In Peer-to-Peer network, all nodes in the network have equivalent capability
and function as both client and server. In this network, all workstations are connected together
for sharing devices, information or data. This network is ideal for small networks where there is no
need for dedicated servers.
13. Bright Study University is setting up its academic centres in Gurugram and planning to set up a network.
The university has 3 academic centres and one administration centre as shown in the diagram given
below: 4
A.6
SAMPLE QUESTION PAPER 2
CLASS XII
COMPUTER SCIENCE (083)
TERM II
Maximum Marks: 35 Time Allowed: 2 Hours
General Instructions:
1. The question paper is divided into 3 sections – A, B and C.
2. Section A consists of 7 questions (1-7). Each question carries 2 marks.
3. Section B consists of 3 questions (8-10). Each question carries 3 marks.
4. Section C consists of 3 questions( 11-13). Each question carries 4 marks.
5. Internal choices have been given for question numbers – 1, 3, 8 and 12.
Section A
1. Write the name of the operations that can be applied on stacks. Also write the name of functions that
are used to perform the task. 2
Ans. In stack, inserting an element is known as Pushing which is done by append() function and deleting an
element is known as Popping which is accomplished by pop() or del function.
2. (i) Expand the following terms: 1
MAC, TCP/IP
Ans. MAC: Media Access Control
TCP/IP: Transmission Control Protocol/Internet Protocol
(ii) Which device is used to convert the analog signal into digital and vice versa? 1
Ans. MODEM (Modulator-Demodulator)
3. Differentiate between Primary and Foreign key. 2
Ans. Primary Key: A primary key is a set of one or more attributes/fields which uniquely identifies a tuple/row
in a table. It does not allow duplicate values in a relation.
It cannot be re-declared or left null. One table can have only one primary key; however, primary key can
be a combination of more than one field.
Foreign Key: A foreign key is a non-key attribute whose value is derived from the primary key of another
table; in other words, a primary key in some other table having relationship with the current or original
table.
4. Explain any two methods through which we can extract records from a resultset? 2
Ans. fetchone(): It fetches the next row from the active result set.
fetchall(): It fetches all the rows in a result set and returns a list of tuples. If some rows have already
Sample Question Paper 2 Term II
been extracted from the result set, then it retrieves the remaining rows. If no more rows are available,
it returns an empty list.
5. Write the output of the queries (i) to (iv) based on the table Employee given below: 2
Ecode Name Salary Job City
E1 Ritu Jain 50000 Manager Delhi
E2 Vikas Verma 45000 Executive Jaipur
E3 Rajat Chaudhary 30000 Clerk Delhi
E4 Leena Arora 45000 Manager Bangalore
E5 Shikha Sharma 50000 Accountant Kanpur
A.1
(i) Select Ecode, Name, Max(Salary) from Employee Where City=’Delhi’;
(ii) Select Name, job from Employee Where Salary Between 40000 and 50000 ;
(iii) Select AVG(Salary) from Employee Where Job In (‘Manager’,‘Executive’, ’Clerk’);
(iv) Select Sum(Salary) from Employee Where Name Like ‘%a’;
Ans. (i)
Ecode Name Max(Salary)
E1 Ritu Jain 50000
(ii)
Name Job
Ritu Jain Manager
Vikas Verma Executive
Leena Arora Manager
Shika Sharma Accountant
(iii)
AVG(Salary)
42500.0
(iv)
Sum(Salary)
140000
6. (i) Write a command to delete all rows from the table ‘Student’. 1
Ans. Delete from Student;
(ii) Which type of join is depicted in the following SQL statement? 1
Select P.PNo, P.Product_Name, Pr.P_Price
From Product P, Price Pr
Where P.PNo=Pr.PNo;
Ans. The join depicted in the SQL statement is equi join.
7. Consider the table Employee with the following records: 2
Table: Employee
ECODE NAME DESIG SGRADE DOJ DOB
101 Sneha EXECUTIVE S01 2003-03-23 1980-01-13
Bhardwaj
102 Ravi Chander HEAD-IT S02 2010-02-12 1987-07-22
103 Sunita Kumari RECEPTIONIST S03 2009-06-20 1983-02-24
Computer Science with Python–XII
Section – B
Each question carries 3 marks
8. Shruti has created a dictionary that stores Product names as key and price as values. Write a user-defined
function to perform the following operations: 3
• Push the values into the stack if the price of products is greater than 100.
• Pop and display the contents of the stack.
For example, if the content of the dictionary is as follows:
product={‘Book’:250, ‘Pen’:120, ‘Pencil’:50, ‘Notebook’:400, ‘Register’:480}
The elements of the stack should be:
[250, 120, 400, 480]
OR
Prateek has created a list arr with some elements. Help him to create a user-defined function to perform
the following tasks:
• Create a stack after checking the elements if it is even then multiply by 2 and if the element is odd, then
multiply it by 3.
• Pop and display the contents of the stack.
Sample Input Data of the list arr = [2,3,4,5,6,7,8,9,10]
Output stack: NewSt = [4, 9, 8, 15,12, 21, 16, 27,20]
Ans. product={'Book':250, 'Pen':120, 'Pencil':50, 'Notebook':400, 'Register':480}
def push(st,a):
st.append(a)
print(st)
def pop(st):
if st==[]:
print('Underflow')
Sample Question Paper 2 Term II
else:
print(st.pop(0))
st=[]
for i,j in product.items():
if j>100:
push(st,j)
while True:
if st!=[]:
print(pop(st),end=" ")
else:
break A.3
OR
Ans. def push(NewSt,arr):
for i in arr:
if i%2==0:
NewSt.append(i*2)
else:
NewSt.append(i*3)
print(NewSt)
def pop(st):
if st==[]:
print('Underflow')
else:
print(st.pop(0))
arr=[2,3,4,5,6,7,8,9,10]
NewSt=[]
push(NewSt,arr)
while True:
if NewSt!=[]:
print(pop(NewSt),end=" ")
else:
break
9. (i) A table Transport is created with the following columns: 1
Bus_No, Bus_route, Area, No_of_students, Helper_Name, Charges
Write an SQL command to increase the Bus charges by 12% for all students.
Ans. Update Transport
Set Charges = Charges*0.12;
(ii) Identify the commands and categorize them into DDL and DDL commands. 2
(i) To add a new row into the table.
(ii) To modify the datatype of the column of a table.
Ans. (i) Insert Into command – DML command
Computer Science with Python–XII
A.4
(i) Write SQL command to create table Student.
(ii) Write SQL command to delete column Hobby.
Ans. (i) Create Table Student(
RollNo integer(4) Primary Key,
SName varchar(25) NOT NULL,
Gender char(1)NOT NULL,
DOB Date NOT NULL,
Fees integer(4) NOT NULL,
Hobby varchar(15) Null);
(ii) Alter Table Student
Drop Hobby;
SECTION C
Each question carries 4 marks
11. Consider the following tables Product and Client. Write SQL commands for the statements (i) to (iv). 4
Table: Product
P_ID ProductName Manufacturer Price Discount
TP01 Talcum Powder LAK 40 NULL
FW05 Face Wash ABC 45 5
BS01 Bath Soap ABC 55 NULL
SH06 Shampoo XYZ 120 10
FW12 Face Wash XYZ 95 NULL
Table: Client
C_ID ClientName City P_ID
01 Cosmetic Shop Delhi TP01
02 Total Health Mumbai FW05
03 Live Life Delhi BS01
04 Pretty Woman Delhi SH06
05 Dreams Delhi FW12
(i) To display ProductName, Price and ClientName city-wise.
(ii) To display the sum of the price of all products where there is no discount.
(iii) To display the name of products with the maximum price manufacturer-wise.
(iv) To count the total number of different manufacturers.
Ans. (i) Select P.ProductName, P.Price, C.ClientName from Product P, Client C Where
P.P_ID = C.P_ID Group By City;
(ii) Select Sum(Price) from Product Where Discount=NULL;
Sample Question Paper 2 Term II
A.5
Hub/Switch
Star topology
OR
Wi-fi: Wi-Fi is the wireless technology used to connect computers, tablets, smartphones and other devices
to the internet wirelessly using microwaves.
FTP: FTP stands for File Transfer Protocol. It is a network protocol for transmitting files between computers
over Transmission Control Protocol/Internet Protocol (TCP/IP) connections. It is also used to download
new applications via web browsers.
(ii) Differentiate between Router and Gateway. 2
Router: Routers operate in the physical, data link and network layers of the OSI model. They decide the
path a packet should take. A router is a networking device whose software and hardware are usually
tailored to the tasks of routing and forwarding data packets across the network.
Gateway: A gateway operates on all the seven layers of the OSI model. A network gateway is a computer
that has internet-working capability of joining together two networks that use different base
protocols. The gateway converts one protocol to another and can, therefore, connect two dissimilar
networks.
13. The University of Correspondence in Allahabad is setting up a network between its different wings. There
are 4 wings named Science (S), Journalism (J), Arts (A) and Home Science (H). 4
Science Journalism
A.6
(a) Suggest and draw a cable layout to efficiently connect various wings of the building within the university.
(b) Name the wing where the Server is to be installed. Justify your answer.
(c) Suggest the placement of the Repeater in the network.
(d) The university is planning to establish the online classes. Name two applications that can be used to
schedule and manage online classes.
Ans. (a) The most suitable cable layout is:
(b) The Server should be installed in Wing A (Arts) as Wing A has the maximum number of computers and
installing the server in this wing will help reduce the network traffic.
(c) Repeater will be required in all the wings as the distance between each wing is equal to and greater
than 100.
(d) (i) Microsoft Teams
(ii) Zoom Meeting
A.7