Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views7 pages

Array Programs For Class10th

The document contains a comprehensive list of programming exercises focused on array manipulation, including inputting, displaying, and performing calculations on integer and fractional arrays. It covers various topics such as sorting algorithms (bubble sort, selection sort), searching techniques (linear and binary search), and specific tasks like finding prime numbers, calculating averages, and handling multiple data types. The exercises are designed for practice and skill development in programming with arrays.

Uploaded by

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

Array Programs For Class10th

The document contains a comprehensive list of programming exercises focused on array manipulation, including inputting, displaying, and performing calculations on integer and fractional arrays. It covers various topics such as sorting algorithms (bubble sort, selection sort), searching techniques (linear and binary search), and specific tasks like finding prime numbers, calculating averages, and handling multiple data types. The exercises are designed for practice and skill development in programming with arrays.

Uploaded by

vanshpatel3424
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Array programs for practice

1. Write a program to input 5 integer elements in an array and display it.


Sample input:- 1, 2, 3, 4 ,5
Sample output:- 1, 2, 3, 4, 5
2. Write a program to input 5 integer elements in an array and display only Even element of it.
Sample input:- 1, 2, 3, 4 ,5
Sample output:- 2, 4
3. Write a program to input 5 integer elements in an array and display only Odd element of it.
Sample input:- 1, 2, 3, 4 ,5
Sample output:- 2, 4
4. Write a program to input 5 integer elements in an array and display only Prime element of it.
Sample input:- 1, 2, 3, 4 ,5
Sample output:- 2, 3, 5
5. Write a program to input 10 integer elements in an array, count and print:-
i) Total even elements present in the array
ii) Total odd elements present in the array
iii) Total prime elements present in the array
6. Write a program to input 20 integer elements in an array, calculate and print:-
i) Sum of all elements present in the array
ii) Sum of even elements present in the array
iii) Sum of odd elements present in the array
iv) Sum of prime elements present in the array
7. Write a program to input 25 integer elements in an array, calculate and print:-
i) Average of all elements present in the array
ii) Average of even elements present in the array
iii) Average of odd elements present in the array
iv) Average of prime elements present in the array
8. Write a program to input 40 integer number in an array, calculate and print:-
i) Highest number present in the array
ii) Lowest number present in the array
iii) Sum of Highest and Lowest number present in the array
iv) Difference of Highest and Lowest number present in the array
v) Average of Highest and Lowest number present in the array
9. Write a program to input 30students marks in an array, calculate and print:-
i) Highest mark present in the array
ii) Lowest mark present in the array
iii) Sum of Highest and Lowest marks present in the array
iv) Difference of Highest and Lowest marks present in the array
v) Average of Highest and Lowest marks present in the array

1 Learn Programming with No Errors


10. Write a program to input 50products price in an array, calculate and print:-
i) Highest price present in the array
ii) Lowest price present in the array
iii) Sum of Highest and Lowest price present in the array
iv) Difference of Highest and Lowest price present in the array
v) Average of Highest and Lowest price present in the array
11. Write a program to input 25cities temperatures in an array, calculate and print:-
i) Highest temperature present in the array
ii) Lowest temperature present in the array
iii) Sum of Highest and Lowest temperatures present in the array
iv) Difference of Highest and Lowest temperatures present in the array
v) Average of Highest and Lowest temperatures present in the array
12. Write a program to input 20 numbers in an array, and print:-
i) All single digit number present in the array
ii) Total all single digit number present in the array
iii) Sum of All single digit number present in the array
iv) Average of All single digit number present in the array
13. Write a program to input 40 numbers in an array, and print:-
i) All two digit number present in the array
ii) Total all two digit number present in the array
iii) Sum of All two digit number present in the array
iv) Average of All two digit number present in the array
14. Write a program to input 50 numbers in an array, and print:-
i) All perfect number present in the array
ii) Total perfect number present in the array
iii) Sum of All perfect number present in the array
iv) Average of All perfect number present in the array
15. Write a program to input 20 numbers in an array, and print numbers in reverse order( i.e. from last
index to first index)

------------------------------------------------Linear Search programs-------------------------------------


