Page 338 - Computer science 868 Class 12
P. 338
11. A class Admission contains the admission numbers of 100 students. Some of the data members/member functions are given
below.
Class name : Admission
Data Member/Instance variable
Adno[] : integer array to store admission numbers
Member Functions/Methods
Admission() : constructor to initialise the array elements
void fillArray() : to accept the elements of the array in ascending order
int binSearch(int l, int u, int v) : to search for a particular admission number (v) using binary search and recursive
technique and returns 1 if found otherwise returns -1
Specify the class Admission giving details of the constructor, void fillArray() and int binSearch(int, int, int). Define the main()
function to create an object and call the functions accordingly to enable the task.
12. Write a program to interchange any two rows and columns in the given matrix.
13. A class Matrix contains a two-dimensional integer array of an order [m * n]. The maximum value possible for both ‘m’ and ‘n’ is 25.
Design a class Matrix to find the difference between the two matrices. The details of the members of the class are given below.
Class name : Matrix
Data Members/Instance variables
arr[][] : stores the matrix element
m : integer to store the number of rows
n : integer to store the number of columns
Member Functions
Matrix (int mm, int nn) : to initialise the size of the matrix m = mm and n = nn
void fillarray() : to enter the elements of the matrix
Matrix SubMat(Matrix A) : to subtract the current object from the matrix of the parameterised object and
return the resulting object
void display() : display the matrix elements
Specify the class Matrix giving details of the constructor(int, int), void fillarray(), Matrix SubMat (Matrix) and void display ().
Define the main () function to create objects and call the methods accordingly to enable the task.
14. Write a program to enter the alphabets in a two-dimensional array of size m x n and display the array in matrix format after
replacing all the vowels in the array with 'V’ and consonants with ‘C’.
15. Saddle point of a matrix is an element in the matrix which is the smallest in its row and the largest in its column. A matrix can have
many or no saddle points.
Example:
6 3 1
9 7 8
2 4 5
In this matrix, 7 is the saddle point. Because it is the smallest in its row (2nd row) and the largest in its column (2nd column).
Write a program to create an array of size 3 × 4 and print the saddle point in the array.
16. A class Sort contains an array of 50 integers. Some of the member functions/data members are given below.
Class name : Sort
Data Members
arr[] : integers
item : number to be searched in the array
Member Functions
void inpdata() : to input 50 integers (no duplicate number to be entered)
void bubsort() : to sort the array in ascending order using the bubblesort technique and to
display the sorted list
void binsearch() : to input an item and search for it using the binary search
void technique() : to print the item searched and its position in the sorted list if found, otherwise
print an appropriate message
Specify the class Sort giving details of the functions void inpdata(), void bubsort(), void binsearch() and void technique(). The main
function need not be written.
336336 Touchpad Computer Science-XII

