0% found this document useful (0 votes)
31 views13 pages

CBSE-XII - Computer Science-2018

The document discusses a computer science exam paper containing questions from Python programming. It contains instructions for students regarding the paper's format and sections. The paper has multiple choice, code writing and output prediction questions on Python concepts like classes, inheritance, lists and sorting algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views13 pages

CBSE-XII - Computer Science-2018

The document discusses a computer science exam paper containing questions from Python programming. It contains instructions for students regarding the paper's format and sections. The paper has multiple choice, code writing and output prediction questions on Python concepts like classes, inheritance, lists and sorting algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

SET-4

Series SGN Code No. 91


Candidates must write the Code on the
Roll No.
title page of the answer-book.

 Please check that this question paper contains 23 printed pages.


 Code number given on the right hand side of the question paper should be
written on the title page of the answer-book by the candidate.
 Please check that this question paper contains 7 questions.
 Please write down the Serial Number of the question before
attempting it.
 15 minute time has been allotted to read this question paper. The question
paper will be distributed at 10.15 a.m. From 10.15 a.m. to 10.30 a.m., the
students will read the question paper only and will not write any answer on the
answer-book during this period.

COMPUTER SCIENCE

Time allowed : 3 hours Maximum Marks : 70

General Instructions :

(i) SECTION A refers to programming language C++.

(ii) SECTION B refers to programming language Python.

(iii) SECTION C is compulsory for all.

(iv) Answer either SECTION A or SECTION B.

(v) It is compulsory to mention on the page 1 in the answer book whether you
are attempting SECTION A or SECTION B.

(vi) All questions are compulsory within each section.


91 1 P.T.O.
SECTION B
[Only for candidates, who opted for Python]

1. (a) Differentiate between Syntax Error and Run-Time Error. Also, write
a suitable example in Python to illustrate both. 2

(b) Name the Python Library modules which need to be imported to


invoke the following functions : 1
(i) sin()
(ii) search()
(c) Rewrite the following code in Python after removing all syntax
error(s). Underline each correction done in the code. 2
Val = int(rawinput("Value:"))
Adder = 0

for C in range(1,Val,3)
Adder+=C
if C%2=0:
Print C*10
Else:
print C*
print Adder

(d) Find and write the output of the following Python code : 2
Data = ["P",20,"R",10,"S",30]
Times = 0
Alpha = ""
Add = 0
for C in range(1,6,2):
Times = Times + C
Alpha = Alpha + Data[C-1]+"$"
Add = Add + Data[C]
print Times,Add,Alpha
91 12
(e) Find and write the output of the following Python code : 3

class GRAPH:
def __init__(self,A=50,B=100):
self.P1=A
self.P2=B
def Up(self,B):
self.P2 = self.P2  B
def Down(self,B):
self.P2 = self.P2 + 2*B
def Left(self,A):
self.P1 = self.P1  A
def Right(self,A):
self.P1 = self.P1 + 2*A
def Target(self):
print "(",self.P1.":",self.P2,")"
G1=GRAPH(200,150)
G2=GRAPH()
G3=GRAPH(100)
G1.Left(10)
G2.Up(25)
G3.Down(75)
G1.Up(30)
G3.Right(15)
G1.Target()
G2.Target()
G3.Target()

91 13 P.T.O.
(f) What possible output(s) are expected to be displayed on screen at
the time of execution of the program from the following code ? Also
specify the maximum values that can be assigned to each of the
variables BEGIN and LAST. 2

import random
POINTS=[20,40,10,30,15];
POINTS=[30,50,20,40,45];

BEGIN=random.randint(1,3)
LAST=random.randint(2,4)
for C in range(BEGIN,LAST+1):
print POINTS[C],"#",

(i) 20#50#30# (ii) 20#40#45#

(iii) 50#20#40# (iv) 30#50#20#

2. (a) What is the advantage of super( ) function in inheritance ? Illustrate


the same with the help of an example in Python. 2

(b) class Vehicle: #Line 1 2


Type = 'Car' #Line 2
def __init__(self, name): #Line 3
self.Name = name #Line 4
def Show(self): #Line 5
print self.Name,Vehicle.Type #Line 6

V1=Vehicle("BMW") #Line 7
V1.Show() #Line 8
Vehicle.Type="Bus" #Line 9
V2=Vehicle("VOLVO") #Line 10
V2.Show() #Line 11

91 14
(i) What is the difference between the variable in Line 2 and
Line 4 in the above Python code ?

(ii) Write the output of the above Python code.

(c) Define a class CONTAINER in Python with the following


specifications : 4

Instance Attributes
- Radius,Height # Radius and Height of Container
- Type # Type of Container
- Volume # Volume of Container

