Page 249 - C++
P. 249
CBSE AISSCE 2016-2017 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91/1 Delhi)
Ans T.Two::Show()
(1 Mark for writing Statement 2 correctly)
(iv) What will be the order of execution of the constructors, when the object T of
class Three is declared inside main()?
Ans One,Two, Three
(1 Mark for writing correct order)
NOTE:
● No Marks to be awarded for any other combination/order.
● Names of the constructor/class without parenthesis is acceptable
3 (a) Write the definition of a function Reverse(int Arr[], int N) in C++, which should 3
reverse the entire content of the array Arr having N elements, without using any
other array.
Example: if the array Arr contains
13 10 15 20 5
Then the array should become
5 20 15 10 13
NOTE:
● The function should only rearrange the content of the array.
● The function should not copy the reversed content in another array.
● The function should not display the content of the array.
Ans void Reverse(int Arr[],int N)
{
for (int I=0;I<N/2;I++)
{
int T=Arr[I];
Arr[I]=Arr[N-I-1];
Arr[N-I-1]=T;
}
}
OR
Any other correct alternative code in C++
(1 ½ Mark for correctly writing the loop)
(1 ½ Mark for correctly writing the logic for reversing the content)
(b) Write definition for a function ADDMIDROW(int MAT[][10],int R,int C) in C++, 2
which finds sum of the middle row elements of the matrix MAT (Assuming C
represents number of Columns and R represents number of rows, which is an odd
integer).
For example, if the content of array MAT having R as 3 and C as 5 is as follows:
1 2 3 4 5
2 1 3 4 5
3 4 1 2 5
Page #8 of 28