0% found this document useful (0 votes)
9 views

Selfstudys Com File

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Selfstudys Com File

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

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 A
[Only for candidates, who opted for C++]

1. (a) Write the type of C++ tokens (keywords and user defined identifiers)
from the following : 2

(i) else

(ii) Long

(iii) 4Queue

(iv) _count

(b) The following C++ code during compilation reports errors as follows :

Error: ‘ofstream’ not declared


Error: ‘strupr’ not declared
Error: ‘strcat’ not declared
Error: ‘FIN’ not declared

Write the names of the correct header files, which must be included
to compile the code successfully : 1

void main()
{
ofstream FIN("WISH.TXT");
char TEXT2[]="good day";
char TEXT1[]="John!";

strupr(TEXT2);
strcat(TEXT1, TEXT2);
FIN<<TEXT1<<endl;
}

91 2
(c) Rewrite the following C++ code after removing any/all syntactical
errors with each correction underlined. 2
Note : Assume all required header files are already included in the
program.
Typedef Count int;
void main()
{
Count C;
cout<<"Enter the count:";
cin>>C;
for (K = 1; K<=C; K++)
cout<< C "*" K <<endl;
}

(d) Find and write the output of the following C++ program code : 3
Note : Assume all required header files are already included in the
program.

void Revert(int &Num, int Last=2)


{
Last=(Last%2==0)?Last+1:Last-1;
for(int C=1; C<=Last; C++)
Num+=C;
}
void main()
{
int A=20,B=4;
Revert(A,B);
cout<<A<<"&"<<B<<endl;
B--;
Revert(A,B);
cout<<A<<"#"<<B<<endl;
Revert(B);
cout<<A<<"#"<<B<<endl;
}

91 3 P.T.O.
(e) Find and write the output of the following C++ program code : 2
Note : Assume all required header files are already included in the
program.
#define Modify(N) N*3+10
void main()
{
int LIST[]={10,15,12,17};
int *P=LIST, C;
for(C=3; C>=0; C--)
LIST[I]=Modify(LIST[I]);

for (C=0; C<=3; C++)


{
cout<<*P<<":";
P++;
}
}
(f) Look at the following C++ code and find the possible output(s) from
the options (i) to (iv) following it. Also, write the highest and lowest
values that can be assigned in the array A. 2
Note :
 Assume all the required header files are already being included in
the code.
 The function random(n) generates an integer between 0 and n – 1.
void main()
{
randomize();
int A[4], C;
for(C=0; C<4; C++)
A[C]=random(C+1)+10;
for(C=3; C>=0; C--)
cout<<A[C]<<"@";
}

(i) (ii)
13@10@11@10@ 15$14$12$10$

(iii) (iv)
12@11@13@10@ 12@11@10@10@

91 4
2. (a) Which function(s) out of the following can be considered as
overloaded function(s) in the same program ? Also, write the reason
for not considering the other(s) as overloaded function(s). 2
void Execute(char A,int B); // Function 1
void Execute(int A,char B); // Function 2
void Execute(int P=10); // Function 3
void Execute(); // Function 4
int Execute(int A); // Function 5
void Execute(int &K); // Function 6

(b) Observe the following C++ code and answer the questions (i) and (ii).
Note : Assume all necessary files are included.

class FIRST
{
int Num1;
public:
void Display() //Member Function 1
{
cout<<Num1<<endl;
}
};

class SECOND: public FIRST


{
int Num2;
public:
void Display() //Member Function 2
{
cout<<Num2<<endl;
}
};
void main()
{
SECOND S;
_______________ //Statement 1
_______________ //Statement 2
}

91 5 P.T.O.
(i) Which Object Oriented Programming feature is illustrated by
the definitions of classes FIRST and SECOND ? 1

(ii) Write Statement 1 and Statement 2 to execute Member


Function 1 and Member Function 2 respectively using the
object S. 1

(c) Write the definition of a class CONTAINER in C++ with the


following description : 4

Private Members

- Radius, Height // float


- Type // int (1 for Cone,2 for Cylinder)
- Volume // float
- CalVolume() // Member function to calculate
// volume as per the Type

Type Formula to calculate Volume

1 3.14*Radius*Height

2 3.14*Radius*Height/3

Public Members
- GetValues() // A function to allow user to enter value
// of Radius, Height and Type. Also, call
// function CalVolume() from it

- ShowAll() // A function to display Radius, Height,


// Type and Volume of Container

91 6
(d) Answer the questions (i) to (iv) based on the following : 4

class Teacher
{
int TCode;
protected:
char Name[20];
public:
Teacher();
void Enter(); void Show();
};

class Course
{
int ID;
protected:
Char Title[30];
public:
Course();
void Initiate();
void Display();
};

class Schedule : public Course, private Teacher


{
int DD,MM,YYYY;
public:
Schedule();
void Start();
void View();
};
void main()
{
Schedule S;
}

91 7 P.T.O.
(i) Which type of Inheritance out of the following is illustrated
in the above example ?
Single Level Inheritance, Multilevel Inheritance, Multiple
Inheritance
(ii) Write the names of all the members, which are directly
accessible by the member function View() of class Schedule.
(iii) Write the names of all the members, which are directly
accessible by the object S of class Schedule declared in the
main() function.
(iv) What will be the order of execution of the constructors, when
the object S of class Schedule is declared inside the main()
function ?

3. (a) Write the definition of a function SumEO(int VALUES[], int N) in


C++, which should display the sum of even values and sum of odd
values of the array separately. 2
Example : If the array VALUES contains
25 20 22 21 53

Then the functions should display the output as :


Sum of even values = 42 (i.e., 20+22)
Sum of odd values = 99 (i.e., 25+21+53)

(b) Write a definition for a function UpperHalf(int Mat[4][4]) in C++,


which displays the elements in the same way as per the example
shown below. 3
For example, if the content of the array Mat is as follows :

25 24 23 22

20 19 18 17

15 14 13 12

10 9 8 7

91 8
The function should display the content in the following format :

25 24 23 22

20 19 18

15 14

10

(c) Let us assume Data[20][15] is a two-dimensional array, which is


stored in the memory along the row with each of its elements
occupying 2 bytes. Find the address of the element Data[10][5], if
the element Data[15][10] is stored at the memory location 15000. 3

