Class 12 computer science sample paper term 2 solutions

Preview




Sample Question Paper COMPUTER SCIENCE (Code: 083)

Maximum Marks: 35                                                                            Time: 2 hours

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
  • 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
  • Internal choices have been given for question numbers 7, 8 and 12.
Section -A

Each question carries 2 marks

Q.
No
Part
No.
Question Marks
1. Give any two characteristics of stacks.

 Ans:

i. It is a LIFO(Last in First Out) data structure .   ii. The insertion and deletion can occur at only one end i.e. top of the stack

(2)
2. (i) Expand the following:
SMTP , XMLAns:
SMTP: Simple Mail Transfer Protocol
XML: Extensible Markup Language
(1)
(ii) Out of the following, which is the fastest wired and wireless medium of transmission?
Infrared,   coaxial   cable,   optical   fibre, microwave, Ethernet cableAns:
Fastest  Wired Medium: Optical Fibre
Fastest Wireless Medium: Microwave
(1)
3. Differentiate between char(n) and varchar(n) data types with respect to databases.

Ans:
char(n):  It refers to fixed length string data type. It can store upto 255 characters. If the value stored in this type of field is smaller than the specified size, blank spaces are added at the end of string value.  So there is a wastage of space.
varchar(n):  It refers to variable length string data type. If the value stored in this type of field is smaller than the specified size, blank spaces are not added at the end of string value so there is no wastage of space.

(2)
4. A resultset is extracted from the database using the cursor object (that has been already created) by giving the following statement.
Mydata=cursor.fetchone()(a)                How many records will be returned by fetchone() method?
Ans: One record(b)               What will be the datatype of Mydata object after the given command is executed?
Ans: tuple
(2)
5. Write the output of the queries (a) to (d) based on the table, Furniture given below:
Table: FURNITURE
FID   NAME    DATEOFPURCHASE COST   DISCOUNT
B001      Double       03-Jan-2018               45000      10
BedT010      Dining        10-Mar-2020             51000      5
TableB004      Single         19-Jul-2021                22000      0
BedC003      Long           30-Dec-2016              12000      3
Back ChairT006      Console      17-Nov-2019              15000      12
TableB006      Bunk           01-Jan-2021               28000      14
Bed(a)    SELECT SUM(DISCOUNT) FROM FURNITURE
WHERE COST>15000;  Ans:29(b)    SELECT MAX(DATEOFPURCHASE) FROM FURNITURE;
Ans:  19-Jul-2021(c)    SELECT * FROM FURNITURE
WHERE DISCOUNT>5 AND FID LIKE “T%”;
Ans:

T006  Console Table 17-Nov-2019 15000 12

(d)   SELECT DATEOFPURCHASE FROM FURNITURE WHERE NAME IN (“Dining Table”, “Console
Table”);
Ans:
10-Mar- 2020 
17-Nov-2019

(2)
6. (i) Which command is used to view the list of tables in a database?
Ans: show tables;
(1)
(ii) Give one point of difference between an equi-join and a natural join.
Ans:
Equi-join: In this join, columns from two tables are compared for equality . Duplicate columns are also shown. Natural Join : In this join, only one columns is shown if there are two columns of same name in tables to be joined. Duplication of columns is not there.
(1)
7. Consider the table, MOVIEDETAILS given below: (2)
MOVIEID TITLE LANGUAGE RATING PLATFORM
M001 Minari Korean 5 Netflix
M004 MGR Magan Tamil 4 Hotstar
M010 Kaagaz Hindi 3 Zee5
M011 Harry Potter and the Chamber of
Secrets
English 4 Prime Video
M015 Uri Hindi 5 Zee5
M020 Avengers:
Endgame
English 4 Hotstar
(a)    Identify the degree and cardinality of the table.
Ans:  Degree=5 Cardinality=6
(b)   Which field should be made the primary key? Justify your answer.
Ans: MOVIEID should be made the primary key as it can uniquely identify records of the table.
OR
(a)   Identify the candidate key(s) from the table MOVIEDETAILS.
Ans: MOVIEID and TITLE
(b)   Consider the table SCHEDULE given below:
Table: SCHEDULE
SLOTID          MOVIEID          TIMESLOT
S001            M010             10 AM to 12 PM
S002            M020             2 PM to 5 PM
S003            M010             6 PM to 8 PM
S004            M011             9 PM to 11 PMWhich field will be considered as the foreign key if the tables
MOVIEDETAILS and SCHEDULE are related in a database?
Ans: MOVIEID
8. Julie has created a dictionary containing names and marks as key value pairs of 6 students. Write a program, with separate user defined functions to perform the following operations:
●       Push the keys (name of the student) of the dictionary into a stack, where the corresponding value (marks) is greater than 75.
●       Pop and display the content of the stack. For example:
If the sample content of the dictionary is as follows:
R={“OM”:76, “JAI”:45, “BOB”:89, “ALI”:65, “ANU”:90, “TOM”:82}The output from the program should be:
TOM ANU BOB OMANS:
def PUSH(R , STK):  #STK is a list based stack
     for k in R:
          if R[k]>75:
               STK.append(k)
 
