0% found this document useful (0 votes)
15 views3 pages

Array Programming Challenges and Solutions

The document contains a series of programming questions focused on array manipulation, covering tasks such as finding minimum and maximum values, sorting city names using Bubble Sort, calculating average marks for students, performing binary searches, and merging arrays. Each question is associated with a specific year from 2007 to 2019. The problems are designed to enhance programming skills in handling arrays and implementing sorting and searching algorithms.

Uploaded by

jeslindinahar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Array Programming Challenges and Solutions

The document contains a series of programming questions focused on array manipulation, covering tasks such as finding minimum and maximum values, sorting city names using Bubble Sort, calculating average marks for students, performing binary searches, and merging arrays. Each question is associated with a specific year from 2007 to 2019. The problems are designed to enhance programming skills in handling arrays and implementing sorting and searching algorithms.

Uploaded by

jeslindinahar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PROGRAMMING QUESTIONS BASED ON ARRAY

1. Write a program to initialize the given data in an array and find the minimum and maximum
values along with the sum of the given elements.
I/P
Numbers : 2 5 4 1 3

O/P

Minimum Value : 1
Maximum Value : 5
Sum of the Elements : 15 Year: 2007

2. Define a class and store the given city names in a single dimensional array. Sort the names in
alphabetical order using the Bubble Sort technique only.
I/P
Delhi, Bengaluru, Agra, Mumbai, Kolkata.

O/P
Agra, Bengaluru, Delhi, Kolkata, Mumbai Year: 2008

3. The annual examination results of 50 students in a class is tabulated as follows:

Roll. No. Sub. A Sub. B Sub. C

Write a program to read the data, calculate and display the following:
a) Average marks obtained by each student.
b) Print the roll number and average marks of the students whose average mark is above 80.
c) Print the roll number and average marks of the students whose average mark is below 40.
Year: 2009
4. Write a program 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 along with its position, and
otherwise display the message “Search element not found”.
5, 7, 9, 11, 15, 20, 30, 45, 89, 97
Year: 2010
5. Write a program to store 6 elements in an array P and 4 elements in an array Q and produce a
third array R, containing all the elements of array P and Q. Display the resultant array.
Eg:
P[ ] Q[ ] R[ ]
4 19 4
6 23 6
1 7 1
2 8 2
3 3
10 10
19
23
7
8
Year: 2010
6. Write a program to input and store the weight of ten people. Sort and display them in
descending order using the selection sort technique.
Year: 2011
7. Write a program to input 10 integer elements in an array and sort them in descending order
using the Bubble sort technique.
Year: 2013
8. Write a program to accept the names of 10 cities in a single dimension string array and their
STD (Subscribers Trunk Dialing) codes in another single dimension integer array. Search for a
name of a city input by the user in the list. If found display “Search Successful” and print the
name of the city along with its STD code or else display the message “Search unsuccessful, No
such city in the list”
Year: 2012
9. Write a program to accept the year of 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”.
{1982, 1987, 1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010}
Year: 2014
10. Write a program to input and store 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 = (Total Marks / 3)

Average Mark Remarks


85 – 100 Excellent
75 – 84 Distinction
60 – 74 First Class
40 – 59 Pass
Less than 40 Poor
Year: 2015
11. Write a program 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 name
of the country along with its wonder, otherwise display “Sorry, Not Found”

Seven Wonders :- CHICHEN ITZA, CHRIST THE REDEEMER, TAJ MAHAL, GREAT WALL OF CHINA,
MACHUPICCHU, PETRA, COLOSSEUM

Locations :- MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY

Example:
I/P Country Name: India
O/P INDIA – TAJ MAHAL

I/P Country Name: USA


O/P Sorry, Not Found
Year: 2016
12. Write a program to input integer elements into an array of size 20 and perform the following
operations:
a. Display largest number from the array.
b. Display smallest number from the array.
c. Display sum of all the elements of the array.
Year: 2017
13. Write a program to input forty words in an array. Arrange those words in descending order of
alphabets using Selection Sort technique. Print the sorted array.
Year: 2017
14. Write a program to accept name and total marks of N number of students in two single
subscript array name [ ] and total marks [ ]. Calculate and print as below:
a) The average of the total marks obtained by N number of students.
[Average = (Sum of total marks of all students)/N]

b) Deviation of each student’s total marks with the average.


[Deviation = total marks of a student – average]
Year: 2018
15. Write a program to input 15 integer elements in an array and sort them in ascending order
using the Bubble Sort technique.
Year: 2019

You might also like