Array
Array
B) Consider the given array and answer the questions given below:
int x[ ] = {4, 7, 9, 66, 72, 0, 16};
(a) What is the length of the array?
(b) What is the value in x[4]?
C) What is the difference between the linear search and the binary search technique?
Define a class to accept values into a 3 × 3 array and check if it is a special array. An
array is a special array if the sum of the even elements = sum of the odd elements.
3. Define a class to accept values into an array of double data type of size 20. Accept a
double value from user and search in the array using linear search method. If value is
found display message "Found" with its position where it is present in the array.
Otherwise display message "not found".
4. Define a class to accept values in integer array of size 10. Find sum of one digit
number and sum of two digit numbers entered. Display them separately.
5. 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
d) Write a program to input forty words in an array. Arrange these words in
descending order of alphabets, using selection sort technique. Print the sorted
array. OR
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 Remark
85 — 100 Excellent
75 — 84 Distinction
60 — 74 First Class
40 — 59 Pass
Less than 40 Poor
6. Define a class to accept 10 characters from a user. Using bubble sort technique
arrange them in ascending order. Display the sorted array and original array. OR
Write a program to input and store roll number and total marks of 20 students. Using
Bubble Sort technique generate a merit list. Print the merit list in two columns
containing roll number and total marks in the below format: