# ISC Practical Questions

## Share this page with your friends

## Question 1

A Prime-Adam integer is a positive integer (without leading zeroes) which is a prime as well as an Adam number.

Prime number: A number which has only two factors, i.e. 1 and the number itself. Example: 2, 3, 5, 7, etc.

Adam number: The square of a number and the square of its reverse are reverse to each other. Example: If n = 13 and reverse of ‘n’ is 31, then, 132 = 169, and 312 = 961 which is reverse of 169. Thus, 13 is an Adam number.

Accept two positive integers m and n, where m is less than n as user input. Display all Prime-Adam integers that are in the range between m and n (both inclusive) and output them along with the frequency, in the format given below:

` ````
```Test your program with the following data and some random data:
Example 1:
INPUT:
m = 5
n = 100
OUTPUT:
The Prime-Adam integers are:
11, 13, 31
Frequency of Prime-Adam integers is: 3
Example 2:
INPUT:
m = 100
n = 200
OUTPUT:
The Prime-Adam integers are:
101, 103, 113
Frequency of Prime-Adam integers is: 3
Example 3:
INPUT:
m = 50
n = 70
OUTPUT:
The Prime-Adam integers are:
NIL
Frequency of Prime-Adam integers is: 0
Example 4:
INPUT:
m = 700
n = 450
OUTPUT:
Invalid Input.

## Question 2

Write a program to declare a matrix a[][] of order (M × N) where ‘M’ is the number of rows and ‘N’ is the number of columns such that the value of ‘M’ must be greater than 0 and less than 10 and the value of ‘N’ must be greater than 2 and less than 6. Allow the user to input digits (0 – 7) only at each location, such that each row represents an octal number.

Example:

2 3 1 (decimal equivalent of 1st row = 153 i.e. 2 × 82 + 3 × 81 + 1 × 80)

4 0 5 (decimal equivalent of 2nd row = 261 i.e. 4 × 82 + 0 × 81 + 5 × 80)

1 5 6 (decimal equivalent of 3rd row = 110 i.e. 1 × 82 + 5 × 81 + 6 × 80)

Perform the following tasks on the matrix:

a) Display the original matrix.

b) Calculate the decimal equivalent for each row and display as per the format given below.

` ````
```Test your program for the following data and some random data:
Example 1:
INPUT:
M = 1
N = 3
Enter elements for row 1: 1 4 4
OUTPUT:
Filled Matrix:
1 4 4
Decimal Equivalent:
100
Example 2:
INPUT:
M = 3
N = 4
Enter elements for row 1: 1 1 3 7
Enter elements for row 2: 2 1 0 6
Enter elements for row 3: 0 2 4 5
OUTPUT:
Filled Matrix:
1 1 3 7
2 1 0 6
0 2 4 5
Decimal Equivalent:
607
1094
165
Example 3:
INPUT:
M = 3
N = 3
Enter elements for row 1: 2 4 8
OUTPUT:
Invalid Input.
Example 4:
INPUT:
M = 4
N = 6
OUTPUT:
Out of range.

## Question 3

Write a program to accept a sentence which may be terminated by either ‘.’, ‘?’ or ‘!’ only. The words are to be separated by a single blank space and are in uppercase.

Perform the following tasks:

a) Check for the validity of the accepted sentence only for the terminating character.

b) Arrange the words in ascending order of their length. If two or more words have the same length, then sort them alphabetically.

c) Display the original sentence along with the converted sentence.

` ````
```Test your program for the following data and some random data:
Example 1:
INPUT:
AS YOU SOW SO SHALL YOU REAP.
OUTPUT:
AS YOU SOW SO SHALL YOU REAP.
AS SO SOW YOU YOU REAP SHALL
Example 2:
INPUT:
SELF HELP IS THE BEST HELP.
OUTPUT:
SELF HELP IS THE BEST HELP.
IS THE BEST HELP HELP SELF.
Example 3:
INPUT:
BE KIND TO OTHERS.
OUTPUT:
BE KIND TO OTHERS.
BE TO KIND OTHERS
Example 4:
INPUT:
NOTHING IS IMPOSSIBLE#
OUTPUT:
INVALID INPUT