(d) Write the definition of a member function AddPacket() for a class


QUEUE in C++, to remove/delete a Packet from a dynamically
allocated QUEUE of Packets considering the following code is
already written as a part of the program. 4

struct Packet
{
int PID;
char Address[20];
Packet *LINK;
};

class QUEUE
{
Packet *Front, *Rear;
public:
QUEUE(){Front=NULL;Rear=NULL;}
void AddPacket();
void DeletePacket();
~QUEUE();
};

91 9 P.T.O.
(e) Convert the following Infix expression to its equivalent Postfix
expression, showing the stack contents for each step of
conversion : 2

U * V + (W – Z) / X

4. (a) A text file named MATTER.TXT contains some text, which needs to
be displayed such that every next character is separated by a symbol
‘#’.
Write a function definition for HashDisplay() in C++ that would
display the entire content of the file MATTER.TXT in the desired
format. 3
Example :
If the file MATTER.TXT has the following content stored in it :
THE WORLD IS ROUND
The function HashDisplay() should display the following content :
T#H#E# #W#O#R#L#D# #I#S# #R#O#U#N#D#

(b) Write a definition for a function TotalTeachers( ) in C++ to read each


object of a binary file SCHOOLS.DAT, find the total number of
teachers, whose data is stored in the file and display the same.
Assume that the file SCHOOLS.DAT is created with the help of
objects of class SCHOOLS, which is defined below : 2
class SCHOOLS
{
int SCode; //School Code
char SName[20]; //School Name
int NOT; //Number of Teachers in the school

public:
void Display()
{cout<<SCode<<"#"<<SName<<"#"<<NOT<<endl;}
int RNOT(){return NOT;}
};

91 10
(c) Find the output of the following C++ code considering that the
binary file SCHOOLS.DAT exists on the hard disk with the
following records of 10 schools of the class SCHOOLS as declared in
the previous question (4 b). 1

SCode SName NOT

1001 Brains School 100

1003 Child Life School 115

1002 Care Share School 300

1006 Educate for Life School 50

1005 Guru Shishya Sadan 195

1004 Holy Education School 140

1010 Play School 95

1008 Innovate Excel School 300

1011 Premier Education School 200

1012 Uplifted Minds School 100

void main()
{
fstream SFIN;
SFIN.open("SCHOOLS.DAT",ios::binary ios::in);
SCHOOLS S;
SFIN.seekg(5*sizeof(S));
SFIN.read((char*)&S, sizeof(S));
S.Display();
cout<<"Record :"<<SFIN.tellg()/sizeof(S) + 1<<endl;
SFIN.close();
}

91 11 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.
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

General Instructions:
● The answers given in the marking scheme are SUGGESTIVE. Examiners are
requested to award marks for all alternative correct Solutions/Answers
conveying the similar meaning
● All programming questions have to be answered with respect to C++ Language /
Python only
● In C++ / Python, ignore case sensitivity for identifiers (Variable / Functions /
Structures / Class Names)
● In Python indentation is mandatory, however, number of spaces used for
indenting may vary
● In SQL related questions – both ways of text/character entries should be
acceptable for Example: “AMAR” and ‘amar’ both are acceptable.
● In SQL related questions – all date entries should be acceptable for Example:
‘YYYY-MM-DD’, ‘YY-MM-DD’, ‘DD-Mon-YY’, “DD/MM/YY”, ‘DD/MM/YY’,
“MM/DD/YY”, ‘MM/DD/YY’ and {MM/DD/YY} are correct.
● In SQL related questions – semicolon should be ignored for terminating the SQL
statements
● In SQL related questions, ignore case sensitivity.
SECTION A - (Only for candidates, who opted for C++)
1 (a) Write the type of C++ tokens (keywords and user defined identifiers) from the 2
following:
(i) ​else​ (ii) ​Long​ (iii) ​4Queue​ (iv) ​_count

Ans (i) keyword (ii) Identifier (iii) None (iv) Identifier


NOTE: Ignore (iii)
(Full 2 Marks for ALL correct answers - (i), (ii) and (iv))
(1½ Mark for any TWO correct answers out of (i), (ii) and (iv))
(1 Mark for any ONE correct answer out of (i), (ii) and (iv))

(b) The following C++ code during compilation reports errors as follows: 1
Error: ‘ofstream’ not declared
Error: ‘strupr’ not declared
Error: ‘strcat’ not declared
Error: ‘FIN’ not declared
Write the names of the correct header files, which must be included to compile
the code successfully:
void main()
{
ofstream FIN("WISH.TXT");
char TEXT2[]="good day";
char TEXT1[]="John!";

strupr(TEXT2);
strcat(TEXT1, TEXT2);
FIN<<TEXT1<<endl;
}

Page #1/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

Ans (i) fstream (ii) string

(½ Mark for writing each correct answer)


NOTE: Any other header file to be ignored

(c) Rewrite the following C++ code after removing any/all syntactical errors with 2
each correction underlined.
Note​: Assume all required header files are already included in the program.
Typedef Count int;
void main()
{
Count C;
cout<<"Enter the count:";
cin>>C;
for (K = 1; K<=C; K++)
cout<< C "*" K <<endl;
}

Ans typedef​ ​int Count​; //Error 1, Error 2


void main()
{
Count C;
​int K;​ //OR ​Count K;​ //Error 3
cout<<"Enter the count:";
cin>>C;
for (K = 1; K<=C; K++)
//​OR​ for (​int​ K = 1; K<=C; K++) //Error 3
//​OR ​for (​Count​ K = 1; K<=C; K++) //Error 3
cout<< C ​<< ​"*" ​<< ​K <<endl; //Error 4
//​OR​ cout<<​C * K​<<endl; //Error 4
}

(½ Mark for correcting each correct Error)


NOTE:
(1 Mark for only identifying all the errors correctly)

(d) Find and write the output of the following C++ program code: 3
Note​: Assume all required header files are already included in the program.
void Revert(int &Num, int Last=2)
{
Last=(Last%2==0)?Last+1:Last-1;
for(int C=1; C<=Last; C++)
Num+=C;
}

Page #2/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

