Sample Paper Class 12 Computer Science Term 2 Set A
Section – A
1. Write the types of operations used in stack.
Answer: There are two types of operations in Stack:
♦ Push– To add data into the stack.
♦ Pop– To remove data from the stack.
2. (a) Expand the following:
(i) GSM
(ii) GPRS
(b) 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) (i) GSM: Global System for Mobile communication.
(ii) GPRS: General Packet Radio Service.
(b) PAN (Personal Area Network)
3. Differentiate between Cardinality and Degree of a table with the help of an example.
Answer: Cardinality is defined as the number of rows in a table. Degree is the number of columns in a table.
e.g. consider the following table:
Cardinality: 3
Degree: 2
4. db = MySQLdb.connect(‘localhost’,‘LibMan’,‘isspwd’,‘Library’)
(a) What is “Library” in the statement?
(b) What is the use of connect()?
Answer: (a) Database name
(b) connect() function is used to connect or establish a connection with My SQL database.
5. Write the output of the queries (a) to (d) based on the table, Grocery given below:
(a) SELECT Pr_Name, Avg(Pr_Price) FROM Grocery Group BY Pr_Name;
(b) SELECT DISTINCT Pr_Manufac FROM Grocery;
(c) SELECT COUNT(DISTINCT Pr_Name) FROM Grocery;
(d) SELECT Pr_Name, MAX(Pr_Price), MIN(Pr_Price) FROM Grocery GROUP BY Pr_ Name;
Answer: (a)
(b)
(c) 4
(d)
6. (a) MySQL supports different character sets, which command is used to display all character sets?
(b) What will happen if the data being loaded into a text column exceeds the maximum size of that type?
Answer: (a) SHOW CHARACTER SET
(b) Data will be truncated
7. Observe the following table and answer the parts (a) and (b):
(a) In the above table, can we have Qty as primary key. [Answer as Yes/No.]. Justify your answer.
(b) What is the cardinality and degree of the above table?
Answer: (a) No, Because there is a duplication of values and primary key value cannot be duplicate.
Answer: (b) Degree : 4
Cardinality : 5
OR
(a) Identify the candidate key(s) from the table store.
(b) Consider the following table Company:
Which field will be considered as the foreign key if the tables Store and Company are related in a database?
Answer: (a) Item Code and Items
(b) Item Code
Section – B
8. Write a function in Python PUSH (Arr), where Arr is a list of numbers. From this list push all numbers divisible by 5 into a stack implemented by using a list. Display the stack if it has at least one element, otherwise display appropriate error message.
Answer: def PUSH (Arr, value):
s = []
for x in range (0, len (Arr)):
if Arr [x] % 5==0:
s.append (Arr [x])
if len (s) ==0:
print (“Empty stack”)
else:
print (s)
OR
Write a function in Python POP(Arr), where Arr is a stack implemented by a list of numbers. The function returns the value deleted from the stack.
Answer: def popStack (st):
if len (st) == 0: # if stack is empty
print (“Underflow”)
else:
l=len (st)
val=st[l-1]
print (val)
st.pop(l-1)
return val
9. (a) A table FLIGHT has 4 rows and 2 columns and another table AIRHOSTESS has 3 rows and
4 columns. How many rows and columns will be there if we obtain the Cartesian product of these two tables?
(b) There is a column Salary in a Table EMPLOYEE. The following two statements are giving different outputs. What may be the possible reason?
SELECT COUNT(*) FROM EMPLOYEE;
SELECT C0UNT(Salary) FROM EMPLOYEE;
Answer : (a) Total number of rows will be 12 and total number of columns will be 6.
(b) SELECT COUNT (*)
FROM EMPLOYEE:
This statement returns the number of records in the table.
SELECT COUNT(Salary)
FROM EMPLOYEE;
This statement returns the number of values (NULL values will not be counted) of the specified column.
10. Hina has to create a database named Employee in MYSQL.
She now needs to create a table named Employee_Info in the database to store the records of various
employees across the country. The table Employee_Info has the following structure:
Help her to complete the task by suggesting appropriate SQL commands.
Answer: CREATE DATABASE Employee;
CREATE TABLE Employee_Info
(
EmployeeID int primary key,
EmployeeName varchar(255),
EmergencyContactName varchar(255),
PhoneNumber int,
Address varchar(255),
City varchar(255),
Country varchar(255)
);
Section – C
11. Write SQL queries for (a) to (c) and find outputs for SQL queries (d), which are based on the tables.
(a) To display details of all transactions of TYPE Credit from table TRANSACTION.
(b) To display the CNO and AMOUNT of all Transactions done in the month of September 2017 from table TRANSACTION.
(c) To display the last date of transaction (DOT) from the table TRANSACTION and customer name from CUSTOMER for the customer having CNO as 103.
(d) SELECT CNO, COUNT(*), MAX (AMOUNT) FROM TRANSACTION GROUP BY CNO HAVING COUNT (*)> 1;
Answer: (a) SELECT * FROM TRANSACTION WHERE TYPE =”Credit”; 4
(b) SELECT CNO,AMOUNT FROM TRANSACTION WHERE (MONTH(DOT)=”September” AND
YEAR(DOT)=2017);
(c) SELECT MAX(DOT), CNAME FROM TRANSACTION, CUSTOMER WHERE CNO=”103” AND
CUSTOMER.CNO=TRANSACTION.CNO:
(d)
12. (a) Identify the type of topology from the following:
(i) Each node is connected with the help of a single cable.
(ii) Each node is connected with central switching through independent cables.
12. (a) (i) Bus topology
(ii) Star topology
OR
Name two server side scripting language and two client side scripting language.
(b) What is the difference between packet and message switching?
Answer: Server side scripting : ASP, JSP
Client side scripting : JavaScript, VBScript
(b)
13. Meerut school in Meerut is starting up the network between its different wings. There are four buildings named as S, J, A and H. The distance between various buildings is as follows:
Numbers of computers in each Buildings
(a) What type of topology is best suited for above network?
(b) Suggest the most suitable place (i.e. building) to house the server of this school.
(c) The school is planning to link its head office situated in New Delhi with the offices in hilly areas.
Suggest a way to connect it economically.
(d) The company wants internet accessibility in all the blocks. What is the suitable and cost-effective technology for that?
Answer: (a) Star topology
(b) Building A
(c) Radio waves would be an economic way to connect it.
(d) Broadband