def POP( STK):  #STK is a list based stack
     if len(STK) == 0:
           print(“Underflow”)
     else:
          STK.pop()
          print(“STACK CONTENTS”)
          for item in STK:
               print(item,end=’ ‘)
 
ORAlam has a list containing 10 integers. You need to help him create a program with separate user defined functions to perform the following operations based on this list.
●     Traverse the content of the list and push the even numbers into a stack.
●     Pop and display the content of the stack.For Example:
If the sample Content of the list is as follows:
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
38 22 98 56 34 12
Ans:
def PUSH(N , STK):  #STK is a list based stack
     for k in N:
          if k%2==0:
               STK.append(k)
 def POP(STK):  #STK is a list based stack
     if len(STK) == 0:
           print(“Underflow”)
     else:
          STK.pop()
          print(“STACK CONTENTS”)
          for item in STK:
               print(item,end=’ ‘)
(3)
9. (i) A table, ITEM has been created in a database with the following fields:
ITEMCODE, ITEMNAME, QTY, PRICEGive the SQL command to add a new field, DISCOUNT (of type Integer) to the ITEM table.
Ans:
Alter table Item  add Discount int ; 
(1)
(ii) Categorize following commands into DDL and DML commands?

INSERT INTO, DROP TABLE, ALTER TABLE, UPDATE…SET
Ans:
DDL: DROP TABLE, ALTER TABLE 
DML: INSERT INTO, UPDATE…SET
 

(2)
10. Charu has to create a database named MYEARTH in MYSQL.
She now needs to create a table named CITY in the database to store the records of various cities across the globe. The table CITY has the following structure:Table: CITY
(3)
FIELD NAME DATA TYPE REMARKS
CITYCODE CHAR(5) Primary Key
CITYNAME CHAR(30)
SIZE INTEGER
AVGTEMP INTEGER
POLLUTIONRATE INTEGER
POPULATION INTEGER
Help her to complete the task by suggesting appropriate SQL commands.
Ans:
create database MYEARTH;
use MYEARTH;
create table CITY (CITYCODE CHAR(5) Primary Key, CITYNAME CHAR(30), SIZE INT, AVGTEMP INT, POLLUTIONRATE INT, POPULATION INT);

 

Section C
Each question carries 4 marks
11. Write queries (a) to (d) based on the tables EMPLOYEE and
DEPARTMENT given below:
Table: EMPLOYEE

a)      To display the average salary of all employees, department wise.
Ans: select avg(salary) from employee group by DEPTID;
b)      To display name and respective department name of each employee whose salary is more than 50000.
Ans: select name, DEPTNAME from employee, DEPARTMENT  where EMPLOYEE.DEPTID=DEPARTMENT.DEPTID and SALARY>50000;
(4)
(c)    To display the names of employees whose salary is not known, in alphabetical order.
Ans: select NAME from employee where SALARy is null order by name;
(d)   To display DEPTID from the table EMPLOYEE without repetition.
Ans: select distinct deptid from employee;
12. (i) Give two advantages and two disadvantages of star topology
Ans:
Advantages  
a)    It is easy to configure.  
b)   Centralized control.  
c)    It is easy to find and correct problems. 
Disadvantages  
a)    Long cable length  
b)   It may become difficult to attach new nodes
c)    If Central computer is dead, network stops working.
OR
Define the following terms:
www , web hosting
www: It is defined as a collection of protocols that are used to access any document on the internet.
Web Hosting: It is the process of storing websites and web pages on a server in such a way that it is accessible through internet.
(2)
(ii) How is packet switching different from circuit switching?
Ans:
Packet switching:  
In packet switching, message is divided into fixed sized blocks called packets and then sent forward. There is no physical path between sender and receiver.  
 
Circuit switching 
In circuit switching, physical connection is established between sender and receiver before transmitting data.  There is no limit on block size.
(2)
13. BeHappy Corporation has set up its new centre at Noida, Uttar Pradesh for its office and web-based activities. It has 4 blocks of buildings.

Distance between the various blocks is as follows: A to B              40 m
B to C              120m
C to D              100m
A to D              170m
B to D              150m
A to C              70mNumbers of computers in each block
Block A –    25
Block B –   50
Block C  –  125
Block D – 10(a)    Suggest and draw the cable layout to efficiently connect various blocks of buildings within the Noida centre for connecting the digital devices.

(b)   Suggest the placement of the following device with justification
i.                   Repeater
ii.                   Hub/Switch
(i) Repeater : It may be placed between Block C and  Block D as the distance between them is large. 
(ii) Hub/Switch: It is required in each block to interconnect computers.
 (c) Which kind of network (PAN/LAN/WAN) will be formed if the Noida office is connected to its head office in Mumbai?
Ans: WAN
(d) Which fast and very effective wireless transmission medium should preferably be used to connect the head office at Mumbai with the centre at Noida?
Ans: Satellite
(4)




Back to: CBSE class 12 Computer Science notes