# Java Problems on Array for Beginners and Experts

1. Write a Java program that calculate sum of all diagonal elements of 4*4 double dimensional array. Output should be 36

Output: 36

2. Write a Java program to find sum of even and odd number separately

Output should be:

Even: 12

Odd: 16

3. Find the length of integer array without using any predefined function

Output: 7

4. Create two arrays with same no of integer element and create third array which contains sum of two arrays

Array1:

Array2:

Output:

5. Write Java code to check if two Integer arrays are identical

Array1:

Array2:

Output: Array are Identical

6. Write Java code to transpose two dimensional array. Program should be able to transpose n*n size

7. Write Java code to convert integer [][] to integer[] . Code should support n number of elements.

8. Write Java code to reverse a SDM without using any predefined method of Java

9. Write Java program to short one array using index values which are in another array

10. Write Java code to find regions of connected 1’s in DDM (m*n) which is filled of 0 and 1. Here is an example
Example 1:-

Answer: Regions of Regions of connected 1s are: 3

Example 2:-

Answer: Regions of Regions of connected 1s are: 2

Example 3:-

Answer: Regions of Regions of connected 1s are: 2

For any clarification or for more problems please contact admin@cppbuzz.com

Be the first of your friends to like this Page

### CppBuzz Forum^{☆}

Now you can ask programming questions on our forum [continue..]