Array Practice Questions
Array Practice Questions
2. C++ Program to put even & odd elements of an array in 2 separate arrays.
Enter the size of array AR
6
Enter the elements of the array
34
56
78
90
12
39
The elements of OAR are
39
The elements of EAR are
34
56
78
90
12
8. C++ Program to Find Missing Numbers in an Array of Size N-1 with Numbers[1,N]
enter the range of array
9
enter a[0]element into the array:1
enter a[1]element into the array:5
enter a[2]element into the array:2
enter a[3]element into the array:7
enter a[4]element into the array:3
enter a[5]element into the array:4
enter a[6]element into the array:10
enter a[7]element into the array:9
enter a[8]element into the array:6
The missing number -> 8
Mode = 2 5
11. C++ Program to Split the Array and Add First Part to the End
Enter the value of n
4
enter the numbers
3
678
345
876
Enter the position of the element to split the array
3
The resultant array is
876
3
678
345
12. C++ Program to Segregate 0s and 1s in an Array
Original array = {0, 1, 0, 1, 1, 0}
segregated array is 0 0 0 1 1 1
13. C++ Program to Find the Largest Sum of Contiguous Subarray of an Array
Type the length of the array
8
type the elements of the array
-1
-5
5
3
-2
5
4
1
15. C++ Program to Print all Repeated Elements with Frequency in an Array
Array {5, 10, 10, 2, 1, 4, 2};
duplicate elements present in the given array are 10 2