## Question 1

Design a program to accept a day number (between 1 and 366), year (in 4 digits) from the user to generate and display the corresponding date. Also, accept N (1 <= N <= 100) from the user to compute and display the future date corresponding to ‘N’ days after the generated date. Display an error message if the value of the day number, year and N are not within the limit or not according to the condition specified.

` ````
```Test your program with the following data and some random data:
Example 1:
INPUT:
DAY NUMBER: 255
YEAR: 2018
DATE AFTER (N DAYS): 22
OUTPUT:
DATE: 12TH SEPTEMBER, 2018
DATE AFTER 22 DAYS: 4TH OCTOBER, 2018
Example 2:
INPUT:
DAY NUMBER: 360
YEAR: 2018
DATE AFTER (N DAYS): 45
OUTPUT:
DATE: 26TH DECEMBER, 2018
DATE AFTER 45 DAYS: 9TH FEBRUARY, 2019
Example 3:
INPUT:
DAY NUMBER: 500
YEAR: 2018
DATE AFTER (N DAYS): 33
OUTPUT:
DAY NUMBER OUT OF RANGE
Example 4:
INPUT:
DAY NUMBER: 150
YEAR: 2018
DATE AFTER (N DAYS): 330
OUTPUT:
DATE AFTER (N DAYS) OUT OF RANGE

## Question 2

Write a program to declare a single-dimensional array a[] and a square matrix b[][] of size N, where N > 2 and N < 10. Allow the user to input positive integers into the single dimensional array.

Perform the following tasks on the matrix:

a) Sort the elements of the single-dimensional array in ascending order using any standard sorting technique and display the sorted elements.

b) Fill the square matrix b[][] in the following format.

If the array a[] = {5, 2, 8, 1} then, after sorting a[] = {1, 2, 5, 8}

Then, the matrix b[][] would fill as below:

` ````
```1 2 5 8
1 2 5 1
1 2 1 2
1 1 2 5

c) Display the filled matrix in the above format.

` ````
```Test your program for the following data and some random data:
Example 1:
INPUT:
N = 3
ENTER ELEMENTS OF SINGLE DIMENSIONAL ARRAY: 3 1 7
OUTPUT:
SORTED ARRAY: 1 3 7
FILLED MATRIX
1 3 7
1 3 1
1 1 3
Example 2:
INPUT:
N = 13
OUTPUT:
MATRIX SIZE OUT OF RANGE
Example 3:
INPUT:
N = 5
ENTER ELEMENTS OF SINGLE DIMENSIONAL ARRAY:10 2 5 23 6
OUTPUT:
SORTED ARRAY:2 5 6 10 23
FILLED MATRIX
2 5 6 10 23
2 5 6 10 2
2 5 6 2 5
2 5 2 5 6
2 2 5 6 10

## Question 3

Write a program to accept a sentence which may be terminated by either ‘.’, ‘?’ or ‘!’ only. The words are to be separated by a single blank space and are in uppercase.

Perform the following tasks:

a) Check for the validity of the accepted sentence.

b) Convert the non-palindrome words of the sentence into palindrome words by concatenating the word by its reverse (excluding the last character).

Example: The reverse of the word HELP would be LEH (omitting the last alphabet) and by concatenating both, the new palindrome word is HELPLEH. Thus, the word HELP becomes HELPLEH.

Note: The words which end with repeated alphabets, for example ABB would become ABBA and not ABBBA and XAZZZ becomes XAZZZAX.

[Palindrome word: Spells same from either side. Example: DAD, MADAM etc.]

c) Display the original sentence along with the converted sentence.

Test your program for the following data and some random data:

