KENDRIYA VIDYALAYA SANGATHAN, KOLKATA REGION
SAMPLE PAPER
SUB : COMPUTER SCIENCE (083)
MARKING SCHEME
Q. NO ANSWERS MARKS
1 (a). Inline Functions are the functions that are not actually called, 02 marks
rather, their code is expanded (inline) at the point of function
call. The member function of a class, if defined within the
class definition, is inline by default. If defined outside the
function can be made explicitly inline by placing the keyword
in line before its definition.
For example :
In the following example printSq( ) is an inline function.
class Abc
{
int x;
public:
void printSq ( )
{
cout << x*x;
}
};
1 (b). iostream.h 01 mark
ctype.h
1 (c). In the following class the following are errors : 02 marks
(i) The class private member int x is initialized by 10
which is not correct.
(ii) The static member function is trying to access a
non static member which is the error.
(iii) The definition of static member (outside the class)
is missing.
(iv) The member functions that are defined outside the
class definition do not possess their qualified
names.
1
class ABC
{
int x;
static int ctr;
public:
void int (void);
static void prn(void)
{
cout << ctr;
}
};
int ABC :: ctr = 0;
void ABC :: sum (void)
{
x = x+20;
}
1 (d). Ans : NNO@*XRS!* 03 marks
1(e). Output: 02 marks
3,30
7,3
4,40
4,3
1 (f). Option (ii) & (iv) 02 marks
Least value = 1
Highest value = 2
2 (a). The “this” pointer represents an object that invokes a 02 marks
member function. It stores the address of the object that is
invoking a member function and it (the pointer) is an implicit
argument to the member function being invoked.
The “this” pointer is useful in returning the object (address) of
which the function is a member.
2 (b). (i) School A1 (10); 02 marks
2
(ii) School ( School &t)
{
Score = t.score;
}
2 (c). 04 marks
class TOUR
{
Private:
char TCode [30];
int NoofAdults, NoofKids, Kilometers;
float TotalFare;
public:
TOUR ( )
{
Strcpy ( TCode, “NULL”);
NoofAdults = 0;
NoofKids = 0;
Kilometers = 0;
TotalFare = 0;
}
void AssignFare ( )
{
If (Kilometers >= 1000)
{
Total Fare = NoofAdults *500 + NoofKids * 250;
}
else if ( (Kilometers < 1000) && (Kilometers > 500) )
{
Total Fare = NoofAdults * 300 + NoofKids * 150;
}
else
{
Total Fare = NoofAdults* 200 + NoofKids *100;
}
3
}
void Enter Tour ( )
{
cout << “ \n Enter Tcode”;
cin >> Tcode;
cout << “\n Enter Total No of Adults”;
cin >> NoofAdults;
cout << “ \n Enter the Total No of Kids”;
cin >> NoofKids;
cout << “\n Enter The value of Kilomters”;
cin >> Kilometers;
AssignFare ( );
}
void Show Tour( )
{
cout<<”\n Tour Code is” << TCode;
cout<< “\n Total no of Adults is”<< NoofAdults;
cout<< “\n Total no of Kids is” << NoofKids;
cout<< “\n Total no of Kilometers” << Kilometers;
cout<< “\n Total Fare is”<<TotalFare;
}
};
2 (d). (i) Data Members : 04 marks
Topic, Standard
Member Function :
readphysicsbook( ), showphysicsbook ( ),
readtextbook ( ), showtextbook ( ).
(ii) Data Members :
No Data Members
4
Member Functions:
readtextbook ( ), showtextbook ( ).
(iii) Data Members:
No data members
Member function:
readphysicsbook(), showphysicsbook()
(iv) 50 bytes
3.(a) void Get1from2(int First[ ], int second, int size1, int size2) 03 marks
{ int All[50], k, m, n;
k=size1 + size2;
m=0;
n=0;
for (int i=0; i<k; i++)
{
if(i%2==0)
{
All[i]=first[m];
m++;
}
else
{
All[i]=Second[n];
n++;
}
}
}
3(b) Array is stored in column major enter 03 marks
Total No of Rows=20
Total No of columns=15
Array [4][5]=B + W((I-Lr) +r(J-Lc))
1000= B + 8 [(4-0) +20(5-0)]
1000= B + 8 [(4) + 20(5)]
5
1000= B + 8[4+100]
1000=B + 8(104)
B=168
Address of Array[2][3]= B + W((I-Lr) +r(J-Lc))
= 168 + 8[2-0) + 20(3-0)]
=168 + 8[2 + 60]
=168 +8(62)
=168 + 496
=664
3(c) struct NODE 04 marks
{
int Bno;
char Tilte[20];
NODE * Link;
};
NODE *top;
void POPBOOK()
{
NODE *ptr;
if(top==NULL)
{
cout<<"Underflow";
}
else
{
ptr=top;
top=top->link;
cout<<"Node being deleted contains"<<"Book
No"<<ptr->Bno<<"Title"<<ptr->Title<<endl;
delete ptr;
}
}
3(d) void function (int A[ ][50], int M, int N) 02 marks
{
int firstLargest, SecondLargest, pr1, pc1, pr2, pc2;
6
FirstLargest=A[0][0], SecondLargest=0;
for(int i=0; i<M, i++)
{
for(int j=0; j<N; j++)
{
if (FirstLargest <A[i][j])
{
FirstLargest=A[i][j];
pr1=i;
pc1=j;
}
if((SecondLargest < A[i][j] ) &&(A[i][j] < FirstLargest))
{
SecondLargest=A[i][j];
pr2=i;
pc2=j;
}
}
cout<<FirstLargest<<”,”<<SecondLargest<<endl;
cout<<pr1<<”,”<<pc1<<”:”<<pr2<<”,”<<pc2;
}
3(e) Sl Element Operation Stack Intermediate
No calculatios
1 20 Operand : push 20 02 marks
2 45 Operand : push 20,45
3 + Binary operator- 20+45=65
pop twice
Push the result 65
back
4 20 Operand : push 65, 20
5 10 Operand : push 65,20,10
6 - Binary operator : 65 20-10=10
pop twice
push the result 65,10
7
back
7 15 Operand : push 65,10,15
8 + Binary operator : 65 10+15=25
pop twice
Push the result 65,25
back
9 * Binary operator : 65*25=1625
pop twice
Push the result 1625
back
Ans:1625
4(a) Answer of fill in the blanks 01 marks:
int position = Fil.tellg( ); ½ marks for
Fil.seekp(-1*sizeof(MATERIAL),ios::cur); each
4(b) void COUNT() 02 marks
{
ifstream ifile("ABC.TXT");
if(!ifile)
{
cout<<"\n cound not open ABC.txt file";
exit(-1);
}
else
{
char s[20]; int cnt=0;
while (!ifile.eof())
{
ifile>>s;
if((strcmp(s, "He")==0)||(strcmp(s, "She")==0))
cnt++;
}
ifile.close();
cout<<" count of He/She in file is:"<<cnt;
}
8
4(c) void SEARCH() 03 marks
{
long MNo;
ifstream ifile("CAMERA.DAT, ios::in|ios::binary);
if(!ifile)
{
cout<<"could not open CAMERA.DAT file";
exit(-1);
}
else
{
cout<< “\nEnter the Camera Model No”;
cin >> MNo;
CAMERA C;
int found=0;
while(ifile.read((char*)&c, sizeof(c)))
{
if(C.GetModelNo()== MNo)
{
C.Display();
found=1;
break;
}
}
}
if(found==0)
{
cout<<"\n Given ModelNo Not found";
}
}
Ans 5
(a) Alternative key : A candidate key that is not the primary key is 02 marks :
called an Alternate key. (01+01)
Degree of a Relation : The number of attributes in a relation is
called Degree.
(b) (i)SELECT FIRSTNAME, LASTNAME, ADDRESS, CITY FROM 01 mark
9
EMPLOYEES WHERE CITY = ‘Paris’;
(ii) SELECT * FROM EMPLOYEES ORDERBY FIRSTNAME 01 mark
DESC;
(iii) SELECT FIRSTNAME, LASTNAME, SALARY FROM 01 mark
EMPLOYEES, EMPSALARY
WHERE ( EMPLOYEES.EMPID=EMPSALARY.EMPID
AND DESIGNATION = ‘Manager’);
(iv) SELECT * FROM EMPLOYEES WHERE CITY NOT IN 01 mark
(‘Paris’, ‘Washington’, ‘Boston’, ‘NewDelhi’);
(v) COUNT(DISTINCT DESIGNATION) ½ marks
04
(vi) DESIGNATION SUM(SALARY) ½ marks
Manager 215000
Clerk 135000
(vii) SUM (BENEFITS) ½ marks
32000
(viii) FIRSTNAME SALARY ½ marks
Rachel 32000
Peter 28000
Ans 6.
(a) L.H.S = XY + X'Z + YZ 02 marks
= XY + X'Z + 1. YZ
=XY + X'Z + (X+X')YZ
=XY + X'Z + XYZ + X'YZ
=XY + XYZ + X'Z + X'YZ
= XY(1+Z) + X'Z( 1+ Y)
= XY.1 + X'Z . 1
= XY + X'Z = R.HS
(b) 02 marks
F= AB' + CD'
10
A
C
D
(c) POS term is :- 01 mark
(A+B’ +C). (A’+B + C) . (A’ + B’ +C’)
(d) F(M,N,O,P) = Σ(0,1,3,4,5,6,7,9,10,11,13,15) 03 marks
Reduced Expression is :-
N + O’M’ + O’P + OP’M
7.
(a) (i) File Transfer Protocol 01 mark
(ii) Voice over Internet Protocol
(b) Server side Scripiting – JSP 01 mark
11
Client side Scripting – Java Script
(c) Option (i) 01 mark
(d) Advantage of Bus Topology is easy to Extend ( ½ + ½
Structure of bus Topology is as follows: marks)
(e) (i) In building RED as it houses maximum number of [01+01+01+01]
computer. ; hence most traffic will be local traffic if marks
server is placed here.
(ii)
GREEN
BLUE RED
(iii)Switches are needed in every building as they help
share bandwidth in every building. Repeaters may be
skipped as per above layout, (because distance is less
than 100 m ) however if building Green and building
Red are directly connected, we can place a repeater
here as the distance between these two buildings is
more than 100 m.
(iv)Optical fibre.
12
f URL Example-www.irctc.co.in/welcome.html 01 mark
Domain name- irctc.co.in (in above URL)
g Twisted pair cable 01 mark
Coaxial cable
Optical fibre
-----------X-------------X---------------------X----------------------------X-----------------X---------
13