One -Dimension array level -1 question
Q.1) WAP to create a array of n integer elements. And perform following operations.
a) display
b) display in reverse order.
c) display alternate elements from starting index.
d)display elements which are multiple of 7
e) add them all and show result
f) find avg.
Q.2) WAP to find highest and second highest element in an array.
Q.3) WAP to find lowest and second lowest element in an array.
Q.4) WAP to find highest and lowest element in an array.
Q.5) WAP to find sum of all even element in an array.
Q.6) WAP to find sum of all odd element in an array.
Q.7) WAP to count all odd element in an array, and display result.
Q.8) WAP to create an array of names. And perform searching operation too of any key element,
If result is not found. display message not found otherwise display the indices where our key element
is present.
One dimensional array level -2 question
Q.9) WAP to create an array with n even elements. (hint: use while loop instead of for)
Q.10) WAP to copy the elements of one array into another array.
Q.11) WAP to display all unique elements of an array
Q.12) WAP to separate odd and even integers into separate arrays.
One dimensional array level -3 question
Q.1) WAP to find how many duplicate elements are present in our array.
(duplicate element has a frequency of more than 1)
Q.2) WAP to find the sum of duplicate elements which are present in our array.
(duplicate element has a frequency of more than 1)
Q.3) WAP to display only the prime number which are present in our array.
Q.4) Given an array of size n-1 such that it only contains distinct integers in the range of 1 to
n. display the missing element.
Examples:
Input: n = 5, arr[] = {1,2,3,5} Output: 4
Input: n = 2, arr[] = {1} Output: 2
Q.2 Given an integer array nums, move all 0's to the end of it while maintaining the relative
order of the non-zero elements.
Note that you must do this in-place without making a copy of the array.
Example 1:
Input: nums = [0,1,0,3,12] Output: [1,3,12,0,0]
Example 2:
Input: nums = [0] Output: [0]
Q.3 Given an integer array nums, rotate the array to the right by k steps, where k is non-
negative.
Example 1:
Input: nums = [1,2,3,4,5,6,7], k = 3
Output: [5,6,7,1,2,3,4]
Explanation:
rotate 1 steps to the right: [7,1,2,3,4,5,6]
rotate 2 steps to the right: [6,7,1,2,3,4,5]
rotate 3 steps to the right: [5,6,7,1,2,3,4]
Example 2:
Input: nums = [-1,-100,3,99], k = 2
Output: [3,99,-1,-100]