` ````
```Example 1:
INPUT: THE BIRD IS FLYING.
OUTPUT:
THE BIRD IS FLYING.
THEHT BIRDRIB ISI FLYINGNIYLF
Example 2:
INPUT: IS THE WATER LEVEL RISING?
OUTPUT:
IS THE WATER LEVEL RISING?
ISI THEHT WATERETAW LEVEL RISINGNISIR
Example 3:
INPUT: THIS MOBILE APP LOOKS FINE.
OUTPUT:
THIS MOBILE APP LOOKS FINE.
THISIHT MOBILELIBOM APPA LOOKSKOOL FINENIF
Example 4:
INPUT: YOU MUST BE CRAZY#
OUTPUT:
INVALID INPUT

## Question 1

A Goldbach number is a positive even integer that can be expressed as the sum of two odd primes.

Note: All even integer numbers greater than 4 are Goldbach numbers.

Example:

6 = 3 + 3

10 = 3 + 7

10 = 5 + 5

Hence, 6 has one odd prime pair 3 and 3. Similarly, 10 has two odd prime pairs, i.e. 3, 7 and 5, 5.

Write a program to accept an even integer ‘N’ where N > 9 and N < 50. Find all the odd prime pairs whose sum is equal to the number ‘N’.

` ````
```Test your program with the following data and some random data:
Example 1:
INPUT:
N = 14
OUTPUT:
Prime pairs are:
3, 11
7, 7
Example 2:
INPUT:
N = 30
OUTPUT:
Prime numbers are:
7, 23
11, 19
13, 17
Example 3:
INPUT:
N = 17
OUTPUT:
Invalid input. Number is odd.
Example 4:
INPUT:
N = 126
OUTPUT:
Invalid input. Number is out of range.

## Question 2

Write a program to declare a matrix a[][] of order (m × n) where ‘m’ is the number of rows and ‘n’ is the number of columns such that the values of both ‘m’ and ‘n’ must be greater than 2 and less than 10. Allow the user to input integers into this matrix. Perform the following tasks on the matrix:

Display the original matrix.

Sort each row of the matrix in ascending order using any standard sorting technique.

Display the changed matrix after sorting each row.

` ````
```Test your program for the following data and some random data:
Example 1:
INPUT:
m = 4
n = 3
Enter elements of matrix:
11 -2 3
5 16 7
9 0 4
3 1 8
OUTPUT:
ORIGINAL MATRIX:
11 -2 3
5 16 7
9 0 4
3 1 8
MATRIX AFTER SORTING:
-2 3 11
5 7 16
0 4 9
1 3 8
Example 2:
INPUT:
m = 3
n = 3
Enter elements of matrix:
22 5 19
7 36 12
9 13 6
OUTPUT:
ORIGINAL MATRIX:
22 5 19
7 36 12
9 13 6
MATRIX AFTER SORTING:
5 19 22
7 12 36
6 9 13
INPUT:
m = 11
n = 5
OUTPUT:
Matrix size out of range.

## Question 3

The names of the teams participating in a competition should be displayed on a banner vertically, to accommodate as many teams as possible in a single banner.

Design a program to accept the names of N teams, where 2 < N < 9 and display them in vertical order, side by side with a horizontal tab (i.e. eight spaces).

` ````
```Test your program for the following data and some random data:
Example 1:
INPUT:
N = 3
Team 1: Emus
Team 2: Road Rols
Team 3: Coyote
OUTPUT:
E R C
m o o
u a y
s d o
t
R e
o
l
s
Example 2:
INPUT:
N = 4
Team 1: Royal
Team 2: Mars
Team 3: De Rose
Team 4: Kings
OUTPUT:
R M D K
o a e i
y r n
a s R g
l o s
s
e
Example 3:
INPUT:
N = 10
OUTPUT:
Invalid input.

## Question 1

A company manufactures packing cartons in four sizes, i.e. cartons to accommodate 6 boxes, 12 boxes, 24 boxes and 48 boxes. Design a program to accept the number of boxes to be packed (N) by the user (maximum up to 1000 boxes) and display the break-up of the cartons used in descending order of capacity (i.e. preference should be given to the highest capacity available, and if boxes left are less than 6, an extra carton of capacity 6 should be used.)