Methods
- CalVolume() # To calculate volume
# as per the Type of container
# With the formula as given below :

Type Formula to calculate Volume

1 3.14 * Radius * Height

3 3.14 * Radius * Height/3

- GetValue() # To allow user to enter values of


# Radius, Height and Type.
# Also, this method should call
# CalVolume() to calculate Volume
- ShowContainer() # To display Radius, Height, Type
# Volume of the Container

91 15 P.T.O.
(d) Answer the questions (i) to (iv) based on the following : 4

Class Top1(object):
def __init__(self,tx): #Line 1
self.X=tx #Line 2
def ChangeX(self,tx):
self.X=self.X+tx
def ShowX(self):
print self.X

Class Top2(object):
def __init__(self,ty): #Line 3
self.Y=ty #Line 4
def ChangeY(self,ty):
self.Y=self.Y+ty
def ShowY(self):
print self.Y,

class Bottom(Top1,Top2):
def __init__(self,tz): #Line 5
self.Z=tz #Line 6
Top2.__init__(self,2*tz): #Line 7
Top1.__init__(self,3*tz): #Line 8
def ChangeZ(self,tz):
self.Z=self.Z+tz
self.ChangeY(2*tz)
self.ChangeX(3*tz)
def ShowZ(self):
print self.Z,
self.ShowY()
self.ShowX()
B=Bottom(1)
B.ChangeZ(2)
B.ShowZ()

91 16
(i) Write the type of the inheritance illustrated in the above.
(ii) Find and write the output of the above code.
(iii) What are the methods shown in Line 1, Line 3 and Line 5
known as ?
(iv) What is the difference between the statements shown in
Line 6 and Line 7 ?

3. (a) Consider the following randomly ordered numbers stored in a list : 3


786, 234, 526, 132, 345, 467
Show the content of the list after the First, Second and Third
pass of the bubble sort method used for arranging in ascending
order ?
Note : Show the status of all the elements after each pass very
clearly underlining the changes.

(b) Write the definition of a method ZeroEnding(SCORES) to add all


those values in the list of SCORES, which are ending with zero (0)
and display the sum. 3
For example :
If the SCORES contain [200, 456, 300, 100, 234, 678]
The sum should be displayed as 600

(c) Write AddClient(Client) and DeleteClient(Client) methods in Python


to add a new Client and delete a Client from a List of Client Names,
considering them to act as insert and delete operations of the queue
data structure. 4

(d) Write a definition of a method COUNTNOW(PLACES) to find and


display those place names, in which there are more than 5
characters. 2
For example :
If the list PLACES contains
["DELHI","LONDON","PARIS","NEW YORK","DUBAI"]
The following should get displayed :
LONDON
NEW YORK

(e) Evaluate the following Postfix notation of expression : 2


22,11,/,5,10,*,+,12,
91 17 P.T.O.
4. (a) Write a statement in Python to open a text file STORY.TXT so that
new contents can be added at the end of it. 1

(b) Write a method in Python to read lines from a text file INDIA.TXT,
to find and display the occurrence of the word ‘‘India’’. 2

For example :
If the content of the file is

‘‘India is the fastest growing economy.


India is looking for more investments around the globe.
The whole world is looking at India as a great market.
Most of the Indians can foresee the heights that India is
capable of reaching.’’

The output should be 4.

(c) Considering the following definition of class MULTIPLEX, write a


method in Python to search and display all the contents in a pickled
file CINEMA.DAT, where MTYPE is matching with the value
‘Comedy’. 3
class MULTIPLEX :
def __init__(self,mno,mname,mtype):
self.MNO = mno
self.MNAME = mname
self.MTYPE = mtype
def Show(self):
print self.MNO:"*",self.MNAME,"$",self.MTYPE

91 18
SECTION C
[For all the candidates]

5. (a) Observe the following tables VIDEO and MEMBER carefully and
write the name of the RDBMS operation out of (i) SELECTION
(ii) PROJECTION (iii) UNION (iv) CARTESIAN PRODUCT, which
has been used to produce the output as shown below. Also, find the
Degree and Cardinality of the final result. 2
TABLE : VIDEO
VNO VNAME TYPE
F101 The Last Battle Fiction
C101 Angels and Devils Comedy
A102 Daredevils Adventure

TABLE : MEMBER
MNO MNAME
M101 Namish Gupta
M102 Sana Sheikh
M103 Lara James

TABLE : FINAL RESULT


