Page 97 - C++
P. 97
(iv) Write the names of all the members, which are accessible from objects of class faculty.
3. (a) Write a Get1From2( ) function in C++ to transfer the content from two arrays FIRST[ ] and SECOND[ ]
to array ALL[ ]. The even places (0, 2, 4,…) of array ALL[] should get the content from the array FIRST[ ] and
odd places (1,3,5,…) of the array ALL [ ]should get the content from the array SECOND[ ] . [3]
Example:
If the FIRST[ ] array contains
30, 60, 90
And the SECOND[ ] array contains
10, 50, 80
The ALL[ ] array should contain
30, 10, 60, 50, 90, 80
(b) An array P[20] [50] is stored in the memory along the column with each of its Element occupying 4
bytes, find out the location of P[15] [10], if P[0][0] is stored at 5200. [3]
(c) Write a function in C++ to Perform insert operation on a dynamically allocated Queue containing
Passenger details as given in the following definition of NODE. [4]
struct NODE
{
long Pno; //passenger number
char Pname[20]; //passenger name
NODE *Link;
};
(d) Write a COLSUM ( ) function in C++ to find sum of each column of each column of a NxM matrix. [2]
(e) Evaluate the following postfix notation of expression:
50, 60, +,20, 10, -, * [2]
4. (a) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and
Statement 2 using seekg( ), seekp( ), tellp( ) and tellg() functions for performing the required task. [1]
# include <fstream.h>
class PRODUCT
{
int Pno; char pname [20]; int qty;
public :
:
void ModifyQty ( ); // The function is to modify quantity of a PRODUCT
};