Wednesday, December 5, 2018

Array Coding Questions

Arrays exercises
1.  Write a Java program to sort a numeric array.
2. Write a Java program to sum values of an array
3. Write a Java program to calculate the average value of array elements.
4. Write a Java program to test if an array contains a specific value
5. Write a Java program to find the index of an array element
6. Java Program to Find the Largest Two Numbers in a Given Array
7. Java Program to Find the Second Largest & Smallest Elements in an Array
8. Java Program to Find the Largest Number in an Array
9. Write a Java program to copy an array by iterating the array.
10. Write a Java program to remove a specific element from an array.
11.  Write a Java program to reverse an array of integer values.
12. Java Program to Put Even & Odd Elements of an Array in 2 Separate Arrays
13. Java Program to Split an Array from Specified Position
14. Java program to check sparse matrix.
15. Java program to find the common elements in two integer arrays.
16. Java program to move all zero at the end of the array.
17. Java program to merge two one dimensional arrays.
18. Java program to create a matrix and fill it with prime numbers.
19. Java program to check whether a given matrix is Lower Triangular
Matrix or not.
20.  Write a Java program to find the duplicate values of an array of integer
values
21. Java program to remove duplicate elements from an array.
22. Java Program to Find 2 Elements in the Array such that Difference between them is
Largest
23. Java Program to Segregate 0s on Left Side & 1s on Right Side of the Array
24. Java Program to Find the Number of Non-Repeated Elements in an Array
25.   Write a Java program to find all pairs of elements in an array whose
sum is equal to a specified number.
26.  Write a Java program to test the equality of two arrays
27. Write a Java program to find the number of even and odd integers in a
given array of integers.

28.  Write a Java program to find common elements from three sorted (in
non-decreasing order) arrays.
29.  Write a Java program to compute the average value of an array of
integers except the largest and smallest values
30. Write a Java program to check if an array of integers without 0 and -1.
31. Write a Java program to remove the duplicate elements of a given array
and return the new length of the array.
32. Write a Java program to print all the LEADERS in the array.   Go to the
editor
Note: An element is leader if it is greater than all the elements to its right
side.
33. Write a Java program to find the two elements from a given array of
positive and negative numbers such that their sum is closest to zero.
34. Write a Java program to find all combination of four elements of an given
array whose sum is equal to a given value
35. Write a Java program to count the number of possible triangles from an
given unsorted array of positive integers. 
36. Write a Java program to cyclically rotate a given array clockwise by one
37.  Write a Java program to check whether there is a pair with a specified
sum of a given sorted and rotated array.
38. Write a Java program to arrange the elements of an given array of
integers where all negative integers appear before all the positive
integers.
39. Write a Java program to arrange the elements of an given array of
integers where all positive integers appear before all the negative
integers. 
40. Write a Java program to sort an array of positive integers of an given
array, in the sorted array the value of the first element should be
maximum, second value should be minimum value, third should be
second maximum, fourth second be second minimum and so on.
41. Write a Java program to separate even and odd numbers of an given
array of integers. Put all even numbers first, and then odd numbers.
42.  Write a Java program to replace every element with the next greatest
element (from right side) in an given array of integers.
43. Java Program to Count the Number of Occurrence of an Element in an Array

44. Write a C program to count frequency of each element in an array.

No comments:

Post a Comment