0% found this document useful (0 votes)
53 views

Array

The document contains 23 problems involving arrays in Java. The problems cover topics like inputting and printing array elements, searching arrays, sorting arrays, concatenating arrays, and calculating statistics like average and deviation from arrays. The problems range from basic operations like input/output to more complex tasks like sorting, searching, and calculating statistics from array data.

Uploaded by

Raza Manzar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Array

The document contains 23 problems involving arrays in Java. The problems cover topics like inputting and printing array elements, searching arrays, sorting arrays, concatenating arrays, and calculating statistics like average and deviation from arrays. The problems range from basic operations like input/output to more complex tasks like sorting, searching, and calculating statistics from array data.

Uploaded by

Raza Manzar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

ARRAY

1. WAP in java to input 10 integer elements in an array and print them.

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

Example: Input: Country Name India


Output: India Taj Mahal
Country Name USA
Output: ‘Sorry Not Found!’

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.

Sample Input: Enter the state and the capital


Bihar, Patna, West Bengal, Kolkata and so on…………
Sample Output: Enter the state whose capital is to be searched:
West Bengal The capital is Kolkata

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.

17. WAP in java using arrays:


(a) To store the Roll No., Name and Marks in 3 subjects for 50 students.
(b) Calculate the percentage of marks obtained by each candidate.
The maximum marks in each subjects are 100.
(c) Calculate the Grade as per given criteria:
Percentage Marks Grade
From 80 to 100 A
From 60 to 79 B
From 40 to 59 C
Less than 40 D

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
------------ ------------ --------- -----------
------------ ------------- ---------- -----------

WAP to read the data, calculated and display the following:


(a) Average marks obtained by each student.
(b) Print the roll number and the average marks of the students whose average is above 80.
(c) Print the roll number and the average marks of the students whose average is below 80.
19: WAP to input and stores roll numbers, names and marks in 3 subjects of n number of students in five
single dimensional arrays and display the remark based on average marks as given below:
Average Marks Remark
85 – 100 Excellent
75 – 84 Distinction
60 – 74 First Class
40 – 59 Pass
Less than 40 Poor
20. WAP in Java to store 5 words in a Single Dimensional Array and frame a new word by taking out the
first character of each word. Arrange the letters of the new word in ascending order and display the
resultant word.
Sample Input: Computer, History, Physics, Biology, English
New Word: CHPBE
Sample output: BCEHP

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.

Input Input Output


P[ ] Q[ ] R[ ]
4 19 4
6 23 6
1 7 1
2 8 2
3 3
10 10
19
23
7
8

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]

Programming Solution Point


PIYUSH SIR (8273651685)

You might also like