Tuesday, October 20, 2015

Assignment : ARRAY

                                     ASSIGNMENT : ARRAY

1 An array A [20][20] is stored in the memory along the column with each of the Element require 4 bytes. Find the address of A[10][12], if A[1][1] is stored in           location 1000.               
  2  Write a user defined function in C++  which accept a one d array and its size as argument and divide all the elements by 5 which are dividible by 5 and multiply other elements by 7.             

3 Two dimensional array ARR[8][7] having real numbers(double), is stored in the memory along the row, find out the memory location for the element ARR[2][4], if an element ARR[1][5] is stored at the memory location 1000.                 

4  An array S[40][30] is stored in the memory along the row with each of the element occupying 4 bytes, find out the memory location for the element S[15][5], if an element s[20][10] is stored at memory location 5700.                                                                                                                                                
5 Write UDF in C++ which accepts an integer array and its size as arguments/ parameters and assign the elements into a 2 D array of integers in the following format:
            If the array is 1,2,3,4,5.
             The resultant 2D array is given below
            1 0 0 0 0
            1 2 0 0 0
            1 2 3 0 0
            1 2 3 4 0
            1 2 3 4 5                                                                                                                                
6  Write UDF in C++ to print the row sum and column sum of a matrix.                                                                                            
7          An  array P[20][30] is stored in the memory along the column with each of the element occupying 4 bytes, find out the memory location for the element P[5][15], if an element P[2][20] is stored at the memory location 5000.                                   


8          Write a function in C++ which accepts a integer  array and its size as an
 arguments and arrange the array in reverse

 if initially array is
     4,2,5,1,6,7,8,12,10

The final array will be
    10,12,8,7,6,1,5,2,4

9          Write a function in C++ which accepts a integer  array and its size as an
 arguments and prints the output (using nested loops) in following format :
Example : if the array is having
1 2 4 5 9

Then the output should be 
1
2 2
4 4 4 4
5 5 5 5 5
9 9 9 9 9 9                                                                                          
10  An array A[10][20] is stored in the memory with each element occupying 2 bytes of storage. If the Base address of array in the memory is 800 , determine the location of A[9][10] when the array is stored as (i) Row Major (ii) column major.

11        Write a function in C++ to merge the contents of two sorted arrays A & B into third array C. Assuming array A is sorted in ascending order, B is sorted in descending order, the resultant array is required to be in ascending order.                                                                                                                                                                                      
12 Assume an array S of structure Student is to be arrange in descending order of marks. Write a function which will accept the required array and its size as argument and arrange the same with bubble sort.
The given structure is-
Struct Student
{
            Int rno;
            Char name[];
            Float marks;
};                                                         

No comments:

Post a Comment

ASSIGNMENT INHERITANCE

ASSIGNMENT INHERITANCE