Array Questions
Array Questions
Question 1: Write a program to store 10 elements in an array of integers and print the array on the screen.
Question 2: Write a program to store 10 elements in an array of double. The program finds the sum of all
elements of the array and displays it.
Question 3: Write a program to store 10 elements in an array of integers. Program store the double value
of each element of one array into another array. Print the second array on the screen.
Question 4: Write a program to find the sum and average one-dimensional integer array.
Question 5: Write a program to swap the first and last element of an integer 1-d array.
Question 6: Write a program to reverse the element of an integer 1-D array.
Question 7: Write a program to find the largest and smallest element of an array.
Question 8: Write a program to find the sum of all even and odd elements of an array.
Question 9: Write a program to find the total number of even and odd number of elements in the array.
Question 10: Write a program that stores 10 values in an array of type integers. Program count and
display the total number of duplicate elements in an array.
Question 11: Write a program that stores 10 values in an array of type integers. Finds the sum of all those
values which are less than the average of all values of the array.
Question 12: Write a program that stores 10 values in an array of type integers. It calculates and displays
the difference between the largest and smallest values in an array.
Question 13: Write a program that stores 5, 5 values in two integer arrays. Program find the value of the
common elements and store them into third arrays.
Question 14: Write a program that initializes an array of ten integers. It inputs an integer from the user
(Searching number) and searches the value in the array using linear search.
Question 15: Write a program that initializes an array of ten integers. It inputs an integer from the user
(Searching number) and searches the value in the array using binary search.
Question 16: Write a program that initializes an array of ten integers. It sorts the array using bubble sort.
Display array after and before sorting.
Question 17: Write a program that initializes an array of ten integers. It sorts the array using selection
sort. Display array after and before sorting.
Question 18: Write a program that initializes an array of ten integers. Program find the smallest and
smallest element in an array.
Question 19: Write a program that initializes an array of ten integers. The program finds the second
largest element in an array.
Question 20: Write a program that initializes an array of ten integers. The program finds the second
smallest element in an array.