Selfstudys Com File (3)
Selfstudys Com File (3)
COMPUTER SCIENCE
Instructions :
(v) It is compulsory to mention on the page 1 in the answer book whether you
are attempting SECTION A or SECTION B.
(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
typedef char STRING[80];
void main()
{
STRING Txt[] = “We love Peace”;
int Count=0;
while (Txt[Count]!=’\0’)
if (isalpha(Txt[Count]))
Txt[Count++]=’@’;
else
Txt[Count++]=’#’;
puts(Txt);
}
(c) Observe the following C++ code very carefully and rewrite it after
removing any/all syntactical errors with each correction
underlined. 2
Note : Assume all required header files are already being
included in the program.
#Define float MaxSpeed=60.5;
void main()
{
int MySpeed
char Alert=’N’;
cin≫MySpeed;
if MySpeed>MaxSpeed
Alert=’Y’;
cout<<Alert<<endline;
}
91 2
(d) Write the output of the following C++ program code : 2
Note : Assume all required header files are already being
included in the program.
void Location(int &X,int Y=4)
{
Y+=2;
X+=Y;
}
void main()
{
int PX=10,PY=2;
Location(PY);
cout<<PX<<”,”≪PY<<endl;
Location(PX,PY);
cout<<PX<<”,”≪PY<<endl;
}
(e) Write the output of the following C++ program code : 3
Note : Assume all required header files are already being
included in the program.
class Eval
{
char Level;
int Point;
public:
Eval(){Level=’E’;Point=0;}
void Sink(int L)
{
Level-=L;
}
void Float(int L)
{
Level+=L;
Point++;
}
void Show()
{
cout<<Level<<”#”<<Point<<endl;
}
};
91 3 P.T.O.
void main()
{
Eval E;
E.Sink(3);
E.Show();
E.Float(7);
E.Show();
E.Sink(2);
E.Show();
}
(f) Study the following program and select the possible output(s)
from the options (i) to (iv) following it. Also, write the maximum
and the minimum values that can be assigned to the
variable VAL. 2
Note :
– Assume all required header files are already being included
in the program.
– random(n) function generates an integer between 0
and n-1.
void main()
{
randomize();
int VAL;
VAL=random(3)+2;
char GUESS[]=”ABCDEFGHIJK”;
for (int I=1;I<=VAL; I++)
{
for(int J=VAL; J<=7;J++)
cout≪GUESS[J];
cout<<endl;
}
}
91 4
2. (a) What is a copy constructor ? Give a suitable example in C++ to
illustrate with its definition within a class and a declaration of an
object with the help of it. 2
(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; }
~Passenger() //Function 4
{ cout≪”Booking cancelled!”≪endl; }
};
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
//Exhibition Gallery as per Category
//as shown in the following table
Category Exhibit
Antique Zaveri
Modern Johnsen
Classic Terenida
Public Members
– Register() //A function to allow user to enter values
//Pno, Category and call FixExhibit() function
– ViewAll() //A function to display all the data members
class Interior
{
int OrderId;
char Address[20];
protected:
float Advance;
public:
Interior();
void Book(); void View();
};
91 6
class Painting:public Interior
{
int WallArea,ColorCode;
protected:
char Type;
public:
Painting();
void PBook();
void PView();
};
class Billing : public Painting
{
float Charges;
void Calculate();
public:
Billing();
void Bill();
void BillPrint();
};
(ii) Write the names of all the data members, which are directly
accessible from the member functions of class Painting.
(iii) Write the names of all the member functions, which are
directly accessible from an object of class Billing.
91 7 P.T.O.
3. (a) Write the definition of a function Change(int P[ ], int N) in C++,
which should change all the multiples of 10 in the array to 10 and
rest of the elements as 1. For example, if an array of 10 integers is
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
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
struct BOOKS
{
char ISBN[20], TITLE[80];
BOOKS *Link;
};
class STACK
{
BOOKS *Top;
public:
STACK(){Top=NULL;}
void PUSH();
void POP();
~STACK();
};
91 8
(d) Write a function REVROW(int P[ ][5],int N,int M) in C++ to
display the content of a two dimensional array, with each row
content in reverse order. 3
15 12 56 45 51
13 91 92 87 63
11 23 61 46 81
4. (a) Write function definition for TOWER( ) in C++ to read the content of
a text file WRITEUP.TXT, count the presence of word TOWER and
display the number of occurrences of this word. 2
Note :
– The word TOWER should be an independent word
– Ignore type cases (i.e. lower/upper case)
Example :
If the content of the file WRITEUP.TXT is as follws :
Tower of hanoi is an interesting problem. Mobile
phone tower is away from here. Views from EIFFEL TOWER
are amazing.
91 9 P.T.O.
(b) Write a definition for function COSTLY( ) in C++ to read each record
of a binary file GIFTS.DAT, find and display those items, which are
priced more than 2000. Assume that the file GIFTS.DAT is created
with the help of objects of class GIFTS, which is defined below : 3
class GIFTS
{
int CODE;char ITEM[20]; float PRICE;
public:
void Procure()
{
cin>>CODE; gets (ITEM);cin>>PRICE;
}
void View()
{
cout<<CODE<<”:”<<ITEM<<”:”<<PRICE<<endl;
}
float GetPrice(){return PRICE;}.
};
(c) Find the output of the following C++ code considering that the
binary file MEMBER.DAT exists on the hard disk with records of
100 members : 1
class MEMBER
{
int Mno; char Name[20];
public:
void In();void Out();
};
void main()
{
fstream MF;
MF.open(“MEMBER.DAT”,ios::binary|ios::in);
MEMBER M;
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
SECTION B
[Only for candidates, who opted for Python]
(c) Rewrite the following code in python after removing all syntax
error(s). Underline each correction done in the code. 2
(d) Find and write the output of the following python code : 2
print Name
if Name[0]=='S':
break
else:
print 'Completed!'
print'Weldone!'
91 11 P.T.O.
(e) Find and write the output of the following python code : 3
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')
s.Show(1)
s.Manip()
s.Show(2)
print s.Code+len(s.Name)
(f) What are the possible outcome(s) executed from the following
code ? Also specify the maximum and minimum values that can
be assigned to variable COUNT. 2
TEXT="CBSEONLINE"
COUNT=random.randint(0,3)
C=9
while TEXT[C]!='L':
print TEXT[C]+TEXT[COUNT]+'*',
COUNT=COUNT+1
C=C-1
91 12
2. (a) Illustrate the concept inheritance with the help of a python code. 2
(b) What will be the output of the following python code ? Explain the
try and except used in the code. 2
A=0
B=6
print 'One'
try:
print 'Two'
X=B/A
Print 'Three'
except ZeroDivisionError:
print B*2
print 'Four'
except:
print B*3
print 'Five'
Methods:
– FixExhibit() #A method to assign
#Exhibition Gallery as per Category
#as shown in the following table
Category Exhibit
Antique Zaveri
Modern Johnsen
Classic Terenida
3. (a) What will be the status of the following list after fourth pass of
bubble sort and fourth pass of selection sort used for arranging the
following elements in descending order ? 3
34,-6,12,-3,45,25
91 14
4. (a) Differentiate between the following : 1
(i) f = open('diary.txt', 'a')
(ii) f = open('diary.txt', 'w')
(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
class Student:
def ___init___(self,A,N):
self.Admno=A
self.Name=N
def Show(self):
print(self.Admno,"#",self.Name)
SECTION C
[For all candidates]
5. (a) Observe the following table carefully and write the names of the
most appropriate columns, which can be considered as (i) candidate
keys and (ii) primary key : 2
Transaction
Code Item Qty Price
Date
1001 Plastic Folder 14’’ 100 3400 2014-12-14
1004 Pen Stand Standard 200 4500 2015-01-31
1005 Stapler Mini 250 1200 2015-02-28
1009 Punching Machine Small 200 1400 2015-03-12
1003 Stapler Big 100 1500 2015-02-02
91 15 P.T.O.
(b) Consider the following DEPT and EMPLOYEE tables. Write SQL
queries for (i) to (iv) and find outputs for SQL queries (v) to (viii). 6
Table : DEPT
Table : EMPLOYEE
(ii) To display the Name of all the MALE employees from the
table EMPLOYEE.
91 16
(iii) To display the Eno and Name of those employees from the
table EMPLOYEE who are born between ‘1987-01-01’ and
‘1991-12-01’.
(iv) To count and display FEMALE employees who have joined
after ‘1986-01-01’.
(v) SELECT COUNT(*),DCODE FROM EMPLOYEE
GROUP BY DCODE HAVING COUNT(*)>1;
(vi) SELECT DISTINCT DEPARTMENT FROM DEPT;
(vii) SELECT NAME,DEPARTMENT FROM EMPLOYEE E,DEPT D
WHERE E.DCODE=D.DCODE AND ENO<1003;
(viii) SELECT MAX(DOJ), MIN(DOB) FROM EMPLOYEE;
(b) Draw the Logic Circuit for the following Boolean Expression : 2
(X’+Y).Z + W’
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
1 0 1 0
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.
7. (a) Illustrate the layout for connecting 5 computers in a Bus and a Star
topology of Networks. 1
(b) What kind of data gets stored in cookies and how is it useful ? 1
(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 an organization and
selling it to the other organization.
(iv) Looking at online activities of a friends blog.
91 18
Shortest distances between various buildings :
ADMIN to SCIENCE 65 m
ADMIN to ARTS 60 m
SCIENCE to BUSINESS 75 m
SCIENCE to ARTS 60 m
BUSINESS to ARTS 50 m
ADMIN 100
SCIENCE 85
BUSINESS 40
ARTS 12
(i) Suggest the most appropriate location of the server inside the
HYDERABAD campus (out of the 4 buildings), to get the best
connectivity for maximum number of computers. Justify your
answer. 1
(i) E-mail
(iv) Cable TV
91 20 96,000
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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’,
‘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.
○ Ignore case sensitivity for commands.
○ Ignore headers in output questions.
Section ‐ A
(Only for C++ candidates)
1 (a) Find the correct identifiers out of the following, which can be 2
used for naming Variable, Constants or Functions in a C++
program:
For, while, INT, NeW, delete, 1stName, Add+Subtract, name1
(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:
Page 1 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
if (isalpha(Txt[Count]))
Txt[Count++]='@' ;
else
Txt[Count++]='#' ;
puts (Txt) ;
}
(c) Observe the following C++ code very carefully and rewrite it 2
after removing any/all syntactical errors with each correction
underlined.
Note: Assume all required header files are already being included
in the program.
Ans #define
floatMaxSpeed ; //Error 1,2,3
60.5
void main()
{
int MySpeed ; //Error 4
char Alert='N';
cin>>MySpeed;
if
(MySpeed>MaxSpeed) //Error 5
Alert=’Y’;
cout<<Alert<<endl; //Error 6
}
Page 2 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
Ans 10, 8
20, 8
Page 3 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
void main()
{
Eval E;
E.Sink(3);
E.Show();
E.Float(7);
E.Show();
E.Sink(2);
E.Show();
}
Ans B#0
I#1
G#1
(1 Mark for each correct line of output)
Note:
● Deduct ½ Mark for not considering any or all endl(s) at
proper place(s)
● Deduct ½ Mark for not writing any or all # symbol(s)
(f) Study the following program and select the possible output(s) 2
from the option (i) to (iv) following it. Also, write the maximum
and the minimum values that can be assigned to the variable
VAL.
Note:
‐Assume all required header files are already being included in
the program.
‐random(n) function generates an integer between 0 and n‐1.
void main()
{
randomize();
int VAL;
VAL=random(3)+2;
char GUESS[]="ABCDEFGHIJK";
for (int I=l;I<=VAL;I++)
{
for(int J=VAL;J<=7;J++)
cout«GUESS[J];
cout«endl;
}
}
Page 4 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
void main()
{
Point p1;
Point p2(p1);//Copy constructor is called here
//OR
Point p3=p1;//Copy constructor is called here
}
Page 5 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
(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; }
~Passenger() //Function 4
{ cout<<"Booking cancelled!"<<endl; }
};
Ans Function 4
OR
~Passenger()
It is a Destructor function.
Page 6 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
Page 7 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
FixExhibit();
}
void Photo:: ViewAll()
{
cout<<Pno<<Category<<Exhibit<<endl;
}
Page 8 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
public:
Billing();
void Bill();
void BillPrint();
};
(ii) Write the names of all the data members, which are directly
accessible from the member functions of class Painting.
Page 9 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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
OR
Any other correct equivalent function definition
Page 10 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
= 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
LOC(ARR[10][5])
15000 = BaseAddress + W [( I1)*C + (J1)]
= BaseAddress + 4[9*20 + 4]
= BaseAddress + 4[180 + 4]
= BaseAddress + 4 * 184
= BaseAddress + 736
BaseAddress = 15000 736
= 14264
LOC(ARR[30][10])
= 14264 + 4[(301)*20 + (101)]
= 14264 + 4[29*20 + 9]
= 14264 + 4[580 + 9]
= 14264 + 4*589
= 14264 + 2356
= 16620
Page 11 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
void POP();
~STACK();
};
Page 12 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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;
}
}
Ans U * V + R/ (ST)
= ((U * V)+(R/(ST)))
Element Stack Postfix
(
(
U U
* *
V UV
) UV*
+ +
(
R UV*R
/ +/
(
S UV*RS
+/
T UV*RST
) UV*RST
) UV*RST/
) UV*RST/+
Page 13 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
OR
Element Stack Postfix
U U
* * U
V * UV
+ + UV*
R + UV*R
/ +/ UV*R
( +/( UV*R
S +/( UV*RS
+/( UV*RS
T +/( UV*RST
) +/ UV*RST
+ UV*RST/
UV*RST/+
OR
Any other method for converting the given Infix expression to its
equivalent Postfix expression showing stack contents
4 (a) Write function definition for TOWER() in C++ to read the content
of a text file WRITEUP.TXT, count the presence of word TOWER
and display the number of occurrences of this word. 2
Note :
‐ The word TOWER should be an independent word
‐ Ignore type cases (i.e. lower/upper case)
Example:
If the content of the file WRITEUP.TXT is as follows:
Page 14 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
while (!f.eof())
{
f>>s;
if (strcmpi(s,”TOWER”)==0)
count++;
}
cout<<count;
f.close();
}
OR
Any other correct function definition
NOTE:
(½ Mark to be deducted if TOWER is compared without ignoring
the case)
class GIFTS
{
int CODE;char ITEM[20]; float PRICE;
public:
void Procure()
{
cin>>CODE; gets(ITEM);cin>>PRICE;
}
void View()
{
cout<<CODE<<":"<<ITEM<<":"<<PRICE<<endl;
}
float GetPrice() {return PRICE;}
};
Page 15 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
{
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 )
(½ 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
100 members: 1
class MEMBER
{
int Mno; char Name[20];
public:
void In();void Out();
};
void main()
{
fstream MF;
MF.open("MEMBER.DAT”,ios::binary|ios::in);
MEMBER M;
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();
}
Page 16 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
Section ‐ B
(Only for Python candidates)
1 (a) How is __init( ) __different from __del ( )__ ? 2
For Example:
class Sample:
def __init__(self):
self.data = 79
print('Data:',self.data,'created')
def __del__(self):
print('Data:',self.data,'deleted')
s = Sample()
del s
Ans isalpha()
len()
(c) Rewrite the following code in python after removing all syntax
error(s). Underline each correction done in the code. 2
Page 17 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
print Sum[5]
print Sum
(2)#Function Call #Error 4
print Sum
(5) #Error 4
(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':
break
else :
print 'Completed!'
print 'Weldone!'
Ans John
Garima
Seema
Weldone!
(½ Mark for each correct line)
Note:
Deduct ½ Mark for not considering any or all line breaks at
proper place(s)
(e) Find and write the output of the following python code: 3
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
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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:
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
code? Also specify the maximum and minimum values that can be
assigned to variable COUNT.
TEXT="CBSEONLINE"
COUNT=random.randint(0,3)
C=9
while TEXT[C]!='L':
print TEXT[C]+TEXT[COUNT]+'*',
COUNT=COUNT+1
C=C1
(i) (ii) (iii) (iv)
EC*NB*IS* NS*IE*LO* ES*NE*IO* LE*NO*ON*
Ans (i) EC*NB*IS*
(iii) ES*NE*IO*
Minimum COUNT = 0 Maximum COUNT = 3
2 (a) Illustrate the concept inheritance with the help of a python code 2
Page 19 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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.
A=0
B=6
print 'One'
try:
print 'Two'
X=B/A
Print 'Three'
except ZeroDivisionError:
print B*2
print 'Four'
except:
print B*3
print 'Five'
ANS One
Two
12
Four
The code written within try triggers the exception written after
except ZeroDivisionError: in case there is a division by zero error
otherwise the default exception is executed
OR
Any other correct explanation for usage of try and except
Page 20 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
Page 21 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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)
Page 23 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
(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
def pop():
if Stack == []:
print('Stack is empty!')
else:
print('Deleted element is',Stack.pop())
Ans
Element Stack
34 34
23 34, 23
Page 24 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
+ 57
4 57, 4
5 57, 4, 5
* 57, 20
37
Ans (i) diary.txt is opened for writing data at the end of file
(ii) diary.txt is opened for writing data from the beginning of file
in create mode
(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
Page 25 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
def show(self):
print(self.Admno,"#",self.Name)
def store_data(self):
piFile = open('student.dat','wb')
pickle.dump(self, piFile)
piFile.close()
Section ‐ C
(For all candidates)
5 (a) Observe the following table carefully and write the names of the
most appropriate columns, which can be considered as
(i) candidate keys and (ii) primary key. 2
(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
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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
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
Note: DOJ refers to date of joining and DOB refers to date of
Birth of employees.
Ans SELECT
Eno,Name,Gender FROM Employee
ORDER BY Eno;
(½ Mark for )
SELECT Eno,Name,Gender FROM Employee
(½ Mark for )
ORDER BY Eno
(ii) To display the Name of all the MALE employees from the table
EMPLOYEE.
(iii) To display the Eno and Name of those employees from the
table EMPLOYEE who are born between '1987‐01‐01' and
'1991‐12‐01'.
(½ Mark for )
SELECT Eno,Name FROM Employee
(½ Mark for
Page 27 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
(v)
SELECT COUNT(*),DCODE FROM EMPLOYEE
GROUP BY DCODE HAVING COUNT(*)>1;
(vi)
SELECT DISTINCT DEPARTMENT FROM DEPT;
Ans Department
INFRASTRUCTURE
MARKETING
MEDIA
FINANCE
HUMAN RESOURCE
(viii)
SELECT MAX(DOJ), MIN(DOB) FROM EMPLOYEE;
Page 28 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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
OR
R.H.S
=U’V’+U’.V +U.V
=U’.(V’+ V)+ U.V
=U’.1 + U.V
=U’+ U.V
=U’+ V
=L.H.S
(b) Draw the Logic Circuit for the following Boolean Expression : 2
(X’+Y).Z+W’
Ans
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
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
1 0 1 0
1 1 0 0
1 1 1 1
Ans
OR
Page 30 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
Star Topology
(b) What kind of data gets stored in cookies and how is it useful? 1
Ans Packet Switching follows store and forward principle for fixed packets.
Fixes an upper limit for packet size.
(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
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
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
selling it to the other organization.
(iv) Looking at online activities of a friends blog.
Page 32 of 33
CBSE AISSCE 2015 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
(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)
OR
ARTS(due to shorter distance from the other buildings)
Page 33 of 33