Class 11 - Computer Practical Assignments 24-25-1
Class 11 - Computer Practical Assignments 24-25-1
YEAR: 2024-25
Q16:
Define a class Mirror_matrix , to input and print the mirror of a user define matrix. The data members
and member methods are defined as follows:
Data Members:
int a[][]- to store the array int n- to store the size of the Member Methods: void input()- to input the
array
void mirror()- to find the mirror of the matrix and print it
Write the main method call the methods and print the mirror of the matrix.
Q17:
Write a program to check if a given string is an Anagram of another string. Two strings are anagrams if
they can be rearranged to form the same thing. For example, “listen” and “silent” are anagrams.
Accept two strings from the user and check if they are anagrams of each other. Ensure that the
comparison is case-sensitive and ignores spaces. Display an appropriate message based on whether they
are anagrams or not. If any of the strings contain invalid characters (e.g., numbers or special characters),
generate an error message.
Test your program with the following data and some random data:
Example 1
INPUT:
Enter first string: Listen
Enter second string: Silent
OUTPUT: STRINGS ARE ANAGRAMS
Example 2
INPUT:
Enter first string: Dormitory
Enter second string: Dirty room
OUTPUT: STRINGS ARE ANAGRAMS
Q18:
Write a program to declare a square matrix A[][] of order MxM where ‘M’ is the number of rows
and the number of columns, such that M must be greater than 2 and less than 10. Accept the value
of M as user input. Display an appropriate message for an invalid input. Allow the user to input
integers into this matrix. Perform the following tasks:
a) Display the original matrix.
b) Check if the given matrix is symmetric or not. A square matrix is said to be symmetric, if
the element in the i th row and j th column is equal to the element of the j th row and i th
column.
c) Find the sum of the elements of left diagonal and the sum of the elements of right diagonal
of the matrix and display them.
Test your program for the following data and some random data:
Example 1INPUT:
M= 3
123
245
356
OUTPUT:
ORIGINAL MATRIX
Page 6 of 8
CLASS 11 - COMPUTER PRACTICAL ASSIGNMENTS
YEAR: 2024-25
123
245
356
THE GIVEN MATRIX IS SYMMETRIC
The sum of the left diagonal = 11
The sum of the right diagonal = 10
Example 2
INPUT:
M= 4
7892
4563
8531
7642
OUTPUT:
ORIGINAL MATRIX
7892
4563
8531
7642
THE GIVEN MATRIX IS NOT SYMMETRIC
The sum of the left diagonal = 17
The sum of the right diagonal = 20
Example 3
INPUT:
M= 12
OUTPUT:
THE MATRIX SIZE IS OUT OF RANGE
Q19:
A class Rearrange has been defined to modify a word by bringing all the vowelsin the word at the
beginning followed by the consonants. Example: ORIGINAL becomes OIIARGNL Some of the members of
the class are given below:
Class name: Rearrange
Data members/instance variables:
word: to store a word.
newWord: to store the rearranged word.Member functions/methods: Rearrange(): default constructor.
void readWord(): to accept the word in uppercase.
void freqVowelCon(): finds the frequency of vowels and consonants in theword and displays them with
an appropriate message.
void arrange(): rearranges the word by bringing the vowels at the beginning followed by consonants.
void display(): displays the original word along with the rearranged word. Specify the class Rearrange,
giving details of the constructor, void readWord(),
void freqVowelCon(), void arrange() and void display(). Define the main() function
to create an object and call the functions accordingly to enable the task.
Page 7 of 8
CLASS 11 - COMPUTER PRACTICAL ASSIGNMENTS
YEAR: 2024-25
Q20:
Page 8 of 8