Professional Documents
Culture Documents
CLASS XI
ASSIGNMENT – FUNCTIONS,2D ARRAY
Output Questions:
1. #include<iostream.h> 2. #include<iostream.h>
void Execute(int &x,int y=200) int a=3;
{ int temp=x+y; x+=temp; void demo(int x, int y,int &z)
if(y!=200) { a+=x+y;
cout<<temp<<” “<<x<<” “<<y<<endl; z=a+y;
} y+=x;
void main() cout<<x<<” “<<y<<” “<<z<<endl; }
{ int a=50,b=20; void main()
Execute(b); { int a=2,b=5;
cout<<a<<” “<<b<<endl; demo(::a,a,b);
Execute(a,b); cout<<::a<<” “<<a<<” “<<b<<endl;
cout<<a<<” “<<b<<endl; } demo(::a,a,b); }
9. Write a function in C++ which accepts a character array and its size as arguments
and reverse that array without using second array and library function.
Example : if the array is having: “Computer Science”
Then after reversal it should rearranged as: “ecneicS retupmoC”
10.WAF that accept an array of 10 integers with size. The function fins a particular
number from the array by using the binary search method
11.write a user define function repeat() which takes a two dimensional array with size N
rows and M columns as argument and convert all repeated element into zero.
12.Write a user defined function in C++ to multiply 5 to each element of array X[4][4]
except diagonal elements where array is passed as parameter.
13. Write a function in C++ to find and display the sum of each row and each column of a
2D array of type float. Use the array and its size as parameters with float as its return type.
14. Write a user defined function in C++ to display the multiplication of column elements of
a 2 dimensional array MATRIX [6][6] containing integers
15. ) Write a user defined function in C++ to display those elements of 2 dimensional array
T[4][4] which are divisible by 100. Assume the content of the array is already present and
the function prototype as follows
void Display(int T[4][4]);
16. Write a function in c++ which accepts a 2D array of integers, number of rows and
number of columns as arguments and assign the elements which are divisible by 3 or 5
into a one dimensional array of integers.
12 3 9 14
If the 2D array is
[ 24 25 16 31
19 32 45 27
11 5 28 18
]
The resultant 1D arrays is 12 , 3 , 9 , 24 , 25 , 45 , 9 , 5 , 18