CBSE Class 12 Computer Science Term 2 Sample Paper Set A

Sample Paper Class 12

See below CBSE Class 12 Computer Science Term 2 Sample Paper Set A with solutions. We have provided CBSE Sample Papers for Class 12 Computer Science as per the latest paper pattern issued by CBSE for the current academic year. All sample papers provided by our Class 12 Computer Science teachers are with answers. You can see the sample paper given below and use them for more practice for Class 12 Computer Science examination.

CBSE Sample Paper for Class 12 Computer Science Term 2 Set A

Section – A

1. Define stack.
Answer: A stack is a data structure that allows addition and removal of elements in a particular order. Every time an element is added, it goes on the top of the stack and the only element that can be removed is the element that was at the top of the stack.

2. (i) Expand the following
FTP, VoIP
(ii) Which type of network out of LAN, PAN and MAN is formed, when you connect two mobiles using Bluetooth to transfer a video?
Answer: (a) FTP – file Transfer Protocol.
VoIP – Voice over Internet Protocol.
(b) PAN (Personal Area Network).

3. What is table? Also, define Candidate Key.
Answer: A table consists of a number of rows and columns. Each record contains values for the attributes.
A candidate key is the smallest subset of the super key for which there does not exist a proper subset that is super key. In other words, all attribute combinations inside a relation that can serve as primary key are candidate keys.

4. Consider the following statement and answer the following questions cursor. rowcount
(a) What is row count ?
(b) Where is row count used ?
Answer: (a) The rowcount is a property of cursor object that returns the number of rows retrieved from the cursor so far.
(b) rowcount is used frequently in the loops to prevent the infinite loops.

5. Write output for SQL queries (a) to (d), which are based on the table: STUDENT given below:

CBSE Class 12 Computer Science Term 2 Sample Paper Set A

(a) SELECT COUNT(DISTINCT Scode) FROM STORE;
(b) SELECT Rate* Qty FROM STORE WHERE ItemNo=2004;
(c) SELECT MAX(Qty) FROM STORE;
(d) SELECT SUM(Rate) FROM STORE WHERE Scode=22;
Answer: (a) COUNT(DISTINCT Scode)
3
(b) Rate* Qty
880
(c) MAX(Qty)
250
(d) SUM(Rate)
39

6. (a) What is primary key?
(b) What is My SQLdb?
Answer: (a) A primary key is a set of one or more attributes that can uniquely identify the relation.
(b) MySQLdb is an interface for connecting to a MySQL database server from Python.

7. Observe the following table Pro_Info carefully:

CBSE Class 12 Computer Science Term 2 Sample Paper Set A

(a) Identify the primary key of above table.
(b) Identify the candidate key(s) of above table.
Answer: (a) PID
(b) PID, PNAME

OR

(a) Identify the degree and cardinality of table PRODUCT.
(b) Which command is used to remove the tuples from the table?
Answer: (c) Degree : 6
Cardinality : 5
(d) DELETE

Section – B

8. Write a python program to demonstrate implementation of stack using lists with proper documentation.
Answer: # Python program to
# demonstrate stack implementation
# using list
stack = []
# append ( ) function to push
# element in the stack
stack. append (‘a’)
stack. append (‘d’)
stack. append (‘c’)
print (‘Initial stack’)
print (stack)
# pop ( ) function to pop
# element from stack in
# LIFO order
print (‘\ nElements popped from stack : ’)
print (stack . pop ( ))
print (stack . pop ( ))
print (stack . pop ( ))
print (‘\nStack after elements are popped :’)
print (stack)
# uncommenting print (stack. pop ( ))
# will cause an IndexError
# as the stack is now empty

OR