VNO VNAME TYPE MNO MNAME
F101 The Last Battle Fiction M101 Namish Gupta
F101 The Last Battle Fiction M102 Sana Sheikh
F101 The Last Battle Fiction M103 Lara James
C101 Angels and Devils Comedy M101 Namish Gupta
C101 Angels and Devils Comedy M102 Sana Sheikh
C101 Angels and Devils Comedy M103 Lara James
A102 Daredevils Adventure M101 Namish Gupta
A102 Daredevils Adventure M102 Sana Sheikh
A102 Daredevils Adventure M103 Lara James

91 19 P.T.O.
(b) Write SQL queries for (i) to (iv) and find outputs for SQL queries
(v) to (viii), which are based on the tables. 6

TABLE : ACCOUNT
ANO ANAME ADDRESS
101 Nirja Singh Bangalore
102 Rohan Gupta Chennai
103 Ali Reza Hyderabad
104 Rishabh Jain Chennai
105 Simran Kaur Chandigarh

TABLE : TRANSACT
TRNO ANO AMOUNT TYPE DOT
T001 101 2500 Withdraw 2017-12-21
T002 103 3000 Deposit 2017-06-01
T003 102 2000 Withdraw 2017-05-12
T004 103 1000 Deposit 2017-10-22
T005 101 12000 Deposit 2017-11-06

(i) To display details of all transactions of TYPE Deposit from


Table TRANSACT.
(ii) To display the ANO and AMOUNT of all Deposits and
Withdrawals done in the month of October 2017 from table
TRANSACT.
(iii) To display the last date of transaction (DOT) from the table
TRANSACT for the Accounts having ANO as 103.
(iv) To display all ANO, ANAME and DOT of those persons from
tables ACCOUNT and TRANSACT who have done
transactions less than or equal to 3000.
(v) SELECT ANO, ANAME FROM ACCOUNT
WHERE ADDRESS NOT IN ('CHENNAI', 'BANGALORE');
(vi) SELECT DISTINCT ANO FROM TRANSACT;
(vii) SELECT ANO, COUNT(*), MIN(AMOUNT) FROM TRANSACT
GROUP BY ANO HAVING COUNT(*)> 1;
(viii) SELECT COUNT(*), SUM(AMOUNT) FROM TRANSACT
WHERE DOT <= '2017-06-01';
91 20
6. (a) State any one Absorption Law of Boolean Algebra and verify it using
truth table. 2

(b) Draw the Logic Circuit of the following Boolean Expression : 2


(U + V).(V + W)

(c) Derive a Canonical POS expression for a Boolean function FN,


represented by the following truth table : 1
X Y Z FN(X,Y,Z)
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1

(d) Reduce the following Boolean Expression to its simplest form using
K-Map : 3
G(U,V,W,Z) = (3,5,6,7,11,12,13,15)

7. (a) Differentiate between Bus Topology and Star Topology of Networks.


What are the advantages and disadvantages of Star Topology over
Bus Topology ? 2

(b) Classify each of the following Web Scripting as Client Side Scripting
and Server Side Scripting : 2
(i) Java Scripting
(ii) ASP
(iii) VB Scripting
(iv) JSP

(c) Write the expanded names for the following abbreviated terms used
in Networking and Communications : 2
(i) SMTP
(ii) VoIP
(iii) GSM
(iv) WLL
91 21 P.T.O.
(d) CASE STUDY BASED QUESTION :
Ayurveda Training Educational Institute is setting up its centre in
Hyderabad with four specialised departments for Orthopedics,
Neurology and Pediatrics along with an administrative office in
separate buildings. The physical distances between these
department buildings and the number of computers to be installed
in these departments and administrative office are given as follows.
You, as a network expert, have to answer the queries as raised by
them in (i) to (iv).

Shortest distances between various locations in metres :


Administrative Office to Orthopedics Unit 55
Neurology Unit to Administrative Office 30
Orthopedics Unit to Neurology Unit 70
Pediatrics Unit to Neurology Unit 50
Pediatrics Unit to Administrative Office 40
Pediatrics Unit to Orthopedics Unit 110
Number of Computers installed at various locations are as follows :
Pediatrics Unit 40
Administrative Office 140
Neurology 50
Orthopedics Unit 80

91 22
(i) Suggest the most suitable location to install the main server
of this institution to get efficient connectivity. 1

(ii) Suggest the best cable layout for effective network


connectivity of the building having server with all the other
buildings. 1

(iii) Suggest the devices to be installed in each of these buildings


for connecting computers installed within the building out of
the following : 1
 Gateway
 Modem
 Switch

(iv) Suggest the topology of the network and network cable for
efficiently connecting each computer installed in each of the
buildings out of the following : 1
Topologies : Bus Topology, Star Topology
Network Cable : Single Pair Telephone Cable, Coaxial Cable,
Ethernet Cable

91 23 00
P.T.O.

You might also like