Page 58 - C++
P. 58

3        (a)    Write a user-defined function AddEnd4(int A[][4],int R,int C) in C++ to     (2)
                             find and display the sum of all the values, which are ending with 4 (i.e., unit
                             place is 4).
                             For example if the content of array is:
                                                      24  16  14
                                                      19  5    4
                             The output should be
                             42

                                                                OR

                      (a)    Write a user defined function in C++ to find the sum of both left and right
                             diagonal elements from a two dimensional array.

                      (b)    Write a user-defined function EXTRA_ELE(int A[ ], int B[ ], int N) in C++  (3)
                             to find and display the extra element in Array A. Array A contains all the
                             elements of array B but one more element extra.  (Restriction: array
                             elements are not in order)

                             Example        If the elements of Array A is 14, 21, 5, 19, 8, 4, 23, 11
                                            and the elements of Array B is 23, 8, 19, 4, 14, 11, 5
                                            Then output will be 21

                                                                       OR
                       (b)
                             Write  a  user  defined  function  Reverse(int  A[],int  n)  which  accepts  an
                             integer array and its size as arguments(parameters) and reverse the array.
                             Example  :  if  the  array  is  10,20,30,40,50  then  reversed  array  is
                             50,40,30,20,10

                      (c)    An array S[10] [30] is stored in the memory along the column with each of   (3)
                             its element occupying 2 bytes. Find out the memory location of S[5][10], if
                             element S[2][15] is stored at the location 8200.

                                                                OR

                      (c)    An array A[30][10] is stored in the memory with each element requiring 4
                             bytes  of  storage  ,if  the  base  address  of  A  is  4500  ,Find  out  memory
                             locations of A[12][8], if the content is stored along the row.

                      (d)    Write the definition of a member function Ins_Player() for a class             (4)
                             CQUEUE in C++, to add a Player in a statically allocated circular queue of
                             PLAYERs considering the following code
                             is already written as a part of the program:
                             struct Player
                             {
                                    long Pid;
                                   char Pname[20];

                                                              6
   53   54   55   56   57   58   59   60   61   62   63