` ````
```Test your program with the following data and some random data:
Example 1:
INPUT:
N = 726
OUTPUT:
48 * 15 = 720
6 * 1 = 6
Remaining boxes = 0
Total number of boxes = 726
Total number of cartons = 16
Example 2:
INPUT:
N = 140
OUTPUT:
48 * 2 = 96
24 * 1 = 24
12 * 1 = 12
6 * 1 = 6
Remaining boxes = 2 * 1 = 2
Total number of boxes = 140
Total number of cartons = 6
Example 3:
INPUT:
N = 4296
OUTPUT:
INVALID INPUT

## Question 2

The result of a quiz competition is to be prepared as follows:

The quiz has five questions with four multiple choices (A, B, C, D), with each question carrying 1 mark for the correct answer. Design a program to accept the number of participants N such that N must be greater than 3 and less than 11.

Create a double-dimensional array of size (N * 5) to store the answers of each participant row-wise. Calculate the marks for each participant by matching the correct answer stored in a single-dimensional array of size 5. Display the scores for each participant and also the participants(s) having the highest score.

` ````
```Example: If the value of N = 4, then the array would be:
Q1 Q2 Q3 Q4 Q5
Participant 1 A B B C A
Participant 2 D A D C B
Participant 3 A A B A C
Participant 4 D C C A B
Key to the question: D C C A B

` ````
```Note: Array entries are line fed (i.e. one entry per line)
Test your program for the following data and some random data.
Example 1:
INPUT:
N = 5
Participant 1 D A B C C
Participant 2 A A D C B
Participant 3 B A C D B
Participant 4 D A D C B
Participant 5 B C A D D
Key: B C D A A
OUTPUT:
Scores:
Participant 1 = 0
Participant 2 = 1
Participant 3 = 1
Participant 4 = 1
Participant 5 = 2
Highest Score: Participant 5
Example 2:
INPUT:
N = 4
Participant 1 A C C B D
Participant 2 B C A A C
Participant 3 B C B A A
Participant 4 C C D D B
Key: A C D B B
OUTPUT:
Scores:
Participant 1 = 3
Participant 2 = 1
Participant 3 = 1
Participant 4 = 3
Highest score:
Participant 1
Participant 4
Example 3:
INPUT:
N = 12
OUTPUT:
INPUT SIZE OUT OF RANGE.

## Question 3

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 Caesar Cipher.

` ````
```Test your program with the sample data and some random data.
Example 1:
INPUT:
Hello! How are you?
OUTPUT:
The cipher text is:
Uryyb! Ubj ner lbh?
Example 2:
INPUT:
Encryption helps to secure data.
OUTPUT:
The cipher text is:
Rapelcgvba urycf gb frpher qngn.
Example 3:
INPUT:
You
OUTPUT:
INVALID LENGTH
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

## Question 1

A Circular Prime is a prime number that remains prime under cyclic shifts of its digits. When the leftmost digit is removed and replaced at the end of the remaining string of digits, the generated number is still prime. The process is repeated until the original number is reached again.

A number is said to be prime if it has only two factors 1 and itself.

` ````
```Example:
131
311
113
Hence, 131 is a circular prime.

Accept a positive number N and check whether it is a circular prime or not. The new numbers formed after the shifting of the digits should also be displayed.A number is said to be prime if it has only two factors 1 and itself.

` ````
```Test your program with the following data and some random data:
Example 1:
INPUT:
N = 197
OUTPUT:
197
971
719
197 IS A CIRCULAR PRIME.
Example 2:
INPUT:
N = 1193
OUTPUT:
1193
1931
9311
3119
1193 IS A CIRCULAR PRIME.
Example 3:
INPUT:
N = 29
OUTPUT:
29
92
29 IS NOT A CIRCULAR PRIME.

## Question 2

Write a program to declare a square matrix a[][] of order (M × M) where ‘M’ must be greater than 3 and less than 10. Allow the user to input positive integers into this matrix. Perform the following tasks on the matrix:

a) Sort the non-boundary elements in ascending order using any standard sorting technique and rearrange them in the matrix.

b) Calculate the sum of both the diagonals.

c) Display the original matrix, rearranged matrix and only the diagonal elements of the rearranged matrix with their sum.

` ````
```Test your program for the following data and some random data:
Example 1:
INPUT: M = 4
9 2 1 5
8 13 8 4
15 6 3 11
7 12 23 8
OUTPUT:
ORIGINAL MATRIX
9 2 1 5
8 13 8 4
15 6 3 11
7 12 23 8
REARRANGED MATRIX
9 2 1 5
8 3 6 4
15 8 13 11
7 12 23 8
DIAGONAL ELEMENTS
9 5
3 6
8 13
7 8
SUM OF THE DIAGONAL ELEMENTS = 59
Example 2:
INPUT: M = 5
7 4 1 9 5
8 2 6 10 19
13 1 3 5 1
10 0 5 12 16
1 8 17 6 8
OUTPUT:
ORIGINAL MATRIX
7 4 1 9 5
8 2 6 10 19
13 1 3 5 1
10 0 5 12 16
1 8 17 6 8
REARRANGED MATRIX
7 4 1 9 5
8 0 1 2 19
13 3 5 5 1
10 6 10 12 16
1 8 17 6 8
DIAGONAL ELEMENTS
7 5
0 2
5
6 12
1 8
SUM OF THE DIAGONAL ELEMENTS = 46
Example 3:
INPUT: M = 3
OUTPUT: THE MATRIX SIZE IS OUT OF RANGE.

## Question 3

Write a program to accept a sentence which may be terminated by either ‘.’, ‘?’ or ‘!’ only. The words may be separated by more than one blank space and are in uppercase.

Perform the following tasks:

Find the number of words beginning and ending with a vowel.

Place the words which begin and end with a vowel at the beginning, followed by the remaining words as they occur in the sentence.

` ````
```Test your program with the sample data and some random data:
Example 1:
INPUT:ANAMIKA AND SUSAN ARE NEVER GOING TO QUARREL ANYMORE.
OUTPUT:NUMBER OF WORDS BEGINNING AND ENDING WITH A VOWEL = 3
ANAMIKA ARE ANYMORE AND SUSAN NEVER GOING TO QUARREL
Example 2:
INPUT:YOU MUST AIM TO BE A BETTER PERSON TOMORROW THAN YOU ARE TODAY.
OUTPUT:NUMBER OF WORDS BEGINNING AND ENDING WITH A VOWEL = 2
A ARE YOU MUST AIM TO BE BETTER PERSON TOMORROW THAN YOU TODAY
Example 3:
INPUT:LOOK BEFORE YOU LEAP.
OUTPUT:NUMBER OF WORDS BEGINNING AND ENDING WITH A VOWEL = 0
LOOK BEFORE YOU LEAP
Example 4:
INPUT:HOW ARE YOU@
OUTPUT:INVALID INPUT

## Question 1

Given two positive numbers M and N, such that M is between 100 and 10000 and N is less than 100. Find the smallest integer that is greater than M and whose digits add up to N. For example, if M = 100 and N = 11, then the smallest integer greater than 100 whose digits add up to 11 is 119.

Write a program to accept the numbers M and N from the user and print the smallest required number whose sum of all its digits is equal to N. Also, print the total number of digits present in the required number. The program should check for the validity of the inputs and display an appropriate message for an invalid input.

` ````
```Test your program with the sample data and some random data:
Example 1:
INPUT:
M = 100
N = 11
OUTPUT:
The required number = 119
Total number of digits = 3
Example 2:
INPUT:
M = 1500
N = 25
OUTPUT:
The required number = 1699
Total number of digits = 4
Example 3:
INPUT:
M = 99
N = 11
OUTPUT:
INVALID INPUT
Example 4:
INPUT:
M = 112
N = 130
OUTPUT:
INVALID INPUT

