# Class 12 Computer Science Sample Paper Term 2 With Solutions Set B

Please refer to Class 12 Computer Science Sample Paper Term 2 With Solutions Set B below. These Class 12 Computer Science Sample Papers will help you to get more understanding of the type of questions expected in the upcoming exams. All sample guess papers for Computer Science Class 12 have been designed as per the latest examination pattern issued by CBSE. Please practice all Term 2 CBSE Sample Papers for Computer Science in Standard 12.

## Sample Paper Term 2 Class 12 Computer Science With Solutions Set B

Section – A

1. Evaluate the following expressions:
(a) 6 * 3 + 4**2 // 5 – 8
(b) 10 > 5 and 7 > 12 or not 18 > 3
(b) False

2. (i) Expand the following terms:
(a) PPP (b) FTP
(ii) Name the transmission media best suitable for connecting to hilly areas.
Answer: (i) (a) PPP : Point to Point Protocol.
(b) FTP : File Transfer Protocol.

3. What do you understand by Candidate Keys in a table? Give a suitable example of Candidate Keys from a table containing some meaningful data.
Answer: A table may have more than one such attribute/group of attributes that identifies a tuple uniquely, all such attribute(s) are known as Candidate Keys.

In the above table Item, Item No can be candidates keys.

4. Differentiate between fetchone() and fetchall() methods with suitable example for each.
Answer: fetchall() fetches all the rows of a query result.
An empty list is returned if there is no record to fetch the cursor.
fetchone() method returns one row or a single record at a time.
It will return None if no more rows/records are available.

5. Write the output of the queries (a) to (d) based on the table Student given below:

(a) SELECT COUNT(*), City FROM STUDENT GROUP BY CITY HAVING COUNT(*)>1;
(b) SELECT MAX(DOB),MIN(DOB) FROM STUDENT;
(c) SELECT NAME,GENDER FROM STUDENT WHERE CITY=”Delhi”;
(d) SELECT NAME, MARKS FROM STUDENT WHERE CITY IN (“MUMBAI”, “DELHI”)

(b) MAX(DOB)
08-12-1995
MIN(DOB)
07-05-1993
(c)

(d)

6. (a) In SQL, name the clause that is used to display the tuples in ascending order of an attribute.
(b) In SQL, what is the use of IS NULL operator?
(b) To check if the column has null value / no value.

7. Observe the following table Pro_Info carefully:

(a) Write the names of the most appropriate columns, which can be considered as candidate keys.
(b) Write the names of the most appropriate columns, which can be considered as primary key. Justify your answer.
Answer: (a) Candidate keys : Id, Product
(b) Primary key : Id, because it will uniquely identify each record in the table.

OR

(a) Identify the degree and cardinality of the table Pro_info.
(b) Consider the table TRANSPORT given below:

Which field will be consider as the foreign key if the tables Pro_Info and TRANSPORT are related in a database?
Answer: (a) Degree: 5, Cardinality: 5
(b) Id

Section – B

8. Write a function DeleteCustomer() to delete a Customer information from a list of CStack. The function delete the name of customer from the stack.
def DeleteCustomer():
if (CStack ==[]):
print(“There is no Customer!”)
else:
print(“Record deleted:”,CStack.pop())

OR

Write a function to perform push and pop operations on a Stack containing Student details as given in the following
RNo integer
Name String
Age integer
stk.append(item)
top=len(stk)-1
defstkPOP(stk):
ifstk!=[]:
returnstk.pop()
else:
return None

9. (a) A table, “Customers” has been created in a database with the following fields:
CustomerID, CustomerName, ContactName, Address City, PostalCode, Country
Give the SQL command to updates the first customer (CustomerID = 1) with a new contact person
“Rachit” and a new city “Mumbai”.
(b) What is the use of wildcard ? Give an example.
SET ContactName = ‘Rachit’, City= ‘Mumbai’
WHERE CustomerID = 1;
(b) The wildcard operators are used with the LIKE operator to search a value similar to a specific pattern in a column. There are 2 wildcard operators.
♦ % (Percent) – represents 0,1 or many characters
♦ _ (Underscore) = represents a single number or character
For example: Select * from Customer where name like ‘S%’;
This command will show all those records from table named Customer where name field contains
values starting with S for e.g. Sri, Siya, Shyam, Suman, etc.

10. Sonakshi has to create a database named Publishers in MYSQL.
She now needs to create a table named Book in the database to store the records of various Books.
The table Book has the following structure:

Help her to complete the task by suggesting appropriate SQL commands.
CREATE TABLE Book (
Book_Code CHAR(5)PRIMARY KEY ,
Book_Name CHAR(30),
Pages INT,
Price INT,
Author_Name CHAR(30)
);

Section – C

11. Write queries (a) to (d) based on the tables TRAINER and COURSE given below:

(a) Display the Trainer Name, City & Salary in descending order of their Hiredate.
(b) To display the TNAME and CITY of Trainer who joined the Institute in the month of December 2001.
(c) To display the average salary of all trainer, city wise.
(d) To display TNAME, HIREDATE, CNAME, STARTDATE from tables TRAINER and COURSE of all those courses whose FEES is less than or equal to 10000.
Answer: (a) SELECT TNAME, CITY, SALARY FROM TRAINER ORDER BY HIREDATE DESC;
(b) SELECT TNAME, CITY FROM TRAINER WHERE HIREDATE BETWEEN ‘2001-12- 01’ AND ‘2001-12-31’;
(c) SELECT AVG(SALARY) FROM TRAINER GROUP BY CITY;
(d) SELECT TNAME,HIREDATE,CNAME, STARTDATE FROM TRAINER, COURSE WHERE TRAINER.TID=COURSE.TID AND FEES<= 10000;

12. (a) Write two characteristics of Wi-Fi.
Answer: (a) (i) It is wireless network.
(ii) It is used for short range.

OR

Define the following:
HTML, XML
(b) Explain the purpose of a router.
HTML (Hyper Text Markup Language) : It is a markup language that describes the structure and behavior of a web page. This language is used to create web pages.
XML (Extensible Markup Language): It is a meta language that provides a framework to define the markup language.
(b) A router establishes connection between two networks and it can handle network with different protocols.

13. Delhi University of India is starting its first campus Nagarjun Nagar of South India with its centre admission office in Mumbai. The university has three major branch comprising of Administrative Branch, Theory Branch and Practical Branch in the 5 km area campus.
As a network expert, you need to suggest the network plan as per (a) to (d) to the authorities keeping in mind the distance and other given parameters.

Expected wire distances between various locations:

Expected number of computers to installed at various locations in the university are as follows:

(a) Suggest the authorities, the cable layout amongst various branches inside university campus for
connecting the branches.
(b) Suggest the most suitable place (i.e. branch) to house the server of this university with a suitable reason.
(c) Suggest an efficient device from the following to be installed in each of the branch to connect all the computers.
(i) Switch
(ii) Modem
(iii) Gateway
(d) Suggest the most suitable (very high speed) service to provide data connectivity between Admission Office located in Mumbai and Nagarjun Nagar campus from the following options:
(i) Telephone lines
(ii) Fixed line dial-up connection
(iii) Co-axial cable network
(iv) GSM
(v) Leased lines
(vi) Satellite connection
Answer: (a) The suggested cable layout amongst various blocks inside university campus for connecting the blocks will be as follow:

(b) Practical Branch, because in this branch there are maximum number of computer and according to 80-20 rule 80% of traffic should be local.
(c) Switch.
(d) Satellite connection.