Page 8 - C++
P. 8
(iii) List name of the members which are accessible through the member function
“void New_Country()”.
(iv) What will be the size(in bytes) of an object of class Country & State
respectively.
Q3 (a) Write the definition of function named Array_Swap() that will accept an integer array & 3
its size as arguments and the function will interchange/swap elements in such a way that
the first element is swapped with the last element, second element is swapped with the
second last element and son on, only if anyone or both the elements are odd.
E.g. if initially array of seven elements is:
5, 16, 4, 7, 19, 8, 2
After execution of the above function, the contents of the array will be:
2,16, 19, 7, 4, 8, 5
(b) An array A[50][30] is stored along the row in the memory with each element requiring 4 3
bytes of storage. If the element A[10][15] is stored at 21500, then find out the base
address of the array and the memory address of element stored at location A[30][25]?
(c) Write the definition of a member function Q_Insert() for a class Exam_Queue in C++ 4
to insert a new Application information in a dynamically allocated queue whose code is
already given below as a part of the program(assume all necessary header files are
included in program):
(d) Write the definition of a user-defined function REPEAT_ROW(int A[][3],int R, int C) 2
in C++ that will store the elements in the following manner
st
st
1. All row elements except the 1 element replaced by the 1 element,
nd
nd
st
2. All row elements except the 1 & 2 element replaced by the 2 element,
rd
rd
st
nd
3. All row elements except the 1 , 2 & 3 element replaced by the 3 element and
Page No. 6