Sample Paper ISC Practical 25
Sample Paper ISC Practical 25
Question1
A number is said to be a Goldbach number, if the number can be expressed as the addition of
two odd prime number pairs. If we follow the above condition, then we can find that every
even number larger than 4 is a Goldbach number because it must have any pair of odd prime
number pairs.
Example: 6 3,3 (ONE PAIR OF ODD PRIME)
10 -3,7 and 5,5 (TWO PAIRS OF ODD PRIME )
Write a program to enter any positive EVEN natural number "N' where (1<=Nc=50) and
generate odd prime twin of'N
Test your program for the following data and some random data.
Example 1
INPUT: N= 14
Example2
INPUT: N 20
OUTPUT: ODD PRIME PAIRS ARE: 17,3
13.7
Example 3
INPUT: N= 44
12
OUTPUT: ODD PRIME PAIRS ARE: 41,3
37, 7
31, 13
Example 4
INPUT: N= 25
OUTPUT: INVALID INPUT
3
Question 2
Write a program to declare amatrix A | Uof order (M X N) where 'M' is the number of
rows and 'N' is the number of columns such that both MandN must be greater than 2 and
less thanl0. Allow the user to input integers into this matrix. Display pproprlate error
message for an invalld input.
Perform the following tasks on the matrix.
(a) Display the input matrix
(b) Shift each row one step upwards so the first row will become the last rovw 2d row will be the
1" row and so on
(c) Display the rotated matrix along with the highest element and its location in the matrix
Test your program for the following data and some random data:
Example 1
INPUT: M =3
N=4
Enter elements in the matrix:
100 90 87 7
200 500 167 998
77 567 89 254
OUTPUT: FORMED MATRIX AFTER ROTATING:
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: dozen
SHORTEST WORD: my
Example2
INPUT: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
OUTPUT: IT IS A PANGRAM
LONGEST WORD: QUICK 14
SHORTEST WORD: THE
Example 3
INPUT: Hello my World.
OUTPUT: IT IS NOT A PANGRAM
LONGEST WORD: Hello
SHORTEST WORD: my
Example 4
INPUT: Alas ! it failed #
5
SAMPLE PAPER 2
Example 1
INPUT: DAY NUMBER: 50
YEAR: 2024
N: 25
Example2
INPUT: DAY NUMBER: 321
YEAR: 2024
N: 77
Example 3
INPUT: DAY NUMBER: 400
YEAR: 2024
N: 125
Write a program to declare a square matrix A[I|of order M x M where Mis 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 intepers 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 of the i row and jh column
is equal to the element of the jh row and i 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:
Example1
INPUT: M=3
Enter elements of the matrix:
6
OUTPUT: ORIGINAL MATRIX
3
2 4 5
5 6
THE GIVEN MATRIX ISSYMMETRIC
The sum of the left diagonal 11
eright diagonal
Example 2
INPUT: M=4
Enter elements of the matrix:
9
6
3
7 6 4
Example 1
INPUT: Pack my box with five dozen liquor jugs.
OUTPUT: IT IS A PANGRAM
LONGEST WORD: dozen
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
INPUT: Alas ! it failed
ABC DEF
2 3
(SPACE)
0
For sending text / SMS the common problem is the number of keystrokes to type a particular
text.
For example, the word "STOP", there are a total of 9 keystrokes needed to type the word.
You need to press the key 7 four times,, the key 8 once, the key 6 three times and the key 7
once to get it.
Develop a program code to find the number of keystrokes needed to type the text.
For this problem, accept just one word without any punctuation marks, numbers or white
spaces and the text message would consist of just 1 word.
Test your data with the sample data and some random data :
Example 1:
INPUT: DEAR
Example 3:
INPUT: Good-Bye
OUTPUT: INVALID ENTRY
SAMPLE PAPER 3
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 mand n, where mn<n, write a program to determine how many
unique-digit integers are there in the range between mand n (both inclusive) and output them.
The input contains two positive integers mand 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= 1O0
n= 120
Example2
INPUT: m- 2505
n 2525
OUTPUT: THE UNIQUE-DIGIT INTEGERS ARE:
2506, 2507, 2508, 2509, 2510. 2513, 2514, 25I6, 2517, 2518, 2519
Example 3
INPUT: m = 2520
n= 2529
(c) Sort the elements of the matrix in descending order using any standard sorting technique
and rearrange them in the matrix.
7 9 3
2 4
3 6 4
LARGEST NUMBER:
ROW =0
cOLUMN=2
SMALLEST NUMBER: -4
ROW = 2
COLUMN= 3
REARRANGED MATRIX
4 -2 0
3 4
6 8
Example 2
INPUT: M=3
N=3
Enter elements of the matrix:
3
-2 4
T6
9 3
-2 4 5
16 4
LARGEST NUMBER: 16
ROW =2
COLUMN = 1
SMALLEST NUMBER: -2
ROW =1
COLUMN =0
REARRANGED MATRIX
-2 3
A 5
7 9 16
Example 3
INPUT: M=3
N= 22
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
INPUT: Enter first string: Listen
Example 2
Example3
Example 4
INPUT: Enter first string: Test123
Enter second string: 321tset
OUTPUT: INVALID CHARACTERS IN STRING. INVALID INPUT
12