Page 406 - CA_Blue( J )_Class10
P. 406
9. What is a 2D array in Java?
a. An array that contains elements of different data types.
b. An array with two elements.
c. An array of arrays, where each element is itself an array.
d. An array that can hold only integers.
10. What is the syntax to initialize a 2D array of size 3×3 in Java?
a. int[][] myArray = new int(); b. int[][] myArray = new int[3, 3];
c. int[][] myArray = { {1, 2}, {3, 4} }; d. int[][] myArray = new int[3][3];
B. Answer the following questions:
1. Write a program to input 10 numbers in an array and print the sum of all the multiples 6 and product of all the negative numbers.
2. Write a program to input 25 numbers in an array and print all the palindromic numbers in the array.
3. Accept 10 numbers into an array and then calculate the sum of even numbers present in odd positions.
4. Create three arrays A, B and C both of size 5. Accept numbers in two arrays A and B. Fill all the elements of array C with the sum
of numbers present in appropriate element of arrays A and B.
5. Accept 10 numbers into an array. Then accept a number and delete the number present in that position.
6. Accept items name and price in two single-dimensional arrays and calculate the total amount to be paid by the customer. Display
the following:
Item Name Price
…….. ……..
…….. ……..
Total Amount ……..
7. Create an array of size 10 then accept 9 numbers into it. Then accept another number and a position where you want to insert it.
Insert the given number in given position then display the array.
8. Accept 10 names in an array and sort the names in ascending order using Selection Sort.
9. Write a program to input "n" numbers and store the odd numbers and even number separately in two different arrays.
10. Write a program to print the sum of all the Niven numbers in the array of size 20.
11. Write a program in JAVA to accept the name and marks in computer science of forty students in an array and then print the name
and marks of students according to their merit.
12. Write a Java program to create an array of size 25 and find the maximum and minimum value in the array.
13. Write a Java program to accept 15 numbers and reverse the numbers. Say, 123 will be 321.
14. Write a Java program to find the common elements between two arrays A and B and print them.
15. The annual examination results of 50 students in a class is tabulated as follows:
Roll No. Subject A Subject B Subject 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.
16. Accept numbers into an array of size 3 x 3. Then display the diagonals and also display the sum of numbers present in the diagonal
position.
17. Write a program to create an array of size 4 x 3 and accept number. Calculate and display the sum of each row and product of each
column.
18. Write a program to accept numbers into a 2 x 4 matrix. Then display the array sorted on each column.
19. Write a program to create a 3 x 3 Square Matrix and store numbers. The programmer wants to check whether the Matrix is
Symmetric or not. A Symmetric Matrix is a square matrix whose ith row and jth column is equal to the jth row and ith row.
20. Two matrices A and B are given as:
9 7 13 8 7 9
A = 6 12 18 B = 3 11 15
404404 Touchpad Computer Applications-X

