Page 231 - C++
P. 231
(i) Which type of Inheritance out of the following is illustrated in the above
example ?
– Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance
(ii) Write the names of all the member functions, which are directly accessible by
the object T of class Three as declared in main( ) function.
(iii) Write Statement 2 to call function Show( ) of class Two from the object T of
class Three.
(iv) What will be the order of execution of the constructors, when the object T of
class Three is declared inside main ( ) ?
3. (a) Write the definition of a function Reverse(int Arr[], int N) in C++, which should
reverse the entire content of the array Arr having N elements, without using any
other array. 3
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.
(b) Write definition for a function ADDMIDROW(int MAT[][10],int R,int C) in C++,
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). 2
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
The function should calculate the sum and display the following :
Sum of Middle Row : 15
(c) T[25][30] is a two dimensional array, which is stored in the memory along the
row with each of its element occupying 2 bytes, find the address of the element
T[10] [15], if the element T[5] [10] is stored at the memory location 25000. 3
91/1 6