## Question 2

Write a program to declare a square matrix a[][] of order M × M 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) Rotate the matrix 90o clockwise as shown below:

` ````
```Original matrix Rotated matrix
1 2 3 7 4 1
4 5 6 8 5 2
7 8 9 9 6 3

# (c) Find the sum of the elements of the four corners of the matrix.

` ````
```Test your program for the following data and some random data:
Example 1:
INPUT:
M = 3
3 4 9
2 5 8
1 6 7
OUTPUT:
ORIGINAL MATRIX
3 4 9
2 5 8
1 6 7
MATRIX AFTER ROTATION
1 2 3
6 5 4
7 8 9
Sum of the corner elements = 20
Example 2:
INPUT:
M = 4
OUTPUT:
ORIGINAL MATRIX
1 2 4 9
2 5 8 3
1 6 7 4
3 7 6 5
MATRIX AFTER ROTATION
3 1 2 1
7 6 5 2
6 7 8 4
5 4 3 9
Sum of the corner elements = 18
Example 3:
INPUT:
M = 14
OUTPUT:
SIZE OUT OF RANGE

## Question 3

Write a program to accept a sentence which may be terminated by either ‘.’ or ‘?’ only. The words are to be separated by a single blank space. Print an error message if the input does not terminate with ‘.’ or ‘?’. You can assume that no word in the sentence exceeds 15 characters, so that you get a proper formatted output.

Perform the following tasks:

(i) Convert the first letter of each word to uppercase.

(ii) Find the number of vowels and consonants in each word and display them with proper headings along with the words.

Test your program with the following inputs:

` ````
```Example 1:
INPUT: Intelligence plus character is education.
OUTPUT:
Intelligence Plus Character Is Education.
Word Vowels Consonants
Intelligence 5 7
Plus 1 3
Character 3 6
Is 1 1
Education 5 4
Example 2:
INPUT: God is great.
OUTPUT:
God is great.
Word Vowels Consonants
God 1 2
Is 1 1
Great 2 3
Example 3:
INPUT: All the best!
OUTPUT:
Invalid input.

## Question 1

A composite magic number is a positive integer which is composite as well as a magic number.

Composite number: A composite number is a number that has more than two factors.

For example: 10

Factors are: 1, 2, 5, 10.

Magic number: A magic number is a number in which the eventual sum of the digits is equal to 1.

For example: 28

2 + 8 = 10.

1 + 0 = 1.

Accept two positive integers ‘m’ and ‘n’, where m is less than n as user input. Display the number of composite magic integers that are in the range between ‘m’ and ‘n’ (both inclusive) and output them along with the frequency, in the format specified below.

` ````
```Test your program with the sample data and some random data:
Example 1:
INPUT:
m = 10
n = 100
OUTPUT:
THE COMPOSITE MAGIC INTEGERS ARE:
10, 28, 46, 55, 64, 82, 91, 100
FREQUENCY OF COMPOSITE MAGIC INTEGERS IS: 8
Example 2:
INPUT:
m = 1200
n = 1300
OUTPUT:
THE COMPOSITE MAGIC INTEGERS ARE:
1207, 1216, 1225, 1234, 1243, 1252, 1261, 1270, 1288
FREQUENCY OF COMPOSITE MAGIC INTEGERS IS: 9
Example 3:
INPUT:
m = 120
n = 99
OUTPUT:
INVALID INPUT

## Question 2

Write a program to declare a square matrix a[][] of order M× M, where M is a positive integer and represents rows and columns for the matrix. M should be greater than 2 and less than 10. Accept the value of M from the user. Display an appropriate message for an invalid input.

Perform the following tasks:

Display the original matrix.

Check if the given matrix is symmetric or not. If each element in the ith row and jth column is same as element of jth row and ith column, then the matrix is symmetric.

Find the sum of the left and right diagonals of the matrix and display them

