3.b) An array MAT[20][10] is stored in the memory along the row with each element occupying 4 bytes of the memory. Find out the Base address and the address of element MAT[10][5] , if the location MAT[3][7] is stored at the address 1000.
Solution: Children, Try this answer as an
              assignment.
            
DELHI 2005:
            
3.a) Write a function in C++ which accepts an
              integer array and its size as arguments and exchanges the values of first half side elements with the second half side elements of
              the array.
            
Example :
              If an array of 8 elements initial content as 2, 4, 1, 6, 7, 9, 23, 10.The function should rearrange array as 7, 9, 23, 10, 2, 4, 1, 6
            
Solution:
            
void change(int a[ ],int size)
{
int i,j,temp;
for(i=0,j=size/2;j<size;i++,j++)
{ temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
3.b) An array Arr[15][35] is stored in the memory along the row with each of its element
              occupying 4 bytes . Find out the Base address and the address of element Arr[2][5] , if the location Arr[5][10] is stored at the address 4000.
            
Solution: Children, Try this answer as an
              assignment.
            
3.d) Write a function in C++ to print sum of all values which either are divisible by 2 or divisible by 3 present in a 2D array passed as the argument of the function.
            
Solution:
            
void Sum(int A[ ][ ],int R,int C)
{ int i,j,S=0;
for(i=0;i<R;i++)
for(j=0;j<C;j++)
if(A[i][j]%2= = 0 ||A[i][j]%3= = 0)
S=S+A[i][j];
cout<<”\nThe Sum of all the values which are divisible by 2 or 3 in the array = “<<S;
}
OUTSIDE DEHI 2005:
            
3.a) Write a function in C++ which accepts an integer array and its size as arguments and exchanges the values of first half side elements with the second half side elements of the array.
            
Example :
              If an array of 8 elements initial content as 
              8, 10, 1, 3, 17, 90, 13, 60
              The function should rearrange array as 
              17, 90, 13, 60, 8, 10, 1, 3
            
Solution: Refer Delhi 2005 Q.3a.
            
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )