Array Practice Question
Easy Level
1. Array Input & Output
Write a program to input n integers into an array and print them in the same
order.
2. Reverse Print
Input an array and print its elements in reverse order.
3. Find Maximum & Minimum
Input an array of integers and find the largest and smallest element.
4. Sum of Elements
Calculate the sum and average of all elements in an array.
5. Count Even and Odd
Input an array and count how many numbers are even and how many are odd.
Medium Level
6. Search Element
Input an array and an integer x. Search if x is present in the array. If found, print
its index; otherwise, print -1.
7. Second Largest Element
Find the second largest number in the array without sorting.
8. Remove Duplicates
Remove duplicate elements from the array and print the updated array.
9. Frequency of Elements
Find and print the frequency of each element in the array.
10. Left Rotate Array
Rotate an array to the left by 1 position. Example: [1,2,3,4,5] → [2,3,4,5,1].
11. Running Sum
Write a Java program that:
• Accepts the size of an array from the user (must be greater than 0).
• Accepts integer values from the user to fill the array.
• Creates a new array where each element at index i is the running sum of
all elements from index 0 to i in the original array.
• Displays both the original array and the new running sum array.