` ````
```Example 1:
INPUT:
M = 3
1 2 3
2 4 5
3 5 6
OUTPUT:
1 2 3
2 4 5
3 5 6
The given matrix is symmetric.
Sum of the left diagonal = 11
Sum of the right diagonal = 10
Example 2:
INPUT:
M = 4
7 8 9 2
4 5 6 3
8 5 3 1
7 6 4 2
OUTPUT:
7 8 9 2
4 5 6 3
8 5 3 1
7 6 4 2
The given matrix is not symmetric.
Sum of the left diagonal = 17
Sum of the right diagonal = 20
Example 3:
OUTPUT:
Matrix size is out of range.

## Question 3

Write a program to accept a sentence which may be terminated by either ‘.’, ‘?’ or ‘!’ only. Any other character may be ignored. The words may be separated by more than one blank space and are in uppercase.

Perform the following tasks:

(a) Accept the sentence and reduce all the extra blank space between two words to a single blank space.

(b) Accept a word from the user which is a part of the sentence along with its position number and delete the word and display the sentence.

` ````
```Test your program for the following data and some random data:
Example 1:
INPUT: A MORNING WALK IS A IS BLESSING FOR THE WHOLE DAY.
WORD TO BE DELETED: IS
WORD POSITION IN THE SENTENCE: 6
OUTPUT: A MORNING WALK IS A BLESSING FOR THE WHOLE DAY.
Example 2:
INPUT: AS YOU SOW, SO SO YOU REAP.
WORD TO BE DELETED: SO
WORD POSITION IN THE SENTENCE: 4
OUTPUT: AS YOU SOW, SO YOU REAP.
Example 3:
INPUT: STUDY WELL##
OUTPUT: INVALID INPUT

## Question 1

An ISBN (International Standard Book Number) is a ten digit code which uniquely identifies a book.

The first nine digits represent the Group, Publisher and Title of the book and the last digit is used to check whether ISBN is correct or not.

Each of the first nine digits of the code can take a value between 0 and 9. Sometimes it is necessary to make the last digit equal to ten; this is done by writing the last digit of the code as X.

To verify an ISBN, calculate 10 times the first digit, plus 9 times the second digit, plus 8 times the third and so on until we add 1 time the last digit. If the final number leaves no remainder when divided by 11, the code is a valid ISBN.

` ````
```For example:
1. 0201103311:
10 * 0 + 9 * 2 + 8 * 0 + 7 * 1 + 6 * 1 + 5 * 0 + 4 * 3 + 3 * 3 + 2 * 1 + 1 * 1 = 55.
Since 55 leaves no remainder when divided by 11, hence it is a valid ISBN.
2. 007462542X:
10 * 0 + 9 * 0 + 8 * 7 + 7 * 4 + 6 * 6 + 5 * 2 + 4 * 5 + 3 * 4 + 2 * 2 + 1 * 10 = 176.
Since 176 leaves no remainder when divided by 11, hence it is a valid ISBN.
3. 0112112425:
10 * 0 + 9 * 1 + 8 * 1 + 7 * 2 + 6 * 1 + 5 * 1 + 4 * 2 + 3 * 4 + 2 * 2 + 1 * 5 = 71.
Since 71 leaves a remainder when divided by 11, hence it is not a valid ISBN.

**Design a program to accept a ten digit code from the user. For an invalid input, display an appropriate message. Verify the code for its validity in the format specified below:**

` ````
```Test your program with sample data and some random data.
Example 1:
INPUT CODE: 0201530821
OUTPUT:
SUM = 99
LEAVES NO REMAINDER – VALID ISBN CODE
Example 2:
INPUT CODE: 035680324
OUTPUT: INVALID INPUT
Example 3:
INPUT CODE: 0231428031
OUTPUT:
SUM = 122
LEAVES REMAINDER – INVALID ISBN CODE

## Question 2

Write a program to declare a square matrix a[][] of order (m × m) where ‘m’ is the number of rows and the number of columns such that ‘m’ must be greater than 2 and less than 20. Allow the user to input integers into this matrix. Display appropriate error messages for invalid input. Perform the following tasks:

