Array
Array
2. WAP in Java to store 20 numbers (Including Even and Odd numbers) in a S.D.A and display the sum of
all Even numbers and all Odd numbers separately stored in the cell.
3. WAP to accept 10 different numbers in a Single Dimensional Array(SDA). Display the greatest element
of the array elements.
4. WAP to accept 10 different numbers in a Single Dimensional Array(SDA). Display the sum of all the
numbers which are divisible by either 3 or 5.
5. WAP to accept 10 different numbers in a Single Dimensional Array(SDA). Now, enter a number
and search whether the number is present or not in the list of array elements by using the
‘Linear Search’ technique.
6. WAP to initialize the ‘Seven Wonders of the World along with their locations in two different arrays.
Search for a name of the country input by the user. If found, display the country along with its Wonder.
Seven Wonders: Chichen Itza, Christ the Redeemer, Taj Mahal, Great Wall of China, Machu Picchu,
Petra, Colosseum.
Location: Maxico, Brazil, India, China, Peru, Jordan, Italy
7. WAP to accept 10 states and 10 capitals of a country in two different Single Dimensional Array(SDA).
Now, enter a state of the country to display it’s capital. If it is present then display it’s capital
otherwise, display a relevant message.
8. WAP to accept the names of 10 cities in a single dimensional string array and their STD(Subscribers
Trunk Dialing) codes in another single dimensional integer array. Search for the name of a city input
by the user in the list. If found, display the message “Search unsuccessful, no such city in the list”.
9. WAP to store 20 different names along with corresponding Telephone numbers. Enter a name from
the console and search whether the name is present or not. If the name is present then display the
name along with the phone number otherwise, display an appropriate message using the ‘Linear Search’.
10. WAP to perform Binary Search on a list of integers given below, to search for an element input by the
user, if it is found display the element input by the user, if it found display the element along with its
position, otherwise display the message, “Search element not found”.
5, 7, 11, 15, 20, 30, 45, 89, 97,101
11. WAP to accept the 10 year of graduation from school as an integer value from the user. Using the
‘Binary Search’ technique on the sorted array of integers gives below, output the message “Record
exists” if the value input is located in the array. If not, output the message “Record does not exist”.
12. WAP to input and store the weight of ten people, Sort and display them in ascending order using the
‘Bubble sort’ technique.
13. WAP to initialize 5 different city names in a Single Dimensional Array. Arrange the names in
ascending order by using the ‘Bubble Sort’ technique and display them.
Input: Delhi, Bangalore, Agra, Mumbai, Calcutta.
Output: Agra, Bangalore, Calcutta, Delhi, Mumbai.
14. WAP to accept 10 different numbers in a Single Dimensional Array. Arrange the numbers in ascending
order by using the ‘Selection Sort’ technique and display them.
15. WAP to Initialize 10 names in an Array. Arrange these names in descending order of alphabets, using
the ‘Selection Sort’ technique.
Input: Aman, Karan, Bhanu, Varun, Amit, Sural, Kapil, Zakir, Sumit, Ravi.
16. WAP in Java to stores the runs scored by 11 Indian Cricket Players in an innings along with their
names. Now display the name of the cricketer who has made the highest score in that innings along
with the runs.
18. The Annual examination result of 100 Student in a class is tabulated in a S.D.A is as follows:
Roll No. Subject A Subject B Subject C
------------ ------------ --------- -----------
------------ ------------- ---------- -----------
21: WAP to stores 6 elements in an array P and 4 elements in array Q. Now, produce a third array R,
Containing all the elements of array P and Q. Display resultant array.
22: WAP to stores 10 words in a Single Dimensional Array. Display only those words which are
Palindromes.
Sample Input: MADAM, TEACHER, SCHOOL, NITIN
Sample Output: MADAM
NITIN
23. WAP to accept name and total marks of N number of students in two single subscript array name[ ]
and totalmarks[ ]. Calculate and print:
(i) The average of the total marks obtained by N number of students.
[average = (sum of total marks of all the students)/N]
(ii) Deviation of each student’s total marks with the average.
[deviation = total marks of a student – average]