In Assignment for ISC Computer Science 2026
Q1.Array union intersection by object passing.
Class UnIn{
int x[]; Int cap;
UnIn(int c)//constructor to initialize cap with c
void input() //to accept integer elements in the array
void display() //to display array elements
UnIn intersect(UnIn obj) // return resultant object after finding common elements of array of obj
and current object
Unin Union(UnIn obj) //return restaurant object after finding out union of array of obj and current
object.
Void main() to invoke above function after creating object and to enable the task
Q2. Accept names of M and N number of employees of two departments .Consider in
each department names of employees are unique. Finally merge the names of these two
departments in sorted fashion (not merging then sorting)
Class name : Combine
Data members:
String Dep[]
Int cap
Combine(int x) to initialize cap with x accordingly dep[]
void input() : Accept names int Dep[] with unique names
void display(): Display the content of Dep[]
void sort(): sort the names in alphabetical order
Combine mixdept(Combine obx) // combine the content of Dep of obx and content of Dep
of current object following the merge sort technique and finally return the object in
combine form
Also define void main() to create object and invoke above functions to enable the task
Q3. Implement matrix multiplication with object passing concept.
Class Mat
{
Int x[][];
Int r;
Int c;
Mat(int rr,int cc) // constructor to initialize the r with rr and c with cc
void input()// Accept integer elements in the matrix
void display()// to display the content of the matrix
Mat multiplicationprocess(int Y[][]) //return the resultant product matrix after checking
multiplication criteria between x[][] and the current object and return the resultant
object
Also define void main() to create an object and invoke above functions to enable the task.
Q4..(recursion)
Given an array arr[] of n elements, write a function to recursively search a
given element x in arr[].
Illustration:
Input : arr[] = {25, 60, 18, 3, 10}
Output : Element to be searched : 3
Input : arr[] = {10,20,30,24,15,40}
Output : -1
For x = 35
Element x is not present in arr[]
Procedure:
The idea is to search the element from both sides of the array recursively. If
the element that needs to be searched matches with the leftmost element of
the left boundary, or it matches with the rightmost element of the right
boundary, directly return the position of the element, else recur for the
remaining array to search for the element with the value same as x. (note this is
not not binary search)
Q5. (Generalised)
Twins primes are consecutive prime numbers whose difference is 2. For example, (3,5), (11,13),
(17,19) are all twin primes. We define the distance of any twin prime pair from a positive integer
as follows. If (p1, p2) is a twin prime pair and n is a positive integer then the distance of the twin
prime from n is: minimum(abs(n-p1), abs(n-p2)) where abs returns the absolute value of its
argument, and minimum returns the smaller of its two arguments. Write a program that reads in
a positive integer n and prints out the twin prime pair that has the least distance from n. For
example if n is 30 the pair is (29,31), if n is 13 it is (11,13), if n is 49 it is (41,43). If n is 54 it is
(59,61).
Sample data: Input: Give the number : 34
Output: Number read in is : 34
Pl=29 p2=31
Inp
ut: Give the number : 60
Output: Number read in is 60 Pl=59 p2=61
Q6.(Generalized)
In this problem you need to determine the largest alphabetized substring. Given a string
of characters, determine which contiguous group of characters has the largest number
of characters that are in ascending alphabetical order. For example, given the string
“adfjabcghl” the largest substring in alphabetical order is abcghl.
Every string will have at least one alphabetized substring. Display the first substring if
the string has more than one substring of the same length.
Input
Prompt for and read a list of lower-case letters. No spaces, numbers, or special
characters will be entered. There will always be at least one character entered. There is
no upper limit to how many characters can be entered. Read the data from the console.
Display the output on the monitor. See the sample output below.
Input Output
Enter a string Longest substring in alphabetical order is
adfjabcghl abcghl
Enter a string Longest substring in alphabetical order is dghm
dghmbkaluc
Enter a string Longest substring in alphabetical order is dgsuz
kldcfazdgsuzgkqc
Enter a string Longest substring in alphabetical order is
egikmoq egikmoq
Enter a string Longest substring in alphabetical order is g
g
Enter a string Longest substring in alphabetical order is f
fc
Q7.Inheritance
A class D2Point defines the coordinates of a point in a plane while another class D3Point
defines the coordinates of a point in space.The details of both the classes are given
below:-
Class name D2Point
Data members double x,y to store x and y coordinates
Functions/Methods
D2Point(double nx,double Constructor to assign nx to x and ny to y
ny)
double distance2d(D2Point To return the distance between the point b and the current
b) point in a plane
Class name D3Point
Data members Double z to store z coordinate
Functions/Methods
D3Point(double nz) Constructor to assign nz to z
double distance3d(D3Point To return the distance between the point b and the current
b) point in space
Define all the functions mentioned above along with void main() to execute above functions
after creating an object of the inherited class.
Q8.
.A super class record has been defined to store the names and ranks of 10 students.
Define a sub class Rank to find the highest rank along with the name. The details of two
classes are given below:
Class name Record
Data members
name[] To store the names of the students
mk[] Stores the rank of the students
Member
functions/methods
Record() Constructor to initialize the data members
void readvalues() To stores names and ranks of 10 students
void display() Displays the names and the corresponding ranks
Class name Rank
index integer to store the index of the topmost rank
Member methods
Rank() Constructor to invoke base class constructor and initialize index=0
void highest() Find the index/location/subscript of the topmost rank
void display() Displays the names and ranks along with the names having the topmost rank.
Using the concept of inheritance specify both the classes and using void main() execute
the functions mentioned.
Q9(Inheritance)
A class Iscscores defines the scores of a candidate in six subjects and another class defines the
best four subjects.
The details of both the classes are given below:
Class name IScscores
Data members /Instance variable
int number[6][2[ To contain marks for six subjects and subject
code[numeric]
Member functions
Iscscores() Default constructor to accept the marks
int point() To return the point in each subject according to
the following:
Marks>=90- 1 point
80-89 - 2 point
70-79 - 3 point
60-69 4 point
50-59 5 point
40- 49- 6 point
Class name Bestfour
void Besrsubjects() To display the total points ad best four subjects
code using the concept of inheritance
Specify both the classes along with void main() to implement the required job.
Q10. (generalized /stack)
In this problem you will be given a word over the alphabet {a,b,...,z, A, B, ...,Z}. We will treat the
capital letters {A,B,...,Z} as brackets;. These twenty-sixletters form thirteen types of bracket
pairs, (A,Z), (B,Y), ...(M,N). In each pair, the first
element represents an opening bracket of that type and the second element is the closing
bracket of that type. For example, a B opens a bracket which is closed by Y.
A well bracketed expression is one in which brackets are opened and closed consistently. In
other words, all opening and closing brackets in the expression can be paired up such that
every opening bracket has a matching closing bracket to its right. Moreover, if an opening
bracket occurs between a matching pair of brackets, then its matching closing bracket also
occurs within the same pair of brackets.
For example AabcZBBefYeY is a well bracketed expression. On the other hand AabcBZY is not
well-bracketed, because the (B,Y) bracket opens inside the (A,Z) bracket, but closes outside.
Similarly, AabcZZA is not well-bracketed as the second Z has no matching opening bracket to
its left and the second A has no matching closing bracket to its right.
The lowercase letters {a,b,...,z} do not represent brackets and may appear anywhere in the
input. Your task is to determine whether the given input string is well-bracketed.
Q11.Write a menu driven program to convert a number using recursive
functions(class XI 2nd term assignment)
1. Decimal to any base
2. Any base to decimal
Then
3. From Any base to base using the above two functions.
Q12.From guided computer science pg 400-q191 (class xi 2nd
term assignment)
Q12. Ceaser cypher is a technique which is implemented as ROT13(rotate by 13).It is a simple
letter substitution cipher that replaces a letter with the letter 13 places after it in the
alphabet,with the other character remains unchanged.
ROT13
A/a B/b C/c D/d E/e F/f G/g H/h I/i J/j K/k L/l M/m
↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕
N/n O/o P/p Q/q R/r S/s T/t U/u V/v W/w X/x Y/y Z/z
Write a program to accept a plain text of length L where L must be greater than 3 and less than
100.
Encrypt the text if valid as per the Ceaser Cipher.
Test your program with the sample data and some random data
Input: Hello! How are you?
Output: The cipher text is:
Uryyb? Ubj ner lbh?
Input:Encryption helps to secure data.
Rapelcgvba Urycf gb frpher qnqn.
Input : You
Output: INVALID LENGTH
Q13.(Generalised)
Write a program to accept a sentence which may be terminated by either ‘.’ ,‘?’or ‘!’ only. The
words may be separated by a single blank space and should be case-insensitive. Perform the
following tasks:
(a) Determine if the accepted sentence is a Pangram or not.
[A Pangram is a sentence that contains every letter of the alphabet at least once.]
Example: "The quick brown fox jumps over the lazy dog"
(b) Display the first occurring longest and shortest word in the accepted sentence.
Test your program for the following data and some random data:
Example 1
INPUT: Pack my box with five dozen liquor jugs.
OUTPUT: IT IS A PANGRAM
LONGEST WORD: liquor
SHORTEST WORD: my
Example 2
INPUT: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
OUTPUT: IT IS A PANGRAM
LONGEST WORD: QUICK
SHORTEST WORD:
THE
Example 3
INPUT: Hello my World.
OUTPUT: IT IS NOT A PANGRAM
LONGEST WORD: Hello
SHORTEST WORD:
my
Example 4
OUTPUT: INPUT: Alas ! it failed #
OUTPUT:
INVALID INPUT
Q14. Generalized
In number theory, a vampire number (or true vampire number) is a composite natural number
with an even number of digits, that can be factored into two natural numbers each with half as
many digits as the original number and not both with trailing zeroes, where the two factors
contain precisely all the digits of the factors.
as example 1395=15X93 1260=21 x60
Other few example of vampire number:
1530, 1827, 2187, 6880, 102510, 104260, 105210
Q15.
Given a 2d array mat[][] of order n * n, and an integer k. Your task is to find a
submatrix of order k * k, such that sum of all the elements in the submatrix is
maximum possible.
Note: Matrix mat[][] contains zero, positive and negative integers.
Examples:
Input: k = 3
mat[][] = [ [ 1, 2, -1, 4 ]
[ -8, -3, 4, 2 ]
[ 3, 8, 10, -8 ]
[ -4, -1, 1, 7 ] ]
Output: 20
Explanation: The submatrix enclosed in blue boundary is the maximum sum
submatrix of order 3 * 3.
Input: k = 3
mat[][] = [ [ 1, 1, 1, 1, 1 ]
[ 2, 2, 2, 2, 2 ]
[ 3, 8, 6, 7, 3 ]
[ 4, 4, 4, 4, 4 ]
[ 5, 5, 5, 5, 5 ] ]
Output: 48
Explanation: The following submatrix of order k * k has sum 48, which is
maximum possible:
[ [ 8, 6, 7 ]
[ 4, 4, 4 ]
[ 5, 5, 5 ] ]
Input: k = 1
mat[][] = [ [ 4 ] ]
Output: 4
Explanation: The given matrix contains only a single element, thus the max
possible sum is 4.
Q16.Friday 13th is marked for whatever reason....
Accept a year and the Ist day of the year to find out how many Friday 13th there are in that
year.
If there is no Friday 13th display proper message.
Also find out the number of 13 th for each weekday.
As example
Input year:2022
Ist day of the year:Saturday
May is having Friday 13th
13 th on other days
Sunday : 5
Monday : 0
Tuesday 2
Wednesday 1
Thursday 2
Friday 1
Saturday 1
Q17(Generalized)
Generate a magic square. Accept order of matrix as odd integer. Numbers should be from 1.
Starting position is 1st row, n/2 column.
Sum of elements of each row, column and diagonal=n(n*n+1)/2.
* Example:
n=3, sum=15
816
357
492
Q18(on queue)
Given an integer k and a queue of integers, The task is to reverse the order of
the first k elements of the queue, leaving the other elements in the same
relative order.
Only following standard operations are allowed on the queue.
● enqueue(x): Add an item x to rear of queue
● dequeue(): Remove an item from the front of the queue
● size(): Returns the number of elements in the queue.
● front(): Finds front item.
Example:
Input: q = 1 2 3 4 5, k = 3
Output: 3 2 1 4 5
Explanation: After reversing the first 3 elements from the given queue the
resultant queue will be 3 2 1 4 5.
Input: q = 4 3 2 1, k= 4
Output: 1 2 3 4
Explanation: After reversing the first 4 elements from the given queue the
resultant queue will be 1 2 3 4.
Q19..Implement the concept of circular queue for N number of names.
20. luy