(a) Display the input matrix.

(b) Create a mirror image of the inputted matrix.

(c) Display the mirror image matrix.

Test your program for the following data and some random data:

` ````
```Example 1:
INPUT: M = 3
4 16 12
8 2 14
6 1 3
OUTPUT:
ORIGINAL MATRIX
4 16 12
8 2 14
6 1 3
MIRROR IMAGE MATRIX
12 16 4
14 2 8
3 1 6
Example 2:
INPUT: M = 22
OUTPUT: SIZE OUT OF RANGE

## Question 3

A palindrome is a word that may be read the same way in either direction.

Accept a sentence in uppercase which is terminated by either “.”, “?” or “!”. Each word of the sentence is separated by a single blank space.

Perform the following tasks:

(a) Display the count of palindromic words in the sentence.

(b) Display the palindromic words in the sentence.

Example of palindromic words:

MADAM, ARORA, NOON

` ````
```Test your program with the sample data and some random data:
Example 1:
INPUT: MOM AND DAD ARE COMING AT NOON.
OUTPUT: MOM DAD NOON
NUMBER OF PALINDROMIC WORDS: 3
Example 2:
INPUT: NITIN ARORA USES LIRIL SOAP.
OUTPUT: NITIN ARORA LIRIL
NUMBER OF PALINDROMIC WORDS: 3
Example 3:
INPUT: HOW ARE YOU?
OUTPUT: NO PALINDROMIC WORDS

## Question 1

A prime palindrome integer is a positive integer (without leading zeroes) which is prime as well as a palindrome. Given two positive integers m and n, where m < n, write a program to determine how many prime palindrome integers are there in the range between m and n (both inclusive) and output them.

The input contains two positive integers m and n where m < 3000 and n < 3000. Display the number of prime palindrome integers in the specified range along with their values in the format specified below:

Test your program with the sample data and some random data:

` ````
```Example 1:
INPUT:
m = 100
n = 1000
OUTPUT:
THE PRIME PALINDROME INTEGERS ARE:
101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 919, 929
FREQUENCY OF PRIME PALINDROME INTEGERS: 15
Example 2:
INPUT:
m = 100
n = 5000
OUTPUT:
OUT OF RANGE.

## Question 2

Write a program to accept a sentence as input. The words in the string are to be separated by a blank. Each word must be in uppercase. The sentence is terminated by either ‘.’, ‘!’ or ‘?’. Perform the following tasks:

Obtain the length of the sentence (measured in words).

Arrange the sentence in alphabetical order of the words.

Test your program with the sample data and some random data.

` ````
```Example 1:
INPUT:
NECESSITY IS THE MOTHER OF INVENTION.
OUTPUT:
LENGTH: 6
REARRANGED SENTENCE:
INVENTION IS MOTHER NECESSITY OF THE
Example 2:
INPUT:
BE GOOD TO OTHERS.
OUTPUT:
LENGTH: 4
REARRANGED SENTENCE:
BE GOOD OTHERS TO

## Question 3

Write a program to declare a matrix a[][] of order (M × 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:

Display the input matrix.

Find the maximum and minimum value in the matrix and display them along with their position.

Sort the elements of the matrix in ascending order using any standard sorting technique and rearrange them in the matrix.

Output the rearranged matrix.

Test your program with the sample data and some random data:

` ````
```Example 1:
INPUT:
M = 3
N = 4
8 7 9 3
-2 0 4 5
1 3 6 -4
OUTPUT:
ORIGINAL MATRIX:
8 7 9 3
-2 0 4 5
1 3 6 -4
LARGEST NUMBER: 9
ROW = 0
COLUMN = 3
SMALLEST NUMBER: -4
ROW=2
COLUMN=3
REARRANGED MATRIX:
-4 -2 0 1
3 3 4 5
6 7 8 9
Example 2:
INPUT:
M = 3
N = 22
OUTPUT:
SIZE OUT OF RANGE