Comp 2015 Qna PDF
Comp 2015 Qna PDF
Comp 2015 Qna PDF
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
er
er
!
!
SET-4
W
W
O
O
N
N
y
y
bu
bu
to
to
k
k
lic
lic
91
C
C
w
w
m
m
w
Series SSO Code No. w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
/
m
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.
o
.c
Please check that this question paper contains 7 questions.
Please write down the Serial Number of the question before
m
attempting it.
se
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
la
students will read the question paper only and will not write any answer on the
ag
answer-book during this period.
s.
COMPUTER SCIENCE
ol
ho
sc
Instructions :
://
(v) It is compulsory to mention on the page 1 in the answer book whether you
are attempting SECTION A or SECTION B.
PD
er
er
!
!
W
W
O
O
N SECTION A
N
y
y
bu
bu
to
to
k
k
lic
lic
[Only for candidates, who opted for C++]
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
1. (a) Find the correct identifiers out of the following, which can be used
for naming Variable, Constants or Functions in a C++ program : 2
For, while, INT, NeW, delete, 1stName, Add+Subtract, name1
(b) Observe the following program very carefully and write the
names of those header file(s), which are essentially needed to
/
compile and execute the following program successfully : 1
m
typedef char STRING[80];
o
void main()
.c
{
STRING Txt[] = “We love Peace”;
m
int Count=0;
se
while (Txt[Count]!=’\0’)
if (isalpha(Txt[Count]))
Txt[Count++]=’@’;
la
ag
else
Txt[Count++]=’#’;
s.
puts(Txt);
}
ol
(c) Observe the following C++ code very carefully and rewrite it after
ho
{
ht
int MySpeed
char Alert=’N’;
cin≫MySpeed;
if MySpeed>MaxSpeed
Alert=’Y’;
cout<<Alert<<endline;
}
91 2
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
N
N
y
(d) Write the output of the following C++ program code : 2
y
bu
bu
to
to
k
k
lic
lic
Note : Assume all required header files are already beingw . d o c u -tr a c k.c
C
C
w
w
m
m
w
w
w
o
o
.d o .c
c u -tr a c k
included in the program.
void Location(int &X,int Y=4)
{
Y+=2;
X+=Y;
}
void main()
/
m
{
int PX=10,PY=2;
o
Location(PY);
.c
cout<<PX<<”,”≪PY<<endl;
Location(PX,PY);
m
cout<<PX<<”,”≪PY<<endl;
se
}
(e) Write the output of the following C++ program code :
la 3
Note : Assume all required header files are already being
included in the program.
ag
class Eval
{
s.
char Level;
ol
int Point;
public:
ho
Eval(){Level=’E’;Point=0;}
void Sink(int L)
sc
{
Level-=L;
://
}
void Float(int L)
tp
{
Level+=L;
ht
Point++;
}
void Show()
{
cout<<Level<<”#”<<Point<<endl;
}
};
91 3 P.T.O.
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
N
N
y void main()
y
bu
bu
to
to
k
k
{
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
Eval E;
E.Sink(3);
E.Show();
E.Float(7);
E.Show();
E.Sink(2);
E.Show();
/
}
m
(f) Study the following program and select the possible output(s)
o
from the options (i) to (iv) following it. Also, write the maximum
.c
and the minimum values that can be assigned to the
variable VAL. 2
m
Note :
se
– Assume all required header files are already being included
in the program.
la
– random(n) function generates an integer between 0
and n-1.
ag
void main()
{
s.
randomize();
ol
int VAL;
VAL=random(3)+2;
ho
char GUESS[]=”ABCDEFGHIJK”;
for (int I=1;I<=VAL; I++)
sc
{
://
cout<<endl;
}
ht
91 4
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
2. N
(a) What is a copy constructor ? Give a suitable example in C++ to
N
y
y
bu
bu
to
to
illustrate with its definition within a class and a declaration of anw
k
k
lic
lic
C
C
w
w
m
m
w
w
w
o
o
.c .c
object with the help of it. 2
.d o .d o
c u -tr a c k c u -tr a c k
(b) Observe the following C++ code and answer the questions (i)
and (ii) :
class Passenger
{
long PNR;
/
m
char Name[20];
o
public:
.c
Passenger() //Function 1
m
{ cout<<”Ready”<<endl; }
se
void Book(long P,char N[]) //Function 2
{ PNR = P; strcpy(Name, N); } la
ag
void Print() //Function 3
s.
~Passenger() //Function 4
ho
{ cout≪”Booking cancelled!”≪endl; }
sc
};
void main()
{
ht
Passenger P;
___________ //Line 1
___________ //Line 2
}//Ends here
PD
er
er
!
!
W
W
O
O
N
(c) Write the definition of a class Photo in C++ with following
N
y
y
bu
bu
to
to
description : 4
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c . do .c
c u -tr a c k c u -tr a c k
Private Members
– Pno //Data member for Photo Number (an integer)
– Category //Data member for Photo Category (a string)
– Exhibit //Data member for Exhibition Gallery (a string)
– FixExhibit //A member function to assign
/
m
//Exhibition Gallery as per Category
//as shown in the following table
o
.c
Category Exhibit
m
Antique Zaveri
se
Modern Johnsen
Classic Terenida
la
ag
Public Members
s.
class Interior
tp
{
int OrderId;
ht
char Address[20];
protected:
float Advance;
public:
Interior();
void Book(); void View();
};
91 6
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
N
N
y
y
class Painting:public Interior
bu
bu
to
to
k
k
lic
lic
{
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
int WallArea,ColorCode;
protected:
char Type;
public:
Painting();
void PBook();
/
void PView();
m
};
o
class Billing : public Painting
.c
{
m
float Charges;
void Calculate();
se
public:
Billing(); la
ag
void Bill();
void BillPrint();
s.
};
ol
(ii) Write the names of all the data members, which are directly
tp
(iii) Write the names of all the member functions, which are
directly accessible from an object of class Billing.
91 7 P.T.O.
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
3. N
(a) Write the definition of a function Change(int P[ ], int N) in C++,
N
y
y
bu
bu
to
to
which should change all the multiples of 10 in the array to 10 andw .
k
k
lic
lic
C
C
w
w
m
m
w
w
w
o
o
.d o .c do .c
c u -tr a c k
rest of the elements as 1. For example, if an array of 10 integers is c u -tr a
ck
as follows : 2
P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
100 43 20 56 32 91 80 40 45 21
/
as follows :
m
P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
o
.c
10 1 10 1 1 1 10 10 1 1
m
(b) A two dimensional array ARR[50][20] is stored in the memory along
se
the row with each of its elements occupying 4 bytes. Find the
address of the element ARR[30][10], if the element ARR[10][5] is
stored at the memory location 15000.
la 3
ag
(c) Write the definition of a member function PUSH( ) in C++, to add a
new book in a dynamic stack of BOOKS considering the following
s.
struct BOOKS
ho
{
char ISBN[20], TITLE[80];
BOOKS *Link;
sc
};
://
class STACK
{
tp
BOOKS *Top;
ht
public:
STACK(){Top=NULL;}
void PUSH();
void POP();
~STACK();
};
91 8
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
N
(d) Write a function REVROW(int P[ ][5],int N,int M) in C++ to
N
y
y
bu
bu
to
to
display the content of a two dimensional array, with each roww .
k
k
lic
lic
C
C
w
w
m
m
w
w
w
o
o
.d o .c do .c
c u -tr a c k
content in reverse order. 3
c u -tr a c k
15 12 56 45 51
13 91 92 87 63
11 23 61 46 81
/
m
The function should display output as
o
51 45 56 12 15
.c
63 87 92 91 13
m
81 46 61 23 81
se
(e) Convert the following Infix expression to its equivalent Postfix
expression, showing the stack contents for each step of
conversion :
U * V + R/(S-T)
la 2
ag
4. (a) Write function definition for TOWER( ) in C++ to read the content of
s.
Note :
sc
Example :
tp
91 9 P.T.O.
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
N
(b) Write a definition for function COSTLY( ) in C++ to read each record
N
y
y
bu
bu
to
to
of a binary file GIFTS.DAT, find and display those items, which arew
k
k
lic
lic
C
C
w
w
m
m
w
w
w
o
o
.c c
priced more than 2000. Assume that the file GIFTS.DAT is created o c u -tr a c
.d o
c u -tr a c k
.d k.
/
m
cin>>CODE; gets (ITEM);cin>>PRICE;
}
o
void View()
.c
{
cout<<CODE<<”:”<<ITEM<<”:”<<PRICE<<endl;
m
}
float GetPrice(){return PRICE;}.
se
};
(c) Find the output of the following C++ code considering that the
la
binary file MEMBER.DAT exists on the hard disk with records of
ag
100 members : 1
class MEMBER
s.
{
int Mno; char Name[20];
ol
public:
void In();void Out();
ho
};
sc
void main()
{
://
fstream MF;
MF.open(“MEMBER.DAT”,ios::binary|ios::in);
tp
MEMBER M;
ht
MF.read((char*)&M, sizeof(M));
MF.read((char*)&M, sizeof(M));
MF.read((char*)&M, sizeof(M));
int POSITION= MF.tellg()/sizeof(M);
cout<<”PRESENT RECORD:”<<POSITION<<endl;
MF.close();
}
91 10
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
4. N
(a) Differentiate between the following : 1
N
y
y
bu
bu
to
to
k
k
lic
lic
(i)
C
C
f = open('diary.txt', 'a')
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
(b) Write a method in python to read the content from a text file
story.txt line by line and display the same on screen. 2
/
in python to write the content in a pickled file student.dat. 3
o m
class Student:
.c
def ___init___(self,A,N):
m
self.Admno=A
se
self.Name=N
def Show(self):
la
ag
print(self.Admno,"#",self.Name)
s.
ol
SECTION C
ho
5. (a) Observe the following table carefully and write the names of the
most appropriate columns, which can be considered as (i) candidate
://
Transaction
Code Item Qty Price
Date
ht
91 15 P.T.O.
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
N
N
y (b) Consider the following DEPT and EMPLOYEE tables. Write SQL
y
bu
bu
to
to
k
k
lic
lic
queries for (i) to (iv) and find outputs for SQL queries (v) to (viii). w . d o c 6a c k.c
C
C
w
w
m
m
w
w
w
o
o
.d o .c
c u -tr a c k u -tr
Table : DEPT
/
m
D03 MEDIA MUMBAI
o
D05 FINANCE KOLKATA
.c
D04 HUMAN RESOURCE MUMBAI
m
se
Table : EMPLOYEE
Birth of employees.
(ii) To display the Name of all the MALE employees from the
table EMPLOYEE.
91 16
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
N
(iii) To display the Eno and Name of those employees from the
N
y
y
bu
bu
to
to
table EMPLOYEE who are born between ‘1987-01-01’ andw .
k
k
lic
lic
C
C
w
w
m
m
w
w
w
o
o
.d o .c do .c
c u -tr a c k
‘1991-12-01’. c u -tr a c k
/
(vi) SELECT DISTINCT DEPARTMENT FROM DEPT;
m
(vii) SELECT NAME,DEPARTMENT FROM EMPLOYEE E,DEPT D
o
WHERE E.DCODE=D.DCODE AND ENO<1003;
.c
(viii) SELECT MAX(DOJ), MIN(DOB) FROM EMPLOYEE;
m
se
6. (a) Verify the following using Boolean Laws : 2
U’+V = U’V’+ U’.V + U.V
la
(b) Draw the Logic Circuit for the following Boolean Expression : 2
ag
(X’+Y).Z + W’
s.
P Q R F(P,Q,R)
0 0 0 1
sc
0 0 1 0
0 1 0 0
://
0 1 1 1
tp
1 0 0 1
1 0 1 0
ht
1 1 0 0
1 1 1 1
F(X,Y,Z,W)=(0,1,4,5,6,7,8,9,11,15)
91 17 P.T.O.
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
7. N
(a) Illustrate the layout for connecting 5 computers in a Bus and a Star
N
y
y
bu
bu
to
to
k
k
topology of Networks. 1
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d .c
c u -tr a c k o c u -tr a c k
(b) What kind of data gets stored in cookies and how is it useful ? 1
/
Fiber
m
(e) What is Trojan Horse ? 1
o
(f) Out of the following, which all comes under cyber crime ? 1
.c
(i) Stealing away a brand new hard disk from a showroom.
m
(ii) Getting in someone’s social networking account without his
se
consent and posting on his behalf.
(iii) Secretly copying data from server of an organization and
la
selling it to the other organization.
(iv) Looking at online activities of a friends blog.
ag
91 18
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
er
er
!
!
W
W
O
O
N
Shortest distances between various buildings :
N
y
y
bu
bu
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k
ADMIN to SCIENCE 65 m c u -tr a c k
ADMIN to ARTS 60 m
SCIENCE to BUSINESS 75 m
/
m
SCIENCE to ARTS 60 m
o
BUSINESS to ARTS 50 m
.c
DELHI Head Office to HYDERABAD Campus 1600 Km
m
se
Number of computers installed at various buildings are as follows :
ADMIN
la 100
ag
SCIENCE 85
s.
BUSINESS 40
ol
ARTS 12
ho
(i) Suggest the most appropriate location of the server inside the
://
PD
er
er
!
!
W
W
O
O
N
N
y
(iv) Which of the following will you suggest to establish
y
bu
bu
to
to
k
k
lic
lic
the online face-to-face communication between the peoplew . d o c u -tr a c k.c
C
C
w
w
m
m
w
w
w
o
o
.d o .c
c u -tr a c k
(i) E-mail
/
(iii) Video Conferencing
m
(iv) Cable TV
o
.c
m
se
la
ag
s.
ol
ho
sc
://
tp
ht
91 20 96,000
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD
PD
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
General Instructions:
● The answers given in the marking scheme are SUGGESTIVE, Examiners are
requested to award marks for all alternative correct solutions/answers
conveying similar meaning.
● All programming questions have to be answered with respect to C++
Language for Section A and Python for Section B (All presently supported
versions of compilers/interpreters should be considered).
● In C++/Python, ignore case sensitivity for identifiers (Variable / Functions
/ Structures / Class Names)
unless explicitly specified in question
.
● In SQL related questions :
○ Both ways of text/character entries should be acceptable. For
example: “AMAR” and ‘amar’ both are acceptable.
/
○ All date entries should be acceptable for example: ‘YYYY‐MM‐DD’,
om
‘YY‐MM‐DD’, ‘DD‐Mon‐YY’, “DD/MM/YY”, ‘DD/MM/YY’, “MM/DD/YY”,
‘MM/DD/YY’ and {MM/DD/YY} are correct.
○ Semicolon should be ignored for terminating the SQL statements.
.c
○ Ignore case sensitivity for commands.
○ Ignore headers in output questions.
m
Section ‐ A
se
la
(Only for C++ candidates)
ag
1 (a) Find the correct identifiers out of the following, which can be 2
used for naming Variable, Constants or Functions in a C++
s.
program:
For, while, INT, NeW, delete, 1stName, Add+Subtract, name1
ol
ho
Ans For, INT, NeW, name1
Note:
● Deduct ½ Mark for writing additional incorrect
://
identifier(s)
● No marks to be awarded if all the identifiers are
tp
mentioned
ht
(b) Observe the following program very carefully and write the name 1
of those header file (s), which are essentially needed to compile
and execute the following program successfully:
typedef char STRING[80];
void main()
{
STRING Txt[] = "We love Peace";
int Count=0;
while (Txt[Count]!='\0')
Page 1 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
if (isalpha(Txt[Count]))
Txt[Count++]='@' ;
else
Txt[Count++]='#' ;
puts (Txt) ;
}
Ans ctype, stdio
/
(c) Observe the following C++ code very carefully and rewrite it 2
om
after removing any/all syntactical errors with each correction
underlined.
Note: Assume all required header files are already being included
.c
in the program.
m
#Define float MaxSpeed=60.5;
void main()
{
int MySpeed
se
la
char Alert='N' ;
ag
cin»MySpeed;
if MySpeed>MaxSpeed
Alert='Y' ;
s.
cout<<Alert<<endline;
}
ol
Ans
#definefloat
MaxSpeed ;
60.5 //Error 1,2,3
ho
void main()
{
sc
;
int MySpeed //Error 4
char Alert='N';
://
cin>>MySpeed;
if
(MySpeed>MaxSpeed)
//Error 5
tp
Alert=’Y’;
cout<<Alert<<
endl;
//Error 6
ht
Page 2 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
void Location(int &X,int Y=4)
{
Y+=2;
X+=Y;
}
void main()
{
int PX=l0,PY=2;
Location(PY) ;
cout<<PX<<" , "<<PY<<endl ;
Location(PX,PY);
/
cout<<PX<<" , "<<PY<<endl ;
om
}
Ans 10, 8
.c
20, 8
m
(½ Mark for each correct value )
Note:
● Deduct
proper place(s)
● Deduct
se
½ Mark for not considering any or all endl(s) at
in the program.
class Eval
ol
{
ho
char Level;
int Point;
public:
sc
Eval() {Level='E';Point=0;}
void Sink(int L)
://
{
Level=L;
tp
}
void Float(int L)
ht
{
Level += L;
Point++;
}
void Show()
{
cout<<Level<<"#"<<Point<<endl;
}
};
Page 3 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
void main()
{
Eval E;
E.Sink(3);
E.Show();
E.Float(7);
E.Show();
E.Sink(2);
E.Show();
}
Ans B#0
/
om
I#1
G#1
.c
(1 Mark for each correct line of output)
Note:
m
● Deduct ½ Mark for not considering any or all endl(s) at
proper place(s)
● Deduct
se
½ Mark for not writing any or all # symbol(s)
la
(f) Study the following program and select the possible output(s) 2
from the option (i) to (iv) following it. Also, write the maximum
ag
the program.
‐random(n) function generates an integer between 0 and n‐1.
ho
void main()
{
randomize();
sc
int VAL;
VAL=random(3)+2;
://
char GUESS[]="ABCDEFGHIJK";
for (int I=l;I<=VAL;I++)
{
tp
for(int J=VAL;J<=7;J++)
cout«GUESS[J];
ht
cout«endl;
}
}
(i) (ii) (iii) (iv)
BCDEFGH CDEFGH EFGH FGHI
BCDEFGH CDEFGH EFGH FGHI
EFGH FGHI
EFGH FGHI
Page 4 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
Ans (ii) and (iii)
Min Value of VAL = 2
Max Value of VAL = 4
/
om
2. (a) What is a copy constructor? Give a suitable example in C++ to 2
illustrate with its definition within a class and a declaration of an
.c
object with the help of it.
m
Ans A copy constructor is an overloaded constructor in which an
class Point
{
se
object of the same class is passed as reference parameter.
la
int x;
ag
public:
Point(){x=0;}
Point(Point &p) // Copy constructor
s.
{x = p.x;}
:
ol
};
ho
void main()
{
sc
Point p1;
Point p2(p1);//Copy constructor is called here
://
//OR
Point p3=p1;//Copy constructor is called here
tp
}
ht
Page 5 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
(b) Observe the following C++ code and answer the questions (i) and
(ii) :
class Passenger
{
long PNR;
char Name [20] ;
public:
Passenger() //Function 1
{ cout<<"Ready"<<endl; }
void Book(long P,char N[]) //Function 2
/
{ PNR = P; strcpy(Name, N); }
om
void Print() //Function 3
{ cout«PNR << Name <<endl; }
.c
~Passenger() //Function 4
m
{ cout<<"Booking cancelled!"<<endl; }
};
se
(i) Fill in the blank statements in Line 1 and Line 2 to execute 1
la
Function 2 and Function 3 respectively in the following code:
void main()
ag
{
Passenger P;
s.
___________ //Line 1
___________ //Line 2
ol
}//Ends here
ho
Ans P.Book(1234567,”Ravi”); //Line 1
P.Print(); //Line 2
sc
function referred as ?
ht
Ans Function 4
OR
~Passenger()
It is a Destructor function.
Page 6 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
/
//as shown in the following table
om
Category Exhibit
Antique Zaveri
Modern Johnsen
.c
Classic Terenida
m
Public Members
Register()//A function to allow user to enter
//values
se
//Pno,Category and call FixExhibit()
//function
la
ViewAll()//A function to display all the data
ag
//members
Ans class Photo
s.
{
int Pno;
ol
char Category[20];
ho
char Exhibit[20];
void FixExhibit();
public:
sc
void Register();
void ViewAll();
://
};
void Photo::FixExhibit()
tp
{
if(strcmpi(Category,”Antique”)==0)
ht
strcpy(Exhibit,”Zaveri”);
else if(strcmpi(Category,”Modern”)==0)
strcpy(Exhibit,”Johnsen”);
else if strcmpi(Category,”Classic”)==0)
strcpy(Exhibit,”Terenida”);
}
void Photo::Register()
{
cin>>Pno;
gets(Category);
Page 7 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
FixExhibit();
}
void Photo:: ViewAll()
{
cout<<Pno<<Category<<Exhibit<<endl;
}
/
invocation of FixExhibit() function)
om
(1 Mark for correct definition of ViewAll())
NOTE:
● Deduct ½ Mark if FixExhibit() is not invoked properly
.c
inside Register() function
● No marks to be deducted for defining Member Functions
m
inside the class
(d)
● strcmp()/strcmpi() acceptable
se
Answer the questions (i) to (iv) based on the following: 4
la
class Interior
{
ag
int OrderId;
char Address[20];
s.
protected:
float Advance;
ol
public:
Interior();
ho
void Book(); void View();
};
sc
class Painting:public Interior
{
://
int WallArea,ColorCode;
protected:
tp
char Type;
public:
ht
Painting();
void PBook();
void PView();
};
class Billing:public Painting
{
float Charges;
void Calculate();
Page 8 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
public:
Billing();
void Bill();
void BillPrint();
};
/
Ans Multi Level Inheritance
om
(1 Mark for mentioning correct option)
(ii) Write the names of all the data members, which are directly
.c
accessible from the member functions of class Painting.
m
Ans WallArea, ColorCode,Type, Advance
Page 9 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
100 43 20 56 32 91 80 40 45 21
After executing the function, the array content should be
changed as follows:
P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
10 1 10 1 1 1 10 10 1 1
/
Ans void Change(int P[ ],int N)
om
{
for (int i=0;i<N;i++)
if(P[i]%10==0)
.c
P[i]=10;
else
m
P[i]=1;
}
OR se
la
Any other correct equivalent function definition
ag
along the row with each of its elements occupying 4 bytes. Find
the address of the element ARR[30][10], if the element
://
Ans Loc(ARR[I][J]) along the row
=BaseAddress + W [( I – LBR)*C + (J – LBC)]
ht
(where C is the number of columns, LBR = LBC = 0
LOC(ARR[10][5])
= BaseAddress + W [ I*C + J]
15000 = BaseAddress + 4[10*20 + 5]
= BaseAddress + 4[200 + 5]
= BaseAddress + 4 x 205
= BaseAddress + 820
BaseAddress = 15000820
= 14180
LOC(ARR[30][10])= 14180 + 4[30 * 20 + 10]
= 14180 + 4 * 610
Page 10 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
= 14180 + 2440
= 16620
OR
LOC(ARR[30][10])
= LOC(ARR[10][5])+ W[( ILBR)*C + (JLBC)]
= 15000 + 4[(3010)*20 + (105)]
= 15000 + 4[ 20*20 + 5]
= 15000 + 4 *405
= 15000 + 1620
= 16620
OR
/
Where C is the number of columns and LBR=LBC=1
om
LOC(ARR[10][5])
15000 = BaseAddress + W [( I1)*C + (J1)]
= BaseAddress + 4[9*20 + 4]
.c
= BaseAddress + 4[180 + 4]
= BaseAddress + 4 * 184
m
= BaseAddress + 736
BaseAddress = 15000 736
= 14264
LOC(ARR[30][10]) se
la
= 14264 + 4[(301)*20 + (101)]
= 14264 + 4[29*20 + 9]
ag
= 14264 + 4[580 + 9]
= 14264 + 4*589
s.
= 14264 + 2356
= 16620
ol
struct BOOKS
{
ht
char ISBN[20], TITLE[80];
BOOKS *Link;
};
class STACK
{
BOOKS *Top;
public:
STACK()
{Top=NULL;}
void PUSH();
Page 11 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
void POP();
~STACK();
};
Ans void STACK::PUSH()
{
BOOKS *Temp;
Temp=new BOOKS;
gets(Temp>ISBN);
gets(Temp>TITLE);
Temp>Link=Top;
Top=Temp;
/
om
}
OR
Any other correct equivalent function definition
.c
(1 Mark for creating a new node of BOOKS dynamically)
( ½ Mark for entering value of ISBN)
m
( ½ Mark for entering value of TITLE)
(1 Mark for linking the new node of BOOKS to the Top )
(d)
se
(1 Mark for making the new node of BOOKS as Top)
Write a function REVROW(int P[][5],int N, int M) in C++ to 3
la
display the content of a two dimensional array, with each row
ag
51 45 56 12 15
63 87 92 91 13
81 46 61 23 81
sc
Ans
void REVROW(int P[][5],int N,int M)
://
{
for(int I=0; I<N; I++)
tp
{ for(int J=M1; J>=0; J)
cout<<P[I][J];
ht
cout<<endl;
}
}
OR
void REVROW(int P[ ][5],int N,int M)
{
for(int I=0; I<N; I++)
{
for(int J=0; J<M/2; J++)
{
Page 12 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
int T = P[I][J];
P[I][J] = P[I][MJ1];
P[I][MJ1] = T;
}
}
for(I=0; I<N; I++)
{
for(int J=0; J<M; J++)
cout<<P[I][J];
cout<<endl;
}
/
}
om
( 1 Mark for correct nesting of loop(s))
( 1½ Mark for correct logic for reversing the content of each
.c
row)
( ½ Mark for correctly displaying the content)
m
Note: N and M can be written interchangeably for number of
rows and columns
(e) se
Convert the following infix expression to its equivalent Postfix 2
expression, showing the stack contents for each step of
la
conversion.
ag
U * V + R/ (ST)
Ans U * V + R/ (ST)
s.
= ((U * V)+(R/(ST)))
Element Stack Postfix
ol
(
ho
(
U U
sc
* *
V UV
://
) UV*
+ +
tp
(
ht
R UV*R
/ +/
(
S UV*RS
+/
T UV*RST
) UV*RST
) UV*RST/
) UV*RST/+
Page 13 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
OR
Element Stack Postfix
U U
* * U
V * UV
+ + UV*
R + UV*R
/ +/ UV*R
( +/( UV*R
S +/( UV*RS
/
+/( UV*RS
om
T +/( UV*RST
) +/ UV*RST
.c
+ UV*RST/
UV*RST/+
m
OR
Any other method for converting the given Infix expression to its
se
equivalent Postfix expression showing stack contents
la
( ½ mark for converting expression up to each operator)
OR
ag
4 (a) Write function definition for TOWER() in C++ to read the content
ol
Note :
‐ The word TOWER should be an independent word
‐ Ignore type cases (i.e. lower/upper case)
sc
Example:
If the content of the file WRITEUP.TXT is as follows:
://
Tower of hanoi is an interesting problem.
tp
Mobile phone tower is away from here. Views
from EIFFEL TOWER are amazing.
ht
The function TOWER () should display the following:
3
Ans void TOWER()
{
int count=0;
ifstream f("WRITEUP.TXT");
char s[20];
Page 14 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
while (!f.eof())
{
f>>s;
if (strcmpi(s,”TOWER”)==0)
count++;
}
cout<<count;
f.close();
}
OR
Any other correct function definition
/
om
(½ Mark for opening WRITEUP.TXT correctly)
(½ Mark for reading each word (using any method) from the
file)
.c
(½ Mark for comparing the word with TOWER)
(½ Mark for displaying correct count of TOWER)
m
NOTE:
se
(½ Mark to be deducted if TOWER is compared without ignoring
the case)
la
(b) Write a definition for function COSTLY() in C++ to read each 3
ag
defined below:
ol
class GIFTS
ho
{
int CODE;char ITEM[20]; float PRICE;
public:
sc
void Procure()
{
://
cin>>CODE; gets(ITEM);cin>>PRICE;
}
tp
void View()
{
ht
cout<<CODE<<":"<<ITEM<<":"<<PRICE<<endl;
}
float GetPrice() {return PRICE;}
};
Ans void COSTLY()
{
GIFTS G;
ifstream fin(“GIFTS.DAT”,ios::binary);
while (fin.read((char *)&G,sizeof(G)))
Page 15 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
{
if(G.GetPrice()>2000)
G.View();
}
fin.close();
}
OR
Any other correct equivalent function definition
(½
Mark for opening GIFTS.DAT correctly)
(1 Mark for reading all records from the file)
(1 Mark for checking value of PRICE > 2000 )
/
om
(½ Mark for displaying the desired items)
(c) Find the output of the following C++ code considering that the
binary file MEMBER.DAT exists on the hard disk with records of
.c
100 members: 1
m
class MEMBER
{
int Mno; char Name[20];
public:
void In();void Out();
se
la
};
ag
void main()
{
fstream MF;
s.
MF.open("MEMBER.DAT”,ios::binary|ios::in);
MEMBER M;
ol
MF.read((char*)&M,sizeof(M));
ho
MF.read((char*)&M,sizeof(M));
MF.read((char*)&M,sizeof(M));
int POSITION=MF.tellg()/sizeof(M);
sc
cout<<"PRESENT RECORD:"<<POSITION<<endl;
MF.close();
://
}
tp
Ans PRESENT RECORD: 3
ht
Page 16 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
Section ‐ B
(Only for Python candidates)
1 (a) How is __init( ) __different from __del ( )__ ? 2
Ans __init__()
is the class constructor or initialization method
which is automatically invoked when we create a new instance of a
class.
/
For Example:
om
class Sample:
def __init__(self):
.c
self.data = 79
print('Data:',self.data,'created')
m
def __del__(self):
se
print('Data:',self.data,'deleted')
s = Sample()
la
del s
ag
Ans
://
isalpha()
len()
tp
(c) Rewrite the following code in python after removing all syntax
error(s). Underline each correction done in the code. 2
def Sum(Count) #Method to find sum
S=0
for I in Range(1,Count+1):
S+=I
RETURN S
print Sum[2] #Function Call
Page 17 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
print Sum[5]
Ans :
def Sum(Count) #Method to find sum #Error 1
S=0
for I in
range
(1,Count+1): #Error 2
S+=I
return
S #Error 3
print Sum
(2)
#Function Call #Error 4
print Sum
(5)
#Error 4
/
om
(½ Mark for each correction)
OR
(1 mark for identifying all the errors, without suggesting
.c
corrections)
m
(d) Find and write the output of the following python code : 2
for Name in ['John','Garima','Seema','Karan']:
print Name
if Name[0]== 'S':
se
la
break
ag
else :
print 'Completed!'
print 'Weldone!'
s.
Ans John
ol
Garima
Seema
ho
Weldone!
(½ Mark for each correct line)
sc
Note:
://
(e) Find and write the output of the following python code: 3
ht
class Emp:
def __init__(self,code,nm): #constructor
self.Code=code
self.Name=nm
def Manip (self) :
self.Code=self.Code+10
self.Name='Karan'
def Show(self,line):
print self.Code,self.Name,line
s=Emp(25,'Mamta')
Page 18 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
s.Show(1)
s.Manip()
s.Show(2)
print s.Code+len(s.Name)
Ans 25 Mamta 1
35 Karan 2
40
(1 Mark for each correct line)
Note:
/
om
Deduct ½ Mark for not considering any or all line break(s) at
proper place(s).
(f) What are the possible outcome(s) executed from the following 2
.c
code? Also specify the maximum and minimum values that can be
assigned to variable COUNT.
m
TEXT="CBSEONLINE"
COUNT=random.randint(0,3)
C=9
se
la
while TEXT[C]!='L':
print TEXT[C]+TEXT[COUNT]+'*',
ag
COUNT=COUNT+1
C=C1
s.
(i) (ii) (iii) (iv)
EC*NB*IS* NS*IE*LO* ES*NE*IO* LE*NO*ON*
ol
Ans (i) EC*NB*IS*
ho
(iii) ES*NE*IO*
Minimum COUNT = 0 Maximum COUNT = 3
sc
Note:
● Deduct ½ mark for writing each
additional
option along
tp
2 (a) Illustrate the concept inheritance with the help of a python code 2
Ans class Base:
def __init__ (self):
print "Base Constructor at work..."
def show(self):
print "Hello Base"
Page 19 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
class Der(Base):
def __init__(self):
print "Derived Constructor at work..."
def display(self):
print "Hello from Derived"
(b) What will be the output of the following python code ? Explain 2
the try and except used in the code.
/
om
A=0
B=6
print 'One'
try:
.c
print 'Two'
m
X=B/A
Print 'Three'
except ZeroDivisionError:
print B*2
print 'Four'
se
la
except:
ag
print B*3
print 'Five'
s.
ANS One
Two
ol
12
ho
Four
The code written within try triggers the exception written after
sc
OR
Any other correct explanation for usage of try and except
tp
Page 20 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
# Gallery as per Category as
# shown in the following table
Category Exhibit
Antique Zaveri
Modern Johnsen
Classic Terenida
Register() # A function to allow user
# to enter values of Pno, Category
# and call FixExhibit() method
ViewAll{) # A function to display all the data
/
# members
om
Ans class PHOTO:
Pno=0
.c
Category=" "
Exhibit=" "
m
def FixExhibit():
if self.Category=="Antique":
self.Exhibit="Zaveri"
se
elif self.Category=="Modern":
la
self.Exhibit="Johnsen"
elif self.Category=="Classic":
ag
self.Exhibit="Terenida"
def Register():
self.Pno=int(input("Enter Pno:"))
s.
self.Category=input("Enter Name:")
self.FixExhibit()
ol
def ViewAll()
print self.Pno,self.Category,self.Exhibit
ho
NOTE:
ht
Page 21 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
/
Government
om
(1 Mark for correct definition of Operator overloading)
(1 Mark for correct example of Python code to illustrate
.c
Operator overloading)
m
(e) Write a method in python to display the elements of list twice, if
it is a number and display the element terminated with ‘*’ if it is
not a number.
se
For example, if the content of list is as follows
:
2
la
MyList=['RAMAN',’21’,'YOGRAJ', '3', 'TARA']
The output should be
ag
RAMAN*
2121
s.
YOGRAJ*
33
ol
TARA*
ho
Ans def fun(L):
for I in L:
sc
if I.isnumeric():
print(2*I) # equivalently: print(I+I)
://
else:
print(I+'*')
tp
3 (a) What will be the status of the following list after fourth pass of 3
bubble sort and fourth pass of selection sort used for arranging
the following elements in descending order ?
34,6,12,3,45,25
Page 22 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem SchoolsF-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
i. 34,12,3,45,25,6
ii. 34,12,45,25,3,6
iii. 34,45,25,12,3,6
iv. 45,34,25,12,3,6
Selection Sort
34,6,12,3,45,25 (Original Content)
i. 45,6,12,3,34,25
ii. 45,34,12,3,6,25
iii. 45,34,25,3,6,12
iv. 45,34,25,12,6,3 (Unsorted status
after 4th pass)
/
om
For Bubble Sort
(1 ½ Mark if (iv) pass is correct)
OR
.c
(½ Mark for (i) pass)
(½ Mark for (ii) pass)
m
(½ Mark for (iii) pass)
the help of Binary Search method. The method should return ‐1,
ho
Ans def bSearch(L, key):
low = 0
://
high = len(L)1
found = False
tp
while (low <= high) and (not found):
mid = (low+high)//2
ht
if L[mid] == key:
found = True
elif L[mid] < key:
low = mid + 1
else:
high = mid 1
if found:
return mid+1 # may even be 'return mid'
else:
return 1
Page 23 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
(c) Write PUSH (Names) and POP (Names) methods in python to add
Names and Remove names considering them to act as Push and
Pop operations of Stack. 4
Ans def push(Name):
Stack.append(Name)
print ‘Element:',Name,'inserted successfully'
/
om
def pop():
if Stack == []:
print('Stack is empty!')
.c
else:
m
print('Deleted element is',Stack.pop())
se
(2 Marks for correctly pushing an element into the stack)
(1 Mark for checking empty stack in POP())
(1 Mark for popping element from stack)
la
(d) Write a method in python to find and display the composite
ag
Ans def composite_numbers(N):
ol
for I in range(2, N+1):
M = I // 2
ho
for J in range(2, M+1):
if I % J == 0:
sc
print(I)
break
OR
://
Ans
Element Stack
34 34
23 34, 23
Page 24 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
+ 57
4 57, 4
5 57, 4, 5
* 57, 20
37
/
om
4 (a) Differentiate between the following:
1
(i) f = open ('diary. txt', 'a')
(ii) f = open ('diary. txt', 'w')
.c
Ans (i) diary.txt is opened for writing data at the end of file
m
(ii) diary.txt is opened for writing data from the beginning of file
in create mode
se
( 1 mark for writing correct difference)
la
OR
(½ Mark for each correct explanation of (i) and (ii))
ag
(b) Write a method in python to read the content from a text file
story.txt line by line and display the same on screen. 2
s.
ol
Ans def read_file():
inFile = open('story.txt', 'r')
ho
for line in inFile:
print line
sc
student.dat 3
class Student:
def_init_(self,A,N} :
self.Admno=A
self.Name=N
def Show(self}:
print (self.Admno, "#" , self.Name}
Page 25 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
Ans import pickle
class Student:
def __init__(self, A, N):
self.Admno = A
self.Name = N
def show(self):
print(self.Admno,"#",self.Name)
def store_data(self):
piFile = open('student.dat','wb')
/
om
pickle.dump(self, piFile)
piFile.close()
.c
(1 Mark for method header)
(1 Mark for opening the file student.dat in correct mode)
m
(1 Mark each for writing student details into the file)
se
Section ‐ C
(For all candidates)
la
5 (a) Observe the following table carefully and write the names of the
ag
Date
1001 Plastic Folder 14” 100 3400 2014‐12‐14
ho
Ans Candidate keys : Code, Item
Primary keys : Code
ht
(b) Consider the following DEPT and EMPLOYEE tables. Write SQL 6
queries for to
( i) and find outputs for SQL queries
( iv) to
( v) ( viii).
Table: DEPT
Page 26 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
Table: EMPLOYEE
ENO NAME DOJ DOB GENDER DCODE
1001 George K 20130902 19910901 MALE D01
1002 Ryma Sen 20121211 19901215 FEMALE D03
1003 Mohitesh 20130203 19870904 MALE D05
/
om
1007 Anil Jha 20140117 19841019 MALE D04
1004 Manila Sahai 20121209 19861114 FEMALE D01
1005 R SAHAY 20131118 19870331 MALE D02
1006 Jaya Priya 20140609 19850623 FEMALE D05
.c
Note: DOJ refers to date of joining and DOB refers to date of
Birth of employees.
m
(i) To display Eno, Name, Gender from the table EMPLOYEE in
ascending order of Eno. se
la
Ans SELECT
Eno,Name,Gender FROM Employee
ag
ORDER BY Eno;
(½ Mark for )
SELECT Eno,Name,Gender FROM Employee
(½ Mark for )
ORDER BY Eno
s.
(ii) To display the Name of all the MALE employees from the table
ol
EMPLOYEE.
ho
Ans SELECT Name FROM Employee WHERE Gender=’MALE’;
(½ Mark for )
SELECT Name FROM Employee
sc
(½ Mark for )
WHERE Gender=’MALE’
://
(iii) To display the Eno and Name of those employees from the
table EMPLOYEE who are born between '1987‐01‐01' and
tp
'1991‐12‐01'.
ht
Ans SELECT Eno,Name FROM Employee
WHERE DOB BETWEEN ‘19870101’ AND ‘19911201’
OR
SELECT Eno,Name FROM Employee
WHERE DOB >=‘19870101’ AND DOB <=‘19911201’;
OR
SELECT Eno,Name FROM Employee
WHERE DOB >‘19870101’ AND DOB <‘19911201’;
(½ Mark for )
SELECT Eno,Name FROM Employee
(½ Mark for
Page 27 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
WHERE DOB BETWEEN ‘19870101’ AND ‘19911201’
OR
WHERE DOB >=‘19870101’ AND DOB <=‘19911201’
OR
WHERE DOB >‘19870101’ AND DOB <‘19911201’ )
Ans SELECT count(*) FROM Employee
WHERE GENDER=’FEMALE’ AND DOJ > ‘19860101’;
OR
SELECT * FROM Employee
WHERE GENDER=’FEMALE’ AND DOJ > ‘19860101’;
/
om
(Any valid query for counting and/or displaying for female
employees will be awarded 1 mark)
.c
(v)
SELECT COUNT(*),DCODE FROM EMPLOYEE
m
GROUP BY DCODE HAVING COUNT(*)>1;
Ans COUNT
DCODE
2 D01 se
la
2 D05
(½ Mark for correct output)
ag
(vi)
SELECT DISTINCT DEPARTMENT FROM DEPT;
s.
Ans Department
INFRASTRUCTURE
ol
MARKETING
ho
MEDIA
FINANCE
HUMAN RESOURCE
sc
(½ Mark for correct output)
://
(vii) SELECT NAME, DEPARTMENT FROM EMPLOYEE E, DEPT
tp
D WHERE E.DCODE=D.DCODE AND EN0<1003;
ht
Ans NAME
DEPARTMENT
George K INFRASTRUCTURE
Ryma Sen MEDIA
(½ Mark for correct output)
(viii)
SELECT MAX(DOJ), MIN(DOB) FROM EMPLOYEE;
Page 28 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
Ans L.H.S
=U’+ V
=U’.(V+V’)+ V.(U’+ U)
=U’.V + U’.V’ + U’.V + U.V
=U’.V+U’.V’+U.V
/
=R.H.S
om
OR
R.H.S
=U’V’+U’.V +U.V
.c
=U’.(V’+ V)+ U.V
=U’.1 + U.V
m
=U’+ U.V
=U’+ V
=L.H.S se
la
(2 Marks for any valid verification using Boolean Laws)
OR
ag
(b) Draw the Logic Circuit for the following Boolean Expression : 2
(X’+Y).Z+W’
ol
Ans
ho
sc
://
P Q R F(P,Q,R)
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 1
Page 29 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools
F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
1 0 1 0
1 1 0 0
1 1 1 1
Ans F(P,Q,R)= (P+Q+R’)(P+Q’+R)(P’+Q+R’)(P’+Q’+R)
OR
F(P,Q,R)= Π (1,2,5,6)
/
Note: Deduct ½ mark if wrong variable names are used
om
(d) Reduce the following Boolean Expression to its simplest form
using K‐Map : 3
.c
F(X,Y,Z,W) = ∑(0,1,4,5,6,7,8,9,11,15)
m
Ans
se
la
ag
s.
ol
OR
ho
sc
://
tp
ht
Simplified Expression: Y’Z’ + X’Y + XZW
Page 30 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
Ans Bus topology
Star Topology
/
om
.c
OR any valid illustration of Bus and Star Topology.
m
½ Mark for drawing each correct layout)
(
(b) se
What kind of data gets stored in cookies and how is it useful? 1
la
Ans When a Website with cookie capabilities is visited , its server
ag
Fixes an upper limit for packet size.
Message Switching follows store and forward principle for complete
://
message. No limit on block size.
tp
(d) Out of the following, which is the fastest (i) wired and (ii) 1
wireless medium of communication?
Infrared, Coaxial Cable, Ethernet Cable, Microwave, Optical Fiber
½
( Mark each for Wired and Wireless
medium of
communication
)
Page 31 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
Ans A Trojan Horse is a code hidden in a program, that looks safe but
has hidden side effects typically causing loss or theft of data, and
possible system harm.
(f) Out of the following, which all comes under cyber crime? 1
(i) Stealing away a brand new hard disk from a showroom.
(ii) Getting in someone's social networking account without
his consent and posting on his behalf.
/
(iii) Secretly copying data from server of a organization and
om
selling it to the other organization.
(iv) Looking at online activities of a friends blog.
.c
Ans (ii) & (iii)
m
(½ Mark for choosing each of the correct options)
Note:
se
● No marks to be given, if all options are there in the answer
● ½ Mark to be deducted, if one extra option is given along
with the correct options
la
(g) Xcelencia Edu Services Ltd. is an educational organization. It is
ag
Page 32 of 33
PD
F-
XC
h a n g e Vi
e w
AglaSem Schools F-
XC
h a n g e Vi
e w
PD
CBSE AISSCE 2015 Marking Scheme for Computer Science
er
er
!
!
W
W
O
O
N
N
y
y
bu
bu
(Sub Code: 083 Paper Code 91 Outside Delhi)
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o . c .d o .c
c u -tr ack c u -tr a c k
(i) Suggest the most appropriate location of the server inside the 1
HYDERABAD campus (out of the 4 buildings), to get the best
connectivity for maximum no. of computers. Justify your
answer.
/
Ans ADMIN
(due to maximum number of computers)
om
OR
ARTS(due to shorter distance from the other buildings)
.c
(1 Mark for mentioning Correct building name with reason)
OR
m
(½ Mark to be deducted for not giving reason)
se
(ii) Suggest and draw the cable layout to efficiently connect
various buildings 'within the HYDERABAD campus for
connecting the computers.
1
la
Ans Any one of the following
ag
s.
ol
ho
Page 33 of 33