void main()
{
int A=20,B=4;
Revert(A,B);
cout<<A<<"&"<<B<<endl;
B--;
Revert(A,B);
cout<<A<<"#"<<B<<endl;
Revert(B);
cout<<A<<"#"<<B<<endl;
}

Ans 35&4
38#3
38#9

(½ Mark for writing each correct value)


OR
(Only ½ Mark for writing all ‘&’ and ‘#’ at proper places)
Note:
● Deduct only ½ Mark for not considering any or all correct
placements of & and #
● Deduct only ½ Mark for not considering any or all line break

(e) Find and write the output of the following C++ program code: 2
Note​: Assume all required header files are already included in the program.
#define Modify(N) N*3+10
void main()
{
int LIST[]={10,15,12,17};
int *P=LIST, C;
for(C=3; C>=0; C--)
LIST[I]=Modify(LIST[I]);
for (C=0; C<=3; C++)
{
cout<<*P<<":";
P++;
}
}

Ans Considering ​LIST[I]​ being replaced with ​LIST[C]


40:55:46:61:

(½ Mark for writing each correct value)


Note:
● Deduct ½ Marks if the values are written in reverse order
● Full 2 marks for writing ​"​undeclared variable ​I"/"​Error​"​ / ​"​No
Output"​ ​. ​Ignore output if the error is mentioned.

Page #3/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

(f) Look at the following C++ code and find the possible output(s) from the options 2
(i) to (iv) following it. Also, write the highest and lowest values that can be
assigned in the array A.
Note​:
● Assume all the required header files are already being included in the code.
● The function random(n) generates an integer between 0 and n-1.
void main()
{
randomize();
int A[4], C;
for(C=0; C<4; C++)
A[C]=random(C+1)+10;
for(C=3; C>=0; C--)
cout<<A[C]<<"@";
}
(i) (ii)
13@10@11@10@ 15$14$12$10$
(iii) (iv)
12@11@13@10@ 12@11@10@10@

Ans (i) and (iv)


A​Min​ = 10 A​Max​ = 13

(1 Mark for writing the correct options)


OR
(½ Mark for writing only option (i) OR only option (iv))
NOTE: No marks to be awarded for writing any other option or any other
combination

(½ Mark for writing each correct Maximum and Maximum value in array A)

2. (a) Which function(s) out of the following can be considered as overloaded 2


function(s) in the same program? Also, write the reason for not considering the
other(s) as overloaded function(s).
void Execute(char A,int B); //Function 1
void Execute(int A,char B); //Function 2
void Execute(int P=10); //Function 3
void Execute(); //Function 4
int Execute(int A); //Function 5
void Execute(int &K); //Function 6

Ans Option [i]


Functions 1,2,3 are overloaded

Reason: Function 4,5,6 would give ambiguity for Function 3


OR Any equivalent valid reason
OR

Page #4/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

Option [ii]
Functions 1,2,4,5 are overloaded

Reason: Function 3 and 6 not considered in this case because it would give
redeclaration error for Function 5
OR Any equivalent valid reason

OR
Option [iii]
Functions 1,2,4,6 are overloaded

Reason: Function 3 and 5 not considered in this case because it would give
redeclaration error for Function 6
OR Any equivalent valid reason

(Full 2 Marks for any of the Options [i] / [ii] / [iii])

NOTE:
● Deduct ½ Mark for not stating the reason
● 1 Mark for partially correct answer

OR
(1 Mark for writing only any 2 Functions from Options [i] / [ii] / [iii])
(1½ Mark for writing only any 3 Functions from Options [ii] / [iii])

(b) Observe the following C++ code and answer the questions (i) and (ii).
Note​: Assume all necessary files are included.
class FIRST
{
int Num1;
public:
void Display() //Member Function 1
{
cout<<Num1<<endl;
}
};
class SECOND: public FIRST
{
int Num2;
public:
void Display() //Member Function 2
{
cout<<Num2<<endl;
}
};
void main()
{

Page #5/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

SECOND S;
___________________ //Statement 1
___________________ //Statement 2
}

(i) Which Object Oriented Programming feature is illustrated by the definitions of 1


classes FIRST and SECOND?

Ans Inheritance
OR
Encapsulation
OR
Data Abstraction
OR
Data Hiding

(1 Mark for writing any correct OOP feature from the given answers)

(ii) Write Statement 1 and Statement 2 to execute Member Function 1 and Member 1
Function 2 respectively using the object S.

Ans S.FIRST::Display()​ //Statement 1


S.Display()​ //Statement 2
OR
S.SECOND::Display()​ //Statement 2
(½ Mark for writing correct Statement 1)
(½ Mark for writing correct Statement 2)

(c) Write the definition of a class CONTAINER in C++ with the following description: 4
Private Members
- Radius,Height // float
- Type // int (1 for Cone,2 for Cylinder)
- Volume // float
- CalVolume() // Member function to calculate
// volume as per the Type
Type Formula to calculate Volume
1 3.14*Radius*Height
2 3.14*Radius*Height/3

Public Members
- GetValues() // A function to allow user to enter value
// of Radius, Height and Type. Also, call
// function CalVolume() from it.
- ShowAll() // A function to display Radius, Height,
// Type and Volume of Container

Ans class CONTAINER

Page #6/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

{
float Radius, Height;
int Type;
float Volume;
void CalVolume();
public:
void GetValues();
void ShowAll();
};

void CONTAINER::GetValues()
{
cin>>Radius>>Height>>Type ;
CalVolume();
}

void CONTAINER::ShowAll()
{
cout<<Radius<<Height<<Type<<Volume<<endl;
}
OR
void CONTAINER::CalVolume() void CONTAINER::CalVolume()
{ {
if (Type == 1) switch (Type)
Volume=3.14*Radius*Height; {
else if (Type == 2) case 1:
Volume=3.14*Radius*Height/3; Volume =3.14*Radius*Height;
} break;
case 2:
Volume=3.14*Radius*Height/3;
}
}

(½ Mark for declaring class header correctly)


(½ Mark for declaring data members correctly)
(1 Mark for defining CalVolume() correctly)
(½ Mark for taking inputs of Radius, Type and Height in GetValues())
(½ Mark for invoking CalVolume() inside GetValues())
(½ Mark for defining ShowAll() correctly)
(½ Mark for correctly closing class declaration with a semicolon ; )
NOTE:
● Marks to be awarded for defining the member functions inside or
outside the class
● Marks not to be deducted for replacing the Formulae for calculating

Page #7/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

the Volumes with correct Formulae

(d) Answer the questions (i) to (iv) based on the following: 4


class Teacher
{
int TCode;
protected:
char Name[20];
public:
Teacher();
void Enter(); void Show();
};
class Course
{
int ID;
protected:
Char Title[30];
public:
Course();
void Initiate();
void Display();
};
class Schedule: public Course, private Teacher
{
int DD,MM,YYYY;
public:
Schedule();
void Start();
void View();
};
void main()
{
Schedule S;
}
(i) Which type of Inheritance out of the following is illustrated in the above example?
Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance
Ans Multiple Inheritance

(1 Mark for writing correct option)

(ii) Write the names of all the members, which are directly accessible by the member
function View() of class Schedule.
Ans Start(), DD, MM, YYYY
Display(), Initiate(), Title
Enter(), Show(), Name
View() // Optional
(1 Mark for writing all correct member names )

Page #8/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

NOTE:
● Marks not to be awarded for partially correct answer
● Ignore the mention of Constructors
(iii) Write the names of all the members, which are directly accessible by the object S
of class Schedule declared in the main() function.
Ans View(), Start()
Display(), Initiate()
(1 Mark for writing all correct member names )
NOTE:
● Marks not to be awarded for partially correct answer
● Ignore the mention of Constructors
(iv) What will be the order of execution of the constructors, when the object S of class
Schedule is declared inside main() function?
Ans Course(), Teacher(), Schedule()

(1 Mark for writing correct order)


NOTE:
● No Marks to be awarded for any other combination/order.
● Names of the constructor/class without parentheses is acceptable
3 (a) Write the definition of a function SumEO(int VALUES[], int N) in C++, which 2
should display the sum of even values and sum of odd values of the array
separately.
Example: if the array VALUES contains
25 20 22 21 53

Then the functions should display the output as:


Sum of even values = 42 (i.e 20+22)
Sum of odd values = 99 (i.e 25+21+53)

Ans void SumEO(int VALUES[], int N)


{
int SE = 0, SO = 0;
​ for (int I=0;I<N;I++)
{
if(VALUES[I] %2 == 0)
SE += VALUES[I];
else
SO += VALUES[I];
}
cout<< "Sum of even values = " << SE<<endl;
cout<< "Sum of odd values = " << SO<<endl;
}
OR
Any other correct alternative code in C++
(½ Mark for correctly writing the loop)
(½ Mark for adding even elements)

Page #9/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

(½ Mark for adding odd elements)


(½ Mark for displaying the sum of even and odd elements)
(b) Write definition for a function ​UpperHalf(int Mat[4][4]) in C++, which displays the 3
elements in the same way as per the example shown below.
For example, if the content of the array Mat is as follows:
25 24 23 22
20 19 18 17
15 14 13 12
10 9 8 7
The function should display the content in the following format:
25 24 23 22
20 19 18
15 14
10

Ans void UpperHalf(int Mat[4][4])


{
for (int I=0;I<4;I++)
{
for (int J=0;J<4-I;J++)
cout<<MAT[I][J]<< " " ;
cout<<endl;
}
}
OR
void UpperHalf(int Mat[4][4])
{
for (int I=0;I<4;I++)
{
for (int J=0;J<4;J++)
if ((I+J)<=3)
cout<<MAT[I][J]<< " " ;
cout<<endl;
}
}
OR
Any other correct alternative code in C++
(½ Mark for correctly writing loop for traversing rows)
(½ Mark for correctly writing loop for traversing columns in each row)
(1 Mark for correctly checking elements for display)
(½ Mark for correctly displaying the selected elements)
(½ Mark for correctly displaying line break after each row)

(c) Let us assume Data[20][15] is a two dimensional array, which is stored in the 3
memory along the row with each of its element occupying 2 bytes, find the

Page #10/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

address of the element Data[10][5], if the element Data[15][10] is stored at the


memory location 15000.

Ans LOC(Data[10][5]) = LOC(Data[15][10])+2(15*(10-15)+(5-10))


= 15000 + 2((-75) + (-5))
= 15000 + 2(-80)
= 15000 - 160
= 14840
OR

LOC(Data[I][J]) = Base(Data)+W*(NC*(I-LBR)+(J-LBC))
Taking LBR=0, LBC=0
LOC(Data[15][10]) = Base(Data)+2*(15*15+10)
15000 = Base(Data)+2*(15*15+10)
Base(Data) = 15000 - 2*(235)
Base(Data) = 15000 - 470
Base(Data) = 14530

LOC(Data[10][5])= 14530 + 2*(10*15+5)


= 14530 + 2*(155)
= 14530 + 310
= 14840
OR

LOC(Data[I][J]) = Base(Data)+W*(NC*(I-LBR)+(J-LBC))
Taking LBR=1, LBC=1
LOC(Data[15][10]) = Base(Data)+2*(15*14+9)
15000 = Base(Data)+2*(15*14+9)
Base(Data) = 15000 - 2*(219)
Base(Data) = 15000 - 438
Base(Data) = 14562

LOC(Data[10][5])= 14562 + 2*(15*9+4)


= 14562 + 2*(139)
= 14562 + 278
= 14840
(1 Mark for writing correct formula (for Row major)
OR substituting formula with correct values)
(1 Mark for correct step calculations)
(1 Mark for final correct address)

NOTE:
● Marks to be awarded for calculating the address taking LBR and LBC = 1
(d) Write the definition of a member function AddPacket() for a class QUEUE in C++, 4
to remove/delete a Packet from a dynamically allocated QUEUE of Packets
considering the following code is already written as a part of the program.
struct Packet
{
int PID;
Page #11/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

char Address[20];
Packet *LINK;
};
class QUEUE
{
Packet *Front, *Rear;
public:
QUEUE(){Front=NULL;Rear=NULL;}
void AddPacket();
void DeletePacket();
~QUEUE();
};
Ans void QUEUE::AddPacket()
{
if(Front != NULL)
{
Packet *T;
T=Front;
cout<<Front->PID<<Front->Address<<" removed"<<endl;
//OR cout<<T->PID<<T->Address<<" removed"<<endl;
Front = Front->LINK;
delete T;
if (Front==NULL)
Rear=NULL;
}
else
cout<< "Queue Empty"<<endl;
}
OR
Any other equivalent code in C++
(1 Mark for checking EMPTY condition)
(½ Mark for declaring Packet T)
(½ Mark for assigning Front to T)
(½ Mark for deleting the previous Front Packet)
(½ Mark for changing LINK of Front)
(1 Mark for reassigning Rear with NULL if Queue becomes empty on
deletion)
NOTE:
● Marks should not be deducted if function header is written as
void QUEUE::DeletePacket()​instead of
void QUEUE::AddPacket()
● 4 Marks to be awarded if Addition of Packet is done in place of
Deletion according to the following distribution
● ( 1 Mark for creating a new Packet)
● ( ½ Mark for entering data for the new Packet)
● ( ½ Mark for assigning NULL to link of the new Packet)
● ( ½ Mark for assigning Front to the first Packet as Front = T)

Page #12/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

● ( ½ Mark for linking the last Packet to the new Packet as


Rear->LINK =T)
● ( 1 Mark for assigning Rear to the new Packet as Rear = T)
(e) Convert the following Infix expression to its equivalent Postfix expression, showing 2
the stack contents for each step of conversion:
U * V + (W - Z) / X
Ans ((U * V) + ((W - Z) / X))
INFIX STACK POSTFIX
U U
* * U
V * UV
) UV*
+ + UV*
W UV*W
- + - UV*W
Z + - UV*WZ
) + UV*WZ-
/ + / UV*WZ-
X + / UV*WZ-X
) + UV*WZ-X/
) UV*WZ-X/+
OR
U * V + (W - Z) / X
INFIX STACK POSTFIX
U U
* * U
V * UV
+ + UV*
( +( UV*
W +( UV*W
- +(- UV*W
Z +(- UV*WZ
) + UV*WZ-
/ +/ UV*WZ-
X +/ UV*WZ-X
UV*WZ-X/+

(½ Mark for conversion upto each operator illustrating through stack)


OR

Page #13/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

(1 Mark for only the final answer as ​UV*WZ-X/+ ​)


4. (a) A text file named ​MATTER.TXT contains some text, which needs to be displayed 3
such that every next character is separated by a symbol ‘#’.

Write a function definition for ​HashDisplay​() in C++ that would display the entire
content of the file ​MATTER.TXT​ in the desired format.
Example:
If the file MATTER.TXT has the following content stored in it:
THE WORLD IS ROUND

The function ​HashDisplay​() should display the following content:


T#H#E# #W#O#R#L#D# #I#S# #R#O#U#N#D#
Ans void HashDisplay()
{
char ch;
ifstream F("MATTER.TXT" );
while(F.get(ch))
cout<<ch<<'#';
F.close(); //IGNORE
}
OR
Any other correct function definition

(1 Mark for opening ​MATTER.TXT​ correctly)


(1 Mark for reading each character ​(using any method)​ from the file)
(½ Mark for displaying the character)
(½ Mark for displaying a # following the character)
(b) Write a definition for function TotalTeachers( ) in C++ to read each object of a 2
binary file SCHOOLS.DAT, find the total number of teachers, whose data is stored
in the file and display the same. Assume that the file SCHOOLS.DAT is created
with the help of objects of class SCHOOLS, which is defined below:
class SCHOOLS
{
int SCode; // School Code
char SName[20]; // School Name
int NOT; // Number of Teachers in the school
public:
void Display()
{cout<<SCode<<"#"<<SName<<"#"<<NOT<<endl;}
int RNOT(){return NOT;}
};
Ans void TotalTeachers()
{
ifstream F;
F.open("SCHOOLS.DAT",ios::binary);

Page #14/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

int Count=0;
SCHOOLS S;

while(F.read((char*)&S,sizeof(S)))
Count += S.RNOT();

cout<<"Total number of teachers :"<<Count<<endl;


F.close(); //IGNORE
}
OR
void TotalTeachers()
{
ifstream F;
F.open("SCHOOLS.DAT",ios::binary);
SCHOOLS S;
while(F.read((char*)&S,sizeof(S)))
cout<<S.RNOT()<<endl;//OR S.Display();
F.close(); //IGNORE
}
OR
Any other correct function definition
(½ Mark for opening ​SCHOOLS.DAT​ correctly)
(½ Mark for reading each record​ from the file)

(½ Mark for finding Total number of teachers)


(½ Mark for displaying Total number of teachers)
OR
(1 mark for displaying number of teachers in Each Record)
(c) Find the output of the following C++ code considering that the binary file 1
SCHOOLS.DAT exists on the hard disk with the following records of 10 schools of
the class SCHOOLS as declared in the previous question (4 b).
SCode SName NOT
1001 Brains School 100
1003 Child Life School 115
1002 Care Share School 300
1006 Educate for Life School 50
1005 Guru Shishya Sadan 195
1004 Holy Education School 140
1010 Rahmat E Talim School 95
1008 Innovate Excel School 300
1011 Premier Education School 200
1012 Uplifted Minds School 100
void main()
{

Page #15/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

fstream SFIN;
SFIN.open("SCHOOLS.DAT",ios::binary|ios::in);
SCHOOLS S;
SFIN.seekg(5*sizeof(S));
SFIN.read((char*)&S, sizeof(S));
S.Display();
cout<<"Record :"<<SFIN.tellg()/sizeof(S) + 1<<endl;
SFIN.close();
}
Ans 1004#Holy Education School#140
Record :7
(½ Mark for displaying correct values of Record 6 )
(½ Mark for displaying correct value of SFIN.tellg()/sizeof(B) + 1)

SECTION B - [Only for candidates, who opted for Python]


1 (a) Differentiate between Syntax Error and Run-Time Error? Also, write a suitable 2
example in Python to illustrate both.
Ans Syntax error​: An error of language resulting from code that does not conform to
the syntax of the programming language.
Example
a = 0
while a < 10 ​# : is missing as per syntax
a = a + 1
print a
Runtime error​: A runtime error is an error that causes abnormal termination of
program during running time..
Example
A=10
B=​int(raw_input("Value:"))
print A/B
# If B entered by user is 0, it will be run-time error
( ½ mark each for defining syntax error and run-time error )
( ½ mark for each correct example)
OR
( Full 2 Marks for illustrating both through examples)
(b) Name the Python Library modules which need to be imported to invoke the 1
following functions:
(i) ​sin()​ (ii) ​search​()

Ans (i) ​math​ (ii) ​re

(½ Mark for writing each correct Library module)

Note: Ignore any other Library modules, if mentioned.

Page #16/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

(c) Rewrite the following code in python after removing all syntax error(s). Underline 2
each correction done in the code.
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
Ans Val = int(raw_input("Value:")) # Error 1
Adder = 0

for C in range(1,Val,3)​ : ​ # Error 2


Adder+=C
if C%2==0:​ # Error 3
print C*10 # Error 4
else:​ # Error 5
print C ​ # Error 6
print Adder

OR
Corrections mentioned as follows:
raw_input in place of rawinput
: to be placed in for
== in place of =
print in place of Print
else in place of Else
C* is invalid, replaced by a suitable integer or C
(½ Mark for each correction, not exceeding 2 Marks)
OR
(1 mark for identifying the errors, without suggesting corrections)
(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

Page #17/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

Alpha= Alpha + Data[C-1]+"$"


Add = Add + Data[C]
print Times,Add,Alpha
Ans 1 20 P$
4 30 P$R$
9 60 P$R$S$
( 1 Mark for each correct line of output)

Note:
● ½ Mark deduction for not considering all line changes
(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()
Ans ( 190 : 120 )
( 50 : 75 )
( 130 : 250 )
( 1 mark for each correct line of output)
OR
( Full 3 marks to be awarded if ​"E ​ o Output​"​ in
​ rror​"​ / ​"N
print "(",self.P1.":",self.P2,")" is mentioned)

Note:
● Deduct ½ Mark for not writing any or all ':' / '(' / ')' symbol(s)
Page #18/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

● Deduct ½ Mark for not considering any or all line breaks at proper
place(s)
(f) What possible outputs(s) are expected to be displayed on screen at the time of 2
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.
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#

Ans (ii) 20#40#45# and (iii) 50#20#40#

Max value for BEGIN 3


Max value for LAST 4

(1 Mark for writing the correct options)


OR
(½ Mark for writing only option (ii))
OR
(½ Mark for writing only option (iii))
OR
(Full 2 Marks to be awarded if “ERROR”/ “NO OUTPUT” mentioned)

NOTE: No marks to be awarded for writing any other option or any other
combination

(½ Mark for writing correct Maximum value of BEGIN)


(½ Mark for writing correct Maximum value of LAST)

2 (a) What is the advantage of super() function in inheritance? Illustrate the same with 2
the help of an example in Python.
Ans In Python, super() function is used to call the methods of base class which have
been extended in derived class.
class person(object):
def __init__(self,name,age):
self.name=name
self.age=age
def display(self):

Page #19/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

print self,name, self.Age


class student(person):
def __init__(self,name,age,rollno,marks):
super(student,self)._init_(self, name, age)
self.rollno=rollno
self.marks=marks
def getRoll(self):
print self.rollno, self.marks
(1 mark for mentioning the advantage, 1 mark for writing any suitable
example)
(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
(i) What is the difference between the variable in Line 2 and Line 4 in the above
Python code?
Ans The variable in Line 2 is a class attribute. This belongs to the class itself.
These attributes will be shared by all the instances.
The variable in Line 4 is an instance attribute. Each instance creates a
separate copy of these variables.
(1 mark for correct difference)

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

Ans BMW Car


VOLVO Bus
(½ for writing each correct line of output)

(c) Define a class CONTAINER in Python with following specifications 4

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

Page #20/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

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
Ans class CONTAINER: # class CONTAINER():/class CONTAINER(Object):
def __init__(self): # def __init__(self,R,H,T,V):
self.Radius=0 # self.Radius=R
self.Height=0 # self.Height=H
self.Type =0 # self.Type=T
self.Volume=0 # self.Volume=V

def CalVolume(self):
if self.Type == 1:
self.Volume = 3.14 * self.Radius * self.Height
elif self.Type ==3:
self.Volume = 3.14 * self.Radius * self.Height /3
def GetValue(self):
self.Radius = input("Enter Radius")
self.Height = input("Enter Height")
self.Type = input("Enter type")
self.CalVolume() # OR CalVolume(self)
def ShowContainer(self):
print self.Radius
print self.Height
print self.Type
print self.Volume
(½ Mark for correct syntax for class header)
(½ Mark for correct declaration of instance attributes)
(1 Mark for correct definition of CalVolume() function)
(1 Mark for correct definition of GetValue() with proper invocation of
CalVolume( ))
(1 Mark for correct definition of ShowContainer())

Page #21/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

NOTE:
● Deduct ½ Mark if CalVolume() is not invoked properly inside NewBox()
function
● Marks not to be deducted for replacing the Formulae for calculating
the Volumes with correct Formulae
(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()
(i) Write the type of the inheritance illustrated in the above.

Ans Multiple Inheritance

Page #22/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

(1 Mark for writing correct Inheritance type)

(ii) Find and write the output of the above code.

Ans 3 6 9
OR
“Error” / “No Output”
(1 Mark for writing correct answer)

(iii) What are the methods shown in Line 1, Line 3 and Line 5 are known as?

Ans Constructors

(1 Mark for writing correct answer)

(iv) What is the difference between the statements shown in Line 6 and Line 7?

Ans Initializing the member of child class in Line 6 and calling the parent class
constructor in Line 7
(1 Mark for writing correct answer)

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


786, 234, 526, 132, 345, 467,
Show the content of 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.
Ans I Pass ​ 34, 526, 132, 345, 467, 786
2
II Pass ​234, ​132​, ​345​, 4​ 67​, ​526​, 786
III Pass ​ ​132​, 2​ 34​, 3
​ 45​, 467, 526, 786
(1 mark for each correct pass)

(b) Write definition of a method ​ZeroEnding(SCORES) to add all those values in the 3
list of SCORES, which are ending with zero (0) and display the sum.
For example,
If the SCORES contain [200,456,300,100,234,678]

The sum should be displayed as 600


Ans def ZeroEnding(SCORES):
s=0
for i in SCORES:
if i%10==0:
s=s+i
print s
( ½ mark for function header)
( ½ mark for initializing s (sum) with 0)

Page #23/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

( ½ mark for reading each element of the list using a loop)


( ½ mark for checking whether the value is ending with 0)
( ½ mark for adding it to the sum )
( ½ mark for printing or returning the value)
(c) Write AddClient(Client) and DeleteCleint(Client) methods in python to add a new 4
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.
Ans def AddClient(Client):
C=raw_input("Client name: ")
Client.append(C)
def DeleteClient(Client):
if (Client==[]):
print "Queue empty"
else:
print Client[0],"Deleted"
del Client[0] # OR Client.pop(0)
OR
class queue:
Client=[]
def AddClient(self):
a=raw_input("Client name: ")
queue.Client.append(a)
def DeleteClient(self):
if (queue.Client==[]):
print "Queue empty"
else:
print queue.Client[0],"Deleted"
del queue.Client[0]
( ½ mark insert header)
( ½ mark for accepting a value from user)
( ½ mark for adding value in list)
( ½ mark for delete header)
( ½ mark for checking empty list condition)
( ½ mark for displaying “Queue empty”)
( ½ mark for displaying the value to be deleted)
( ½ mark for deleting value from list)
(d) Write definition of a Method COUNTNOW(PLACES) to find and display those place 2
names, in which there are more than 5 characters.
For example:
If the list PLACES contains
["DELHI","LONDON","PARIS","NEW YORK","DUBAI"]
The following should get displayed
LONDON
NEW YORK
Ans def COUNTNOW(PLACES):

Page #24/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

for P in PLACES:
if len(P)>5:
print P
(1 Mark for correct loop)
(½ Mark for checking length of place name)
(½ Mark for display desired place names)
(e) Evaluate the following Postfix notation of expression: 2

22,11,/,5,10,*,+,12,-

Ans
Element Stack Contents
22 22
11 22, 11
/ 2
5 2, 5
10 2, 5, 10
* 2, 50
+ 52
12 52, 12
- 40
OR
Any other way of stepwise evaluation
(½ Mark for evaluation till each operator)
OR
(1 Mark for only writing the correct answer without showing stack
status)

4 (a) Write a statement in Python to open a text file STORY.TXT so that new contents 1
can be added at the end of it.
Ans file= open("STORY.TXT","a") ​OR​ file.open("STORY.TXT","a")

(1 mark for correct statement)

(b) Write a method in python to read lines from a text file INDIA.TXT, to find and 2
display the occurrence of the word “India”.
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

Page #25/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

Ans def display1():


c=0
file=open('INDIA.TXT','r')
c=0
for LINE in file:
Words = LINE.split()
for W in Words:
if W=="India":
c=c+1
print c
file.close()
OR
def display():
c=0
file=open('INDIA.TXT','r')

lines = file.read() # lines = file.readline()


while lines:
words = lines.split()
for w in words:
if w=="India":
c=c+1
lines = file.read() # lines = file.readline()
print c
file.close()

(½ Mark for opening the file)


(½ Mark for reading all lines, and dividing it into words)
(½ Mark for checking condition and incrementing count)
(½ Mark for displaying count)

Note: Ignore if try: except:


(c) Considering the following definition of class MULTIPLEX, write a method in python 3
to search and display all the content in a pickled file CINEMA.DAT, where MTYPE is
matching with the value ‘Comedy’.
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
Ans def Search():
file=open('CINEMA.DAT','rb')
try:
while True:
M=pickle.load(file)
if M.MTYPE=="Comedy":
M.Show()
except EOFError:
pass

Page #26/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

file.close()
(½ Mark for correct function header)
(½ Mark for opening the file CINEMA.DAT correctly)
(½ Mark for correct loop)
(½ Mark for correct load())
(½ Mark for correct checking of MTYPE)
(½ Mark for displaying the record)

SECTION C - (For all the candidates)


5 (a) Observe the following tables VIDEO and MEMBER carefully and write the name of 2
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.

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

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

Ans CARTESIAN PRODUCT

Page #27/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

OR Option (iv)
DEGREE = 5
CARDINALITY = 9
(1 Mark for writing CARTESIAN PRODUCT OR Option (iv))
(½ Mark for writing correct Degree)
(½ Mark for writing correct Cardinality)
(b) Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which 6
are based on the tables.

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.

Ans SELECT * FROM TRANSACT WHERE TYPE = ​'​Deposit​'​;

(½ Mark for correct SELECT statement)


(½ Mark for correct WHERE clause)
(ii) To display the ANO and AMOUNT of all Deposits and Withdrawals done in the
month of October 2017 from table TRANSACT.
Ans SELECT ANO,AMOUNT FROM TRANSACT
WHERE DOT >= ​'​2017-10-01​'​ AND DOT <= ​'​2017-10-31​'​;
OR
SELECT ANO,AMOUNT FROM TRANSACT
WHERE DOT BETWEEN ​'​2017-10-01​'​ AND ​'​2017-10-31​'​;
(½ Mark for correct SELECT statement)

Page #28/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

(½ Mark for correct WHERE clause)


Note:
● No marks to be deducted if MONTH() is used.
● No marks to be deducted if LIKE clause is used correctly.
(iii) To display the last date of transaction (DOT) from the table TRANSACT for the
Accounts having ANO as 103.
Ans SELECT MAX(DOT) FROM TRANSACT WHERE ANO = 103;
(½ Mark for correct SELECT statement)
(½ Mark for correct WHERE clause)
(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.
Ans SELECT ACCOUNT.ANO,ANAME,DOT FROM ACCOUNT,TRANSACT WHERE
ACCOUNT.ANO=TRANSACT.ANO AND AMOUNT <=3000;
OR
SELECT A.ANO,ANAME,DOT FROM ACCOUNT A,TRANSACT T WHERE
A.ANO=T.ANO AND AMOUNT <=3000;
(½ Mark for correct SELECT statement)
(½ Mark for correct WHERE clause)
NOTE:
● Marks not to be deducted for writing ​SELECT ANO ​instead of
SELECT ACCOUNT.ANO / SELECT A.ANO
(v) SELECT ANO, ANAME FROM ACCOUNT
WHERE ADDRESS NOT IN ('CHENNAI', 'BANGALORE');
Ans ANO​ ​ANAME
103 Ali Reza
105 Simran Kaur

OR
ANO​ ​ NAME
A
101 Nirja Singh
102 Rohan Gupta
103 Ali Reza
104 Rishabh Jain
105 Simran Kaur
(½ Mark for correct output)

(vi) SELECT DISTINCT ANO FROM TRANSACT;

Ans DISTINCT ANO


101
102
103

Page #29/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

(½ Mark for correct output)


NOTE: Values may be written in any order
(vii) SELECT ANO, COUNT(*), MIN(AMOUNT) FROM TRANSACT
GROUP BY ANO HAVING COUNT(*)> 1;
Ans ANO​ ​COUNT(*)​ ​MIN(AMOUNT)
101 2 2500
103 2 1000
(½ Mark for correct output)
NOTE: Values may be written in any order
(viii) SELECT COUNT(*), SUM(AMOUNT) FROM TRANSACT
WHERE DOT <= '2017-06-01';
Ans COUNT(*)​ ​ UM(AMOUNT)
S
2 5000
(½ Mark for correct output)

6 (a) State any one Absorption Law of Boolean Algebra and verify it using truth table. 2
Ans X + X . Y = X
Verification:
X Y X.Y X+X.Y
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1
OR
X . (X + Y)= X
Verification:
X Y X+Y X.(X+Y)
0 0 0 0
0 1 1 0
1 0 1 1
1 1 1 1

OR
X + X’ . Y = X + Y
Verification:
X Y X’ X’.Y X+X’.Y X+Y
0 0 1 0 0 0
0 1 1 1 1 1
1 0 0 0 1 1
1 1 0 0 1 1
OR

Page #30/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

X . (X’+ Y)= X . Y
Verification:
X Y X’ X’+ Y X.(X’+Y) X.Y
0 0 1 1 0 0
0 1 1 1 0 0
1 0 0 0 0 0
1 1 0 1 1 1

(1 Mark for stating any one Absorption Law correctly)


(1 Mark for correctly verifying the stated Law using Truth Table)
(b) Draw the Logic Circuit of the following Boolean Expression: 2
​(U’+V).(V’+W’)
Ans

(Full 2 Marks for drawing the Logic Circuit for the expression correctly)
OR
(½ Mark for drawing Logic circuit for (U’ + V) correctly)
(½ Mark for drawing Logic circuit for (V’ + W’) correctly)
(c) Derive a Canonical POS expression for a Boolean function FN, represented by the 1
following truth table:
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

Ans FN(X,Y,Z)= (X+Y’+Z).(X+Y’+Z’).(X’+Y+Z’).(X’+Y’+Z)


OR
FN(X,Y,Z)= ​∏​(2,3,5,6)
(1 Mark for correctly writing the POS form)
OR
(½ Mark for any two correct terms)
Note: Deduct ½ mark if wrong variable names are written in the expression

Page #31/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

(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)

OR

F(U,V,W,Z)= VZ + WZ + UVW’+ U’VW


(½ Mark for drawing K-Map and correctly plotting 1s in the given cells)
( ½ Mark each for 4 groupings)
( ½ Mark for writing final expression in reduced/minimal form)
Note:
● Deduct ½ mark if wrong variable names are used
7 (a) Differentiate between Bus Topology and Star Topology of Networks. What are the 2
advantages and disadvantages of Star Topology over Bus Topology?
Ans
Bus Topology Star Topology
It is characterised by common It is characterised by central
transmission medium shared by all the switching node connected directly
connected nodes. to each of multiple nodes in the
network.

OR
Bus Topology Star Topology

Page #32/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

Advantages of Star Topology over Bus Topology


● Faster communication as compared to Bus topology
● Independent line of connection allows freedom of removing or adding nodes
from the network

Disadvantages of Star Topology over Bus Topology


● Expensive as compared to Bus topology
● Long cable length

(1 Mark for writing any correct difference between Bus and Star
Topology)
(½ Mark for writing any correct advantage of Star Topology over Bus)
(½ Mark for writing any correct disadvantage of Star Topology over
Bus)
(b) Classify each of the following Web Scripting as Client Side Scripting and Server 2
Side Scripting:
(i) JavaScripting (ii) ASP (iii) VB Scripting (iv) JSP

Ans (i) Client Side Scripting / Server Side Scripting (ii) Server Side Scripting
(iii) Client Side Scripting (iv) Server Side Scripting
(½ Mark for writing each correct classification)
(c) Write the expanded names for the following abbreviated terms used in Networking 2
and Communications:
(i) SMTP (ii) VoIP (iii) GSM (iv) WLL
Ans (i) ​Simple Mail Transfer Protocol
(ii) Voice over Internet Protocol (Voice over IP)
(iii) Global System for Mobile Communication
(iv) Wireless Local Loop
(½ Mark for writing each correct expansion)
(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 as given as follows. You as a network

Page #33/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

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 the various locations are as follows:


Pediatrics Unit 40

Administrative Office 140

Neurology 50

Orthopedics Unit 80

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

Ans Administrative Office


(1 Mark for writing correct location)
(ii) Suggest the best cable layout for effective network connectivity of the building 1
having server with all the other buildings.

Page #34/35
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)

Ans

OR
Administrative Office is connected to Orthopedic, Radiology, Pediatrics units
directly in a Star Topology
(1 Mark for drawing/writing the layout correctly)
(iii) Suggest the devices to be installed in each of these buildings for connecting 1
computers installed within the building out of the following:
● Gateway
● Modem
● Switch
Ans Switch
(1 Mark for writing the correct device)
(iv) Suggest the topology of the network and network cable for efficiently connecting 1
each computer installed in each of the buildings out of the following:
Topologies : Bus topology, Star Topology
Network Cable: Single Pair Telephone Cable, Coaxial Cable, Ethernet Cable
Ans Topology : Star Topology
Network Cable: Ethernet Cable / Coaxial Cable
(½ Mark for writing the correct topology)
(½ Mark for writing the correct network cable)

Page #35/35

You might also like