0% found this document useful (0 votes)
29 views3 pages

Sample Paper 3 2025

The document presents three programming problems: the first involves counting unique-digit integers within a specified range, the second requires matrix operations including input, finding max/min values, sorting, and outputting the rearranged matrix, and the third checks if two strings are anagrams while handling case insensitivity and invalid characters. Each problem includes example inputs and outputs for clarity. The constraints for inputs and expected outputs are clearly defined.

Uploaded by

kandy20007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

Sample Paper 3 2025

The document presents three programming problems: the first involves counting unique-digit integers within a specified range, the second requires matrix operations including input, finding max/min values, sorting, and outputting the rearranged matrix, and the third checks if two strings are anagrams while handling case insensitivity and invalid characters. Each problem includes example inputs and outputs for clarity. The constraints for inputs and expected outputs are clearly defined.

Uploaded by

kandy20007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SAMPLE PAPER 3

Solve any one of the following Problems.


Question 1
A unique-digit integer is a positive integer (without leading zeros) with no duplicate digits.
For example, 7, 135, 214 are all unique-digit integers whereas 33, 3121, 300 are not.
Given two positive integers m and n, where m < n, write a program to determine how many
unique-digit integers are there in the range between m and n (both inclusive) and output them.
The input contains two positive integers m and n. Assume m < 30000 and n < 30000. You
are to output the number of unique-digit integers in the specified range along with their
values in the format specified below:
Test your program for the following data and some random data.
Example 1
INPUT: m = 100
n = 120
OUTPUT: THE UNIQUE-DIGIT INTEGERS ARE:
102, 103, 104, 105, 106, 107, 108, 109, 120
FREQUENCY OF UNIQUE-DIGIT INTEGERS IS: 9
Example 2
INPUT: m = 2505
n = 2525
OUTPUT: THE UNIQUE-DIGIT INTEGERS ARE:
2506, 2507, 2508, 2509, 2510, 2513, 2514, 2516, 2517, 2518, 2519
FREQUENCY OF UNIQUE-DIGIT INTEGERS IS: 11
Example 3
INPUT: m = 2520
n = 2529
OUTPUT: THE UNIQUE-DIGIT INTEGERS ARE: NIL
FREQUENCY OF UNIQUE-DIGIT INTEGERS IS: 0.
10
Question 2
Write a program to declare a matrix A [ ] [ ] of order (M x N) where ‘M’ is the number of
rows and ‘N’ is the number of columns such that both M and N must be greater than 2 and
less than 20. Allow the user to input integers into this matrix. Perform the following tasks on
the matrix:
Perform the following tasks on the matrix.
(a) Display the input matrix.
(b) Find the maximum and minimum value in the matrix and display them along with their
position.
(c) Sort the elements of the matrix in descending order using any standard sorting technique
and rearrange them in the matrix.
(d) Output the rearranged matrix.
Test your program for the following data and some random data:
Example 1
INPUT: M = 3
N=4
Enter elements of the matrix:
8793
-2 0 4 5
1 3 6 -4
OUTPUT: ORIGINAL MATRIX
8793
-2 0 4 5
1 3 6 -4
LARGEST NUMBER: 9
ROW = 0
COLUMN = 2
SMALLEST NUMBER: -4
ROW = 2
COLUMN = 3
REARRANGED MATRIX
-4 -2 0 1
3345
6789
11
Example 2
INPUT: M = 3
N=3
Enter elements of the matrix:
793
-2 4 5
1 16 4
OUTPUT: ORIGINAL MATRIX
793
-2 4 5
1 16 4
LARGEST NUMBER: 16
ROW = 2
COLUMN = 1
SMALLEST NUMBER: -2
ROW = 1
COLUMN = 0
REARRANGED MATRIX
-2 1 3
445
7 9 16
Example 3
INPUT: M = 3
N = 22
OUTPUT: SIZE OUT OF RANGE
12
Question 3
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 string. 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-insensitive 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
Example 3
INPUT: Enter first string: Hello
Enter second string: World
OUTPUT: STRINGS ARE NOT ANAGRAMS
Example 4
INPUT: Enter first string: Test123
Enter second string: 321tset
OUTPUT: INVALID CHARACTERS IN STRING. INVALID INPUT

You might also like