16. Write a program to input 20 numbers in an integers array and a search number. Using Linear Search
technique check and print the search number is found or not?
17. Write a program to input 20 students’ marks in an integers array and a search mark. Using Linear
Search technique check and print the search mark is found or not?
18. Write a program to input 40 cities temperature in a fractional array and a search temperature. Using
Linear Search technique check and print the search temperature is found or not?
19. Write a program to input 25 employees’ salaries in a fractional array and a search salary. Using Linear
Search technique check and print the search salary is found or not?

2 Learn Programming with No Errors


20. Write a program to input 30 products’ price in a fractional array and a search price. Using Linear Search
technique check and print the search price is found or not?
21. Write a program to input 20 numbers in an integers array and a search number. Using Linear Search
technique check and print the position of search number if found otherwise print “search
unsuccessful”.
22. Write a program to input 20 students’ marks in an integers array and a search mark. Using Linear
Search technique check and print the position of search mark if found otherwise print “search
unsuccessful”.
23. Write a program to input 40 cities temperature in a fractional array and a search temperature. Using
Linear Search technique check and print the position of search temperature if found otherwise print “”.
24. Write a program to input 25 employees’ salaries in a fractional array and a search salary. Using Linear
Search technique check and print the position of search salary if found otherwise print “search
unsuccessful”.
25. Write a program to input 30 products’ price in a fractional array and a search price. Using Linear Search
technique check and print the position of search price if found otherwise print “search unsuccessful”.
26. Write a program to input 20 numbers in an integers array and a search number. Using Linear Search
technique check and print the frequency of search number if found otherwise print “search data not
found”.
27. Write a program to input 20 students’ marks in an integers array and a search mark. Using Linear
Search technique check and print the frequency of search mark if found otherwise print “search data
not found”.
28. Write a program to input 40 cities temperatures in a fractional array and a search temperature. Using
Linear Search technique check and print the frequency of search temperature if found otherwise print
“search data not found”.
29. Write a program to input 25 employees’ salaries in a fractional array and a search salary. Using Linear
Search technique check and print the frequency of search salary if found otherwise print “search
unsuccessful”.
30. Write a program to input 30 products’ price in a fractional array and a search price. Using Linear Search
technique check and print the frequency of search price if found otherwise print “search
unsuccessful”.

------------------------------------------------Binary Search programs-------------------------------------


31. Write a program to input 20 numbers in an integers array and a search number. Using binary Search
technique check and print the search number is found or not?
32. Write a program to input 20 students’ marks in an integers array and a search mark. Using binary
Search technique check and print the search mark is found or not?
33. Write a program to input 40 cities temperature in a fractional array and a search temperature. Using
binary Search technique check and print the search temperature is found or not?

3 Learn Programming with No Errors


34. Write a program to input 25 employees’ salaries in a fractional array and a search salary. Using binary
Search technique check and print the search salary is found or not?
35. Write a program to input 30 products’ price in a fractional array and a search price. Using binary Search
technique check and print the search price is found or not?
36. Write a program to input 20 numbers in an integers array and a search number. Using binary Search
technique check and print the position of search number if found otherwise print “search
unsuccessful”.
37. Write a program to input 20 students’ marks in an integers array and a search mark. Using binary
Search technique check and print the position of search mark if found otherwise print “search
unsuccessful”.
38. Write a program to input 40 cities temperature in a fractional array and a search temperature. Using
binary Search technique check and print the position of search temperature if found otherwise print
“search unsuccessful”.
39. Write a program to input 25 employees’ salaries in a fractional array and a search salary. Using binary
Search technique check and print the position of search salary if found otherwise print “search
unsuccessful”.
40. Write a program to input 30 products’ price in a fractional array and a search price. Using binary Search
technique check and print the position of search price if found otherwise print “search unsuccessful”.

-----------------------------------Bubble Sort programs-----------------------------------------


41. Write a program to input 20 numbers in an integers array. Using bubble sort technique sort and
arrange the numbers in:-
i) Ascending order
ii) Descending order
Print the result array.
42. Write a program to input 20 students’ marks in an integers array. Using bubble sort technique sort and
arrange the marks in:-
i) Ascending order
ii) Descending order
Print the result array.
43. Write a program to input 40 cities temperatures in a fractional array.Using bubble sort technique sort
and arrange the temperatures in:-
iii) Ascending order
iv) Descending order
Print the result array.
44. Write a program to input 25 employees’ salaries in a fractional array. Using bubble sort technique sort
and arrange the salaries in:-
v) Ascending order
vi) Descending order

