Page 298 - C++
P. 298
CBSE AISSCE 2016-2017 Marking Scheme for Computer Science
(Sub Code: 083 Paper Code 91 Outside Delhi)
Enter2()
Second::Display()
Enter3()
Display() OR Third::Display()
(1 Mark for writing all correct function names )
NOTE:
● Marks not to be awarded for partially correct answer
● Ignore the mention of Constructors
(iii) Write Statement 2 to call function Display() of class Second from the object T of
class Third.
Ans T.Second::Display();
(1 Mark for writing Statement 2 correctly)
(iv) What will be the order of execution of the constructors, when the object T of class
Third is declared inside main()?
Ans First, Second, Third
(1 Mark for writing correct order)
● 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 AddUp(int Arr[], int N) in C++, in which all even 3
positions (i.e. 0,2,4,...) of the array should be added with the content of the
element in the next position and odd positions (i.e. 1,3,5,...) elements should be
incremented by 10.
Example: if the array Arr contains
23 30 45 10 15 25
Then the array should become
53 40 55 20 40 35
NOTE:
● The function should only alter the content in the same array.
● The function should not copy the altered content in another array.
● The function should not display the altered content of the array.
● Assuming, the Number of elements in the array are Even.
Ans void AddUp(int Arr[], int N)
{
for(int i=0; i<N; i++)
{
if(i%2==0)
Arr[i]=Arr[i]+Arr[i+1];
else
Arr[i]=Arr[i]+10;
}
}
OR
Page #8 of 28