Array's Practical Questions
Practical sample questions for Array and operations.
Take N numbers as input, remove all negative numbers, and find the average of remaining elements.
From a given array, replace all even numbers with -1 and all odd numbers with 1.
Delete all elements that are multiples of 4 from the array and print the updated array.
Count how many elements in the array are divisible by both 3 and 5.
Replace prime numbers in the array with 0 and find the sum of non-prime numbers.
Find the smallest and second smallest element in an array.
From a given array, shift all zero elements to the end without changing the order of other elements.
Replace all elements greater than the average value of the array with the average itself.
Count the number of odd numbers and even numbers in a given array.
Delete duplicate elements from an array and display the unique elements.
From the given array, replace multiples of 7 with 7 and multiples of 9 with 9.
Reverse the array and then find the sum of elements at even positions.
Replace all negative numbers with their absolute values and print the modified array.
Find the difference between the largest and smallest elements in the array.
Count how many prime numbers are present in the array.
Replace all numbers ending with digit 5 by 50.
Remove all elements less than 10 and find the average of remaining elements.
Find the frequency of each element in an array.
Replace all odd-position elements with 0 and then find the sum of even-position elements.
Check whether the given array is sorted in ascending order or not.
From the given array, replace multiples of 3 with 0, multiples of 5 with 1, and multiples of both with -1.
Find the maximum element in the array and count how many times it appears.
Delete all prime numbers from the array and print the remaining elements.
Replace every element by the square of that element if it is even, otherwise replace it by its cube.
Rotate the array to the right by one position and display the result.
Last updated