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

Array Worksheet1

Uploaded by

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

Array Worksheet1

Uploaded by

Krishna Kanodia
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Write a program to input 20 integers in an _______ _______


array and print the even integers present _______ _______
in the array. 13.Write a program to input 15 integer
2. Write a program to input 15 integers in an elements in an array and sort them in
array and print the odd integers present at ascending order using the bubble sort
even indexes. technique. Print the sorted array.
3. Write a program to 40 decimal values in 14.Write a program to input twenty names in
an array and print the largest number. an array. Arrange these names in
4. Design a class to input age of 25 persons descending order of letters, using the
of a society and print the age of the oldest bubble sort technique.
person. 15.Write a program to search for an integer
5. Create a class to input time taken by 50 value input by the user in the sorted list
swimmers in a swimming competition. given below using binary search
Print the time taken by winner. technique. If found display ''Search
6. Create a class to input temperature Successful'' and print the element,
recorded in the month of December and otherwise display ''Search Unsuccessful''.
print the temperature of the hottest day {31, 36, 45, 50, 60, 75, 86, 90}
and coldest day along with the date. 16.Write a program to perform binary search
7. Write a program to input 25 characters on a list of integers given below, to search
and print the characters with the least for an element input by the user, if it is
ASCII code. found display the element along with its
8. Write a program to store 6 elements in an position, otherwise display the message
array P and 4 elements in an array Q. ''Search element not found''.
Now, produce a third array R, containing 5,7,9,15,20,30,45,89,97
all the elements of array P and Q. Display 17.Write a program to accept the year of
the resultant array. graduation from school as an integer
value from the user. Using the binary
search technique on the sorted array of
integers given below, output the message
"Record exists" if the value input is
located in the array. If not, output the
message "Record does not exist".
Sample Input:
{1982,1987,1993,1996,1999,2003,2006,2
007}
18.Write a program to initialize the seven
Wonders of the World along with their
9. Write to input 35 integers in an array and locations in two different arrays. Search
arrange them in ascending order using for a name of the country input by the
selection sort technique. Print the sorted user. If found, display the name of the
array. country along with its Wonder, otherwise
10.Create a class to input 40 characters and display "Sorry not found!".
arrange them in descending order using Seven Wonders: CHICHEN ITZA, CHRIST
selection sort technique. Print the sorted THE REDEEMER, TAJ MAHAL, GREAT WALL
array. OF CHINA, MACHU PICCHU, PETRA,
11.Write a program to input forty words in an COLOSSEUM
array. Arrange these words in descending Locations: MEXICO, BRAZIL, INDIA, CHINA,
order of alphabets, using selection sort PERU, JORDAN, ITALY
technique. Print the sorted array. Examples:
12.Write a program to input name and price Country name: INDIA
of n books in two single subscripted Output: TAJ MAHAL
arrays. Arrange the arrays in ascending Country name: USA
order of price. Print the sorted arrays in Output: Sorry Not found!
the given format. 19.Write a program to input and store integer
Book Price elements in a double dimensional array of
size 3 x 3 and find the sum of elements in
the left diagonal.
Example:
135
468
924
Output:
Sum of the left diagonal elements = (1 +
6 +4) = 11

You might also like