Write an algorithm to convert infix to postfix.
Answer: 1. Scan the infix expression from left to right.
2. If the scanned character is an operand, output it.
3. Else,
(i) If the precedence of the scanned operator is greater than the precedence of the operator in the stack (or the stack is empty or the stack contains a ‘(‘ ), push it.
(ii) Else, Pop all the operators from the stack which are greater than or equal to in precedence than that of the scanned operator. After doing that Push the scanned operator to the stack.
(If you encounter parenthesis while popping then stop there and push the scanned operator in the stack.)
3. Else, Pop all the operators from the stack which are greater than or equal to in precedence than that of the scanned operator. After doing that Push the scanned operator to the stack. (If you encounter parenthesis while popping then stop there and push the scanned operator in the stack.)
4. If the scanned character is an ‘(‘, push it to the stack.
5. If the scanned character is an ‘)’, pop the stack and output it until a ‘(‘ is encountered, and discard both the parenthesis.
6. Repeat steps 2-6 until infix expression is scanned.
7. Print the output
8. Pop and output from the stack until it is not empty.

9. (a) Which clause is used to sort the records of a table?
(b) What is the SQL ?
Answer: (a) ORDER BY
(b) SQL refers to structured Query Language, a standard query language used by RDBMs to create, maintain and guery upon their databases.

10. Consider the structure of table Doctor given below:
Doctor_id(p)
Doctor_Name
Hospital_id(F)
Joining_Date
Speciality
Salary
Experience
Write Python code to create the above table.
Answer: import MySQLdb
db = MySQLdb.connect(‘localhost’,’HosAdmin’,
‘HosAdmin@123’,’XYZHospital’)
cursor=db.cursor()
cursor.execute (“DROP TABLE IF EXISTS DOCTOR”)
sql=”””Create Table Doctor (‘Doctor_Id’ INT NOTNULL,
‘Doctor_Name’ Char(50) NOTNULL,
‘Hospital_Id’ INT NOTNULL,
‘Joining_Date’ Date NOTNULL,
‘Speciality’ Char(50),
‘Salary’ Float,
‘Experience’ Float,
Primary Key (‘Doctor_Id’))”””
cursor.execute(sql)
cursor.close()
db.close()

Section – C

11. Write SQL queries for (a) to (d) which are based on the tables Trainer given below:

CBSE Class 12 Computer Science Term 2 Sample Paper Set A
CBSE Class 12 Computer Science Term 2 Sample Paper Set A

Note :
♦ PERKM is Freight Charges per kilometer.
♦ Km is kilometres travelled.
♦ NOP is number of passengers travelled in vehicle.
(a) To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending order of CNO.
(b) To display the CNAME of all customers from the table TRAVEL who are travelling by vehicle with code V01 or V02.
(c) To display the CNO and CNAME of those customers from the table TRAVEL who travelled between ‘2015-12-31’ and ‘2015-05-01’.
(d) To display the different vehicle code from table vehicle.
Answer: (a) SELECT CNO, CNAME, TRAVELDATE FROM TRAVEL ORDER BY CNO DESC;
(b) SELECT CNAME FROM TRAVEL WHERE VCODE = ‘V01‘ OR VCODE =’V02’;
(c) SELECT CNO, CNAME FROM TRAVEL WHERE TRAVELDATE > = ‘2015-05-01’ AND
TRAVELDATE< = ‘2015-12-31’;
(d) SELECT DISTINCT VCODE FROM TRAVEL;

12. (a) Write two advantages and disadvantages of bus topology.
Answer:
(a) Advantages:
♦ Easy to connect and install.
♦ Involves a low cost and installation time.
Disadvantages:
♦ The entire network shuts down if there is a failure in the connecting cable.
♦ Only a single message can travel at a particular time.

OR

Define the following:
Wide Area Network, VoIP
(b) What do you mean by Packet switching?
Answer: A Wide Area Network (WAN) is a network that exists over a large scale geographical area. A WAN connects different smaller networks, including local area networks (LANs) and metropolitan area networks (MANs)
VoIP (Voice over Internet Protocol) is a methodology and group of technologies for delivering voice communications and multimedia sessions over IP networks, such as the Internet.
(b) Packet Switching transmits data across digital networks by breaking it down into blocks or packets for more efficient transfer using various network devices. Each time one device sends a file to another, it breaks the file down into packets so that it can determine the most efficient route for sending the data across the network at that time.

13. Perfect Edu Services Ltd. is an educational organization. It is planning to setup its India campus at Karnataka with its head office at Delhi.
The Karnataka Campus has 4 main buildings – ADMIN, ENGINEERING, BUSINESS and MEDIA.
You as a network expert have to suggest the best network related solutions for their problems raised in (a) to (d), keeping in mind the distances between the buildings and other given parameters.
Shortest distances between various buildings:

CBSE Class 12 Computer Science Term 2 Sample Paper Set A

Number of computers installed at various buildings are as follows:

CBSE Class 12 Computer Science Term 2 Sample Paper Set A

(a) Suggest the most appropriate location of the server inside the Karnataka campus to get the best connectivity for maximum no. of computers.
(b) Draw the cable layout to efficiently connect various buildings within the Karnataka campus for connecting the computers.
(c) Which hardware device will you suggest to be procured by the company to be installed to protect and control the internet uses within the campus?
(d) Which will you suggest to establish the online face to face communication between the people in the admin office of Karnataka campus and Delhi Head office.
Answer: (a) Admin (Due to maximum number of computers)
(b)

CBSE Class 12 Computer Science Term 2 Sample Paper Set A

(c) Firewall or Router
(d) Video Conferencing