4 Learn Programming with No Errors


Print the result array.
45. Write a program to input 30 products’ price in a fractional array. Using bubble sort technique sort and
arrange the prices in:-
vii) Ascending order
viii) Descending order
Print the result array.

------------------------------------------------Selection Sort programs-------------------------------------


46. Write a program to input 20 numbers in an integers array. Using selection sort technique sort and
arrange the numbers in:-
i) Ascending order
ii) Descending order
Print the result array.
47. Write a program to input 20 students’ marks in an integers array. Using selection sort technique sort
and arrange the marks in:-
i) Ascending order
ii) Descending order
Print the result array.
48. Write a program to input 40 cities temperatures in a fractional array. Using selection sort technique
sort and arrange the temperatures in:-
i) Ascending order
ii) Descending order
Print the result array.
49. Write a program to input 25 employees’ salaries in a fractional array. Using selection sort technique
sort and arrange the salaries in:-
i) Ascending order
ii) Descending order
Print the result array.
50. Write a program to input 30 products’ price in a fractional array. Using selection sort technique sort
and arrange the prices in:-
i) Ascending order
ii) Descending order
Print the result array.

--------------------------------------------Miscellaneous Array programs-------------------------------------

51. Write a program to input 12 integer elements in an array and print the sum of all even and odd
elements separately.
52. Write a program to input 10 integer elements in an array and print its maximum element with it

5 Learn Programming with No Errors


position.
53. Write a program to input 12 integer elements in an array and print its maximum and minimum
element and their position and also print their difference.
54. Write a program to input array elements of size n, reverse it with using 2 nd array where n is given by
user. Display the resultant array.
55. Write a program to input array elements of size n, reverse it without using 2 nd array where n is given by
user. Display the resultant array.
56. Write a program to input 6 elements in array P, 4 elements in an array Q and produce a third array R
containing the elements of P and Q. Display the resultant array. [2010]
Input:
P[]= 4 6 1 2 3 10
Q[]= 19 23 7 8
R[]= 4 6 1 2 3 10 19 23 7 8
57. Write a program to input 6 elements in array P, 6 elements in an array Q and produce a third array R
containing the elements of P and Q in following manner. Display the resultant array.
Input:
P[]= 4 6 1 2 3 10
Q[]= 19 23 7 8 13 25
R[]= 4 19 6 23 1 7 2 8 3 13 10 25
58. Write a program to input 10 character elements in an array, count and display vowel charcters.
59. The annual examination result of 50 students in a class is tabulated as follows:
Roll no. subject A subject B subject C [2009]
------- ---------- ---------- --------
------- ---------- ---------- ----------
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 students whose average marks is above 80
c) Print the roll number and average marks of students whose average marks is below
60. Write program to accept the names of 10 cities in a single dimension string array and their STD codes
in another single dimensional 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 a message “Search Unsuccessful. No such city in the list.” [2012]
61. Write a program to initialize array of 10 names and initialize another array with their respective
telephone numbers. Search for a name by the user in the list. If found, display “Search Successful” and
print the name along with its telephone number otherwise print a message “Search Unsuccessful”.
[2005]
62. 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 is located in the array. If not, output the message “Record does not exist”.
[2014]
{ 1982, 1987, 1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010}

6 Learn Programming with No Errors


63. Write a program store name of 5 cities in an array. Arrange them in alphabetical order and display it.
Input: Delhi, Kolkata, Bangalore, Lucknow, Ajmer
Output: Ajmer, Bangalore, Delhi, Kolkata, Lucknow
64. The marks obtained by 50 students in a subject are tabulated as follows:
Name Marks [2006]
------- -------
------- -------
Write a program to input the name and marks of the students in the subject. Calculate and display
a) The subject average marks (subject average=subject total/50)
b) The highest marks in the subject and name the student (the maximum marks in the subject is 100)
65. Write a program to input 10 numbers in array P, and print the result array R by arranging even
numbers from left and odd elements from right.
Input:
P[]= 1 2 3 4 5 6 7 8 9 10
Output:
R[]= 2 4 6 8 10 9 7 5 3 1

66. Write a program to input 10 students name. using bubble sort technique arrange the names in:-
a. A to Z order and print it.
b. Z to A order and print it.

7 Learn Programming with No Errors

You might also like