Students can access the CBSE Sample Papers for Class 12 Computer Science with Solutions and marking scheme Term 2 Set 5 will help students in understanding the difficulty level of the exam.
CBSE Sample Papers for Class 12 Computer Science Term 2 Set 5 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.
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.
Question 2.
(i) Expand the following
FTP, VoIP
Answer:
- FTP – file Transfer Protocol.
- VoIP – Voice over Internet Protocol.
(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:
PAN (Personal Area Network).
Question 3.
What is table? Also, define Candidate Key. BD
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.
Question 4.
Consider the following statement and answer the following questions cursor, rowcount
(a) What is row count ?
Answer:
The rowcount is a property of cursor object that returns the number of rows retrieved from the; cursor so far.
(b) Where is row count used ?
Answer:
rowcount is used frequently in the loops to prevent the infinite loops.
Question 5.
Write output for SQL queries (a) to (d), which are based on the table: STUDENT given below:
Table: STUDENT
ItemNo | Â Item | Scode | Qty | Rate | LastBuy |
2005 | Sharpener Classic | 23 | 60 | 8 | 31-Jun-09 |
2003 | Ball Pen 0.25 | 22 | 50 | 25 | 01-Feb-10 |
2002 | Gel Pen Premimum | 21 | 150 | 12 | 24-Feb-10 |
2006 | Gel Pen Classic | 21 | 250 | 20 | 11-Mar-09 |
2001 | Eraser Small | 22 | 220 | 6 | 19-Jun-09 |
2004 | Eraser Big | 22 | 110 | 8 | 02-Dec-09 |
2009 | Ball Pen 0.5 | 21 | 180 | 18 | 03-Nov-09 |
(a) SELECT COUNT(DISTINCT Scode) FROM STORE;
Answer:
COUNT(DISTINCT Scode)
3
(b) SELECT Rate* Qty FROM STORE WHERE ItemNo=2004;
Answer:
Rate* Qty
880
(c) SELECT MAX(Qty) FROM STORE;
Answer:
AX(Qty) s
250
(d) SELECT SUM(Rate) FROM STORE WHERE Scode=22;
Answer:
SUM(Rate):
39
Question 6.
(a) What is primary key?
Answer:
A primary key is a set of one or more attributes that can uniquely identify the relation.
(b) What is My SQLdb?
Answer:
MySQLdb is an interface for connecting to a MySQL database server from Python.
Question 7.
Observe the following table Pro_Info carefully:
PID | PNAME | QTY | PRICE | COMPANY | SUPCODE |
101 | DEGITAL CAMERA 14X | 120 | 12,000 | RENBIX | SOI |
102 | DIGITAL PAD lli | 100 | 22,000 | DIGI POP | S02 |
104 | Stapler Medium | 500 | 1,100 | STOREKING | SOI |
106 | Punching Machine Big | 70 | 28,000 | DISPEXPERTS | S02 |
105 | Stapler Mini | 60 | 12,000 | MOVEON | S03 |
(a) Identify the primary key of above table.
Answer:
PID
(b) Identify the candidate key(s) of above table.
Answer:
PID, PNAME
OR
(c) Identify the degree and cardinality of table PRODUCT.
Answer:
Degree: 6
(d) Which command is used to remove the tuples from the table?
Answer:
DELETE
Section – B
[3 Marks Each]
Question 8.
Write a python program to demonstrate implementation of stack using lists with proper documentation.
OR
Write an algorithm to convert infix to postfix.
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
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.)
(iii) 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.
Question 9.
(a) Which clause is used to sort the records of a table?
Answer:
ORDER BY
(b) What is the SQL ?
Answer:
SQL refers to structured Query Language, a standard query language used by RDBMs to create, maintain and guery upon their databases.
Question 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’,
‘HosAdmin0123′,’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()
Commonly Made Error:
- Few students get confused to import the correct DB – API module.
Answering Tips:
- Keep in mind to give user id and password while connecting to a database.
- Be sure to import the correct DB – API module.
Section – C
( 5 Marks Each)
Question 11.
Write SQL queries for (a) to (d) which are based on the tables Trainer given below:
Table: VEHICLE
VCODE | VEHICLE TYPE | PERKM |
V01 | VOLVO BUS | 150 |
V02 | AC DELUXE BUS | 125 |
V03 | ORDINARY BUS | 80 |
V05 | SUV | 30 |
V05 | CAR | 18 |
Table: TRAVEL
CNO | CNAME | TRAVEL DATE | KM | VCODE | NOP |
101 | K. Niwal | 2015-12-13 | 200 | V01 | 32 |
103 | Fredrick Sym | 2016-03-21′ | 120 | V03 | 45 |
105 | Hitesh Jain | 2016-04-23 | 450 | V02 | 42 |
202 | Ravi Anish | 2016-01-13 | 80 | V02 | 40 |
207 | John Malina | 2015-02-10 | 65 | V04 | 2 |
104 | Sahanubhuti | 2016-01-28 | 90 | V05 | 4 |
106 | Ramesh Jaya | 2016-04-06 | 100 | V01 | 25 |
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.
Answer:
SELECT CNO, CNAME, TRAVELDATE FROM TRAVEL ORDER BY CNO DESC;
(b) To display the CNAME of all customers from the table TRAVEL who are travelling by vehicle with code V01 or V02.
Answer:
SELECT CNAME FROM TRAVEL WHERE VCODE = ‘V01 ‘ OR VCODE =’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’.
Answer:
SELECT CNO, CNAME FROM TRAVEL WHERE TRAVELDATE > = ‘2015-05-01’ AND TRAVELDATE< = ‘2015-12-31’;
(d) To display the different vehicle code from table vehicle.
Answer:
SELECT DISTINCT VCODE FROM TRAVEL;
Commonly Made Error:
- Some students do not write the ASC and DESC for increasing and decreasing order.
Answering Tip:
- Remember to mention the order in which to order a field i.e., Ascending/Descending
Question 12.
(a) Write two advantages and disadvantages of bus topology.
OR
Define the following:
Wide Area Network, VoIP
Answer:
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
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.
Commonly Made Error:
- Some students get confused in different concept and write definition interchangeably.
Answering Tip:
- Students should learn all the concepts very carefully.
(b) What do you mean by packet switching?
Answer:
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.
Question 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:
Admin to Engineering | 55 mt |
Admin to Business | 90 mt |
Admin to Media | 90 mt |
Engineering to Business | 55 mt |
Business to Media | 45 mt |
Delhi Head office to Karnataka campus | 2175 km |
Number of computers installed at various buildings are as follows:
Admin | 110 |
Engineering | 75 |
Business | 40 |
Media | 40 |
Media | 12 |
Delhi Head office | 20 |
(a) Suggest the most appropriate location of the server inside the Karnataka campus to get the best connectivity for maximum no. of computers.
Answer:
Admin (Due to maximum number of computers)
(b) Draw the cable layout to efficiently connect various buildings within the Karnataka campus for connecting the computers.
Answer:
(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?
Answer:
Firewall or Router
(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:
Video Conferencing