Page 245 - C++
P. 245
CBSE AISSCE 2016-2017 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91/1 Delhi)
int R=random(3),C=random(4);
int MAT[3][3] = {{10,20,30},{20,30,40},{30,40,50}};
for(int I=0; I<R; I++)
{
for(int J=0; J<C; J++)
cout<<MAT[I][J]<<" ";
cout<<endl;
}
}
(i) (ii)
10 20 30 10 20 30
20 30 40 20 30 40
30 40 50
(iii) (iv)
10 20 10 20
20 30 20 30
30 40
Ans (ii) and (iii)
Max Value of R:2
Max Value of C:3
(1 Mark for writing the correct options)
NOTE: No marks to be awarded for writing any other option or any other
combination
(½ Mark for writing correct Maximum value of R)
(½ Mark for writing correct Maximum value of C)
2. (a) Differentiate between private and public members of a class in context of Object 2
Oriented Programming. Also give a suitable example illustrating
accessibility/non-accessibility of each using a class and an object in C++.
Ans private public
Implicit Visibility Mode Explicit Visibility Mode
Not accessible by the objects of class Accessible by the objects of class
Example:
class A
{
int x; //private Member
public:
void In();//public member
};
void main()
{
A obja;
cin>>obja.x;//Not Accessible
obja.In();//accessible
}
Page #4 of 28