Category 1: Matrix manipulation
These questions require treating the 2D array as a mathematical matrix and
performing operations on it.
1. Symmetric matrix: Write a program to declare a square matrix A[]
[] of order M x M. Allow the user to input elements and check if the
matrix is symmetric. A square matrix is symmetric if its transpose is
equal to the original matrix.
2. Rotation of matrix: Write a program to rotate a square matrix by 90
degrees clockwise or counter-clockwise. Display the original and the
rotated matrix.
3. Transpose of a matrix: Write a program to create a new matrix that
is the transpose of a given M x N matrix.
4. Matrix addition: Write a program to input two matrices of the same
order and compute their sum, storing the result in a third matrix.
5. Matrix multiplication: Write a program to input two matrices and
multiply them. Ensure that the multiplication is possible by checking
the number of rows and columns.
Category 2: Element and position-based problems
These focus on the values and positions of elements within the array.
1. Saddle point: Write a program to find the "saddle point" of a matrix. A
saddle point is an element that is the maximum in its row and the
minimum in its column.
2. Maximum and minimum: Write a program to find the largest and
smallest elements in a 2D array and display them along with their row
and column indices.
3. Boundary elements: Write a program to accept a square matrix and
print only the boundary elements.
4. Diagonal elements sum: Write a program to accept a square matrix
and calculate the sum of the elements on both the primary and
secondary diagonals.
5. Sort and print: Write a program to input a square matrix and perform
the following tasks:
1. Sort the elements of each row in ascending order.
2. Sort the elements of each column in ascending order.
6. Fill and display: Write a program to declare a square matrix M[][] of
order N. Fill the four corners with one character, the rest of the
boundary with a second character, and the inner elements with a third
character.
Category 3: Pattern generation
These problems involve filling a 2D array with elements in a specific pattern.
1. Spiral matrix: Write a program to fill a square matrix in a spiral
(clockwise or anti-clockwise) fashion.
2. Mirror image: Write a program to generate and display the mirror
image of a square matrix.
3. Composite numbers: Write a program to fill a 2D array with the
first M x N composite numbers, either row-wise or column-wise.
Category 4: Class-based problems
ISC exams frequently require a solution to be implemented within a Java
class.
1. Matrix class: Design a class Matrix with a double-dimensional array
as a data member. Include methods for:
1. A constructor to initialize the matrix size.
2. read() to accept elements.
3. display() to print the matrix.
4. An overloaded add() method to add two Matrix objects.
2. Wondrous square: Design a class to check if a square matrix is a
"wondrous square." It should have methods to accept the matrix and
check if the sum of all rows, columns, and main diagonals are equal to
a specific "magic number".
3. Octal matrix: Design a class to handle a matrix where each row
represents an octal number. The class should have methods to:
1. read() to input a matrix with octal digits (0-7).
2. display() to show the matrix.
3. A method to calculate and display the decimal equivalent of each
row