Project 12th 2025
Project 12th 2025
Q1. WAP to input positive integer in Decimal number system from the user and display its Hexadecimal equivalent.
Example 1: Decimal number = 25 Hexadecimal equivalent :19
Example 2: Decimal number = 28 Hexadecimal equivalent :1C
Q2. A Composite Magic number is a positive integer which is composite as well as 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 eventual sum of the digits is equal to 1.
For example :28 = 2 + 8 = 10 = 1 + 0 =1
Accept two positive integer numbers m and n, where m is less than n. Display all composite magic integers that
are in the range between m and n(both inclusive) along with the frequency in the format specified below.
Test your program for the following data and some random data.
Example
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
Q3. 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 than10. Allow the user to input
integers into this matrix. Display appropriate error message for an invalid input.
Perform the following tasks on the matrix.
(a) Display the input matrix
(b) Rotate the matrix by 2700 degrees anti clock wise and display the resultant matrix
(c) Calculate the sum of the odd elements of the matrix and display
Test your program for the following data and some random data:
Example
INPUT: M=3
N=4
ENTER ELEMENTS: 8, 7, 9, 3,-2, 0, 4, 5, 1, 3, 6, -4
OUTPUT: ORIGINALMATRIX
8 7 9 3
-2 0 4 5
1 3 6 -4
ROTATED MATRIX ( 2700 ANTI CLOCK WISE )
1 -2 8
3 0 7
6 4 9
-4 5 3
SUM OF THE ODD ELEMENTS = 28
Q4. A snowball string is a sentence where each word is arranged in ascending order of their length and is also
consecutive.
For example “I am the Lord” is a snowball string as
Length of word ‘I’ is 1
Length of word ‘am’ is 2
Length of word ‘the’ is 3
Length of word ‘Lord’ is 4
The length of each word is one more than the previous word. Hence they are consecutive and in ascending order.
Write a program to enter any sentence and check if it is a snowball string or not. The words in the sentence may
be separated by a one or more spaces and terminated by ‘.’ or ‘?’ only. The program will generate appropriate
error message for any other terminating character.
Test your program for the following data and some random data:
Example 1
INPUT: He may give bonus.
OUTPUT: IT IS A SNOWBALL STRING
Example 2
INPUT: Is the cold water frozen?
OUTPUT: IT IS A SNOWBALL STRING
Q5. Write a program in JAVA to accept day number (between 1 and 366) and year (yyyy) from the user
and display the corresponding date. Also accept ‘N’ from the user where (1<=N<=100) to compute and
display the future date ‘N’ days after the given date. Display error message if the value of the day number
or ‘N’ are not within the limit. Day number is calculated taking 1st January of the given year as 1.
Test your program with given set of data and some random data
Example 1
INPUT: DAY NUMBER: 50
YEAR : 2023
N : 25
OUTPUT: ENTERED DATE: FEBRUARY 19, 2023
25 DAYS LATER: MARCH 16, 2023
Example 2
INPUT: DAY NUMBER: 321
YEAR : 2023
N : 77
Q6. Write a program to declare a matrix A[ ] [ ] of order (M * N) where M is the number of rows and columns such that
the value of both M and N must be greater than 2 and less than 10. Allow the user to input integers into this matrix.
Display appropriate error message for an invalid input. Perform the following tasks on the matrix:
a. Display the original matrix.
b. Sort each row of the matrix in ascending order using any standard sorting technique.
c. Find the sum of all the elements of the matrix.
d. Display the changed matrix after sorting each row.
INPUT: M=4
N=4
23 30 76 12
99 65 23 16
33 17 56 20
44 87 11 33
Output:- ORIGINAL MATRIX
23 30 76 12
99 65 21 16
33 17 56 20
44 87 11 33
SORTED MATRIX
12 23 30 76
16 21 65 99
17 20 33 56
11 33 44 87
Q7. Design a program to input a sentence. The sentence is terminated by “.”, “?”, or “ !”. to perform the following
tasks on the strings Convert the sentence into capital case. Then finally display each word of the sentence with
total frequency of vowels and sort the word in alphabetical order (A to Z order) OTHERWISE display the
massage “Invalid Sentence”.
Example 1
Input: Enter the sentence: This is my Computer Science exam.
Output: THIS IS MY COMPUTER SCIENCE EXAM.
Total words: 6
Word Vowel Frequency SORTED WORD
THIS 1 HIST
IS 1 IS
MY 0 MY
COMPUTER 3 CEMOPRTU
SCIENCE 3 CCEEINS
EXAM 2 AEMX
Example 2
Input : Enter the sentence: Hello I am ready
Output : Invalid Sentence
Q8. An integer number whose digits are arranged in ascending order from left to right is called an Increasing Number.
At any position, the current digit is always greater than or equal to the previous digit. For example, 1233, 13689,
112334566, etc. An integer number whose digits are arranged in descending order from left to right is called a
Decreasing Number. Here the current digit is always less than or equal to the previous digit. For example, 321,
88531, 8755321, etc.
A positive integer where the digits are neither in increasing nor decreasing order is called a Bouncy number. In
other words, if the digits of the number are unsorted then it is bouncy. For example, 123742, 101, 43682, etc.
Design a program to accept a number (containing only digits 0 to 9) from the user. For an invalid input, display an
appropriate message. Check whether the number is an increasing, decreasing or a bouncy number and display with
an appropriate message in the format specified below:
Test your program for the following data and some random data.
Example 1
INPUT : Enter a number: 122344
OUTPUT: 122344 IS AN INCREASING NUMBER:
Example 2
INPUT: Enter a number: 887552
OUTPUT: 887552 IS A DECREASING NUMBER
Example 3
INPUT: Enter a number: 185349
OUTPUT: 185349 IS A BOUNCY NUMBER
Example 4
INPUT: Enter a number: 98#57-649
OUTPUT: INVALID INPUT
Q9. Write a program to determine how many Kaprekar numbers are there in the range between 'p' and 'q' ( p and q are
<1000) and output them also print the numbers.
Example :-
i. 452 = 2025, Left part = 20 and right part = 25 sum 0f both parts = 20 + 25 = 45
ii. 2972 = 88209, Left part = 88 and right part = 209 sum of both parts = 88 + 209 = 297
Q10. Write a program which inputs a positive natural number N and Prints the possible consecutive number
combinations, which when added give N.
A positive natural number(for e.g. 27) can represented as follows:
2+3+4+5+6+7 =27
8+9+40=27
13+14=27
Q 11. Write a program to accept a sentence which may be terminated by either ‘. ‘ or ?’ or ‘!’ only. Any other
character may be ignored. The words may be separated by more than one blank space and are in UPPER
CASE. Perform the following tasks:
(a) Accept a sentence and remove all the extra blank space between two words to a single blank space.
(b) Accept any word from the user along with its position and insert the word in the given position. (The
position is calculated by place value of each word where first word is in position 1, second word in position
2 and so on).
c) Display the modified sentence.
Test your program for the following data and some random data.:
Example 1
INPUT: MORNING WALK IS A BLESSING FOR THE WHOLE DAY.
WORD TO BE INSERTED: TOTAL
WORD POSITION IN THE SENTENCE: 5
OUTPUT: MORNING WALK IS A TOTAL BLESSING FOR THE WHOLE DAY.
Example 2
INPUT: AS YOU SOW, SO YOU REAP!
WORD TO BE INSERTED : SHALL
WORD POSITION IN THE SENTENCE : 5 OUTPUT:
AS YOU SOW, SO SHALL YOU REAP! Example 3
INPUT: BETER LATE THAN NEVER#
OUTPUT: INVALID SENTENCE
Q12. 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 10. Allow the user to
input integers into this matrix. Display appropriate error message for an invalid input.
Perform the following tasks on the matrix.
(a) Display the input matrix
(b) Create and display the mirror image matrix
(c) Calculate the sum of the four corner elements of the matrix and display Test your program for the
following 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: ORIGINALMATRIX
8 7 9 3
2 0 4 5
1 3 6 -4
MIRROR MATRIX
3 9 7 8
5 4 0 -2
4 6 3 1
SUM OF THE CORNER ELEMENTS = 8
Example 2
INPUT: M=2
N = 10
OUTPUT: INVALID INPUT
Q13: Write a program to declare a square matrix M[][] of order ‘N’. Check if the matrix is a Doubly Markov
matrix or not. A matrix which satisfies the following conditions are Doubly Markov matrix
(i) All elements are less than or equal to 0
(ii) Sum of each row is equal to 1.
(iii) Sum of each column is equal to 1.
Accept ‘N’ from the user where 3 <= N <= 9. Display an appropriate error message if ‘N’ is not in the given
range or the entered numbers are negative. Allow the user to create a matrix and check whether the created matrix
is a Doubly Markov matrix or not
Test your program for the following data and some random data:
Example 1
INPUT: N=3
Enter elements in the matrix: 0.5, 0.25, 0.25, 0.25, 0.75, 0.0, 0.25, 0.0, 0.75
OUTPUT: FORMED MATRIX
0.5 0.25 0.25
0.25 0.75 0.0
0.25 0.0 0.75
IT IS A DOUBLY MARKOV MATRIX
Example 2
INPUT: N=3
Enter elements in the matrix: 1.5, 3, 0.15, 0.25, 4, 1.0, 0.25, 1.0, 3
OUTPUT: FORMED MATRIX
1.5 3 0.15
0.25 4 1.0
0.25 1.0 3
IT IS NOT A DOUBLY MARKOV MATRIX
Example 3
INPUT: N=2
Enter elements in the matrix: 0.8, -4.0, 0.9, 3.5
OUTPUT: NEGATIVE NUMBERS ENTERED. INVALID ENTRY
Example 4
INPUT: N =12
OUTPUT: SIZE IS OUT OF RANGE. INVALID ENTRY
Q14. Write a program to input any string find the shortest and the longest word present in a sentence and print
them along with their lengths.
Q15. Write a Java program to enter any number between 2 to m5( both inclusive) and print all the unique combinations
of the digits between 1 to that number. There should be one blank space between each digit and each new
combination should appear on new line. Also display the total number of combinations formed for the given
input.
For Example :- Enter any number from 2 to 5 ( both inclusive):- 3
Output :- 123 231
132 312
213 321 Total Combinations = 6
Q16. 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 3 and less than 10. Allow the
user to input integers into this matrix. Display appropriate error message for an invalid input.
Perform the following tasks on the matrix.
a) Display the input matrix
b) Sort all non-boundary elements in descending order.
c) Calculate and display the sum of the boundary elements.
Test your program for the following data and some random data:
Example 1
INPUT: M=4
N =5
7, 2, 5, 9, 6, 8, 15, -1, 17, 5, 6, 4, 18, 2, 35, 12, 3, 7, 4, 14
OUTPUT: INPUT MATRIX
7 2 5 9 6
8 15 -1 17 5
6 4 18 2 35
12 3 7 4 12
MIRROR MATRIX
7 2 5 9 6
8 -1 2 4 5
6 15 17 18 35
12 3 7 4 12
SUM OF THE BOUNDARY ELEMENTS = 121
Example 2
INPUT: M=1
N = 15
OUTPUT: INVALID INPUT
Q17. 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 3 and less than 10. Allow the
user to input integers into this matrix. Display appropriate error message for an invalid input.
Perform the following tasks on the matrix.
a) Display the input matrix
b) Sort elements of each column in ascending order.
c) Calculate and display the sum of the both the diagonals, if possible.
Test your program for the following data and some random data:
Q18. Pronic number is a number which is equal to the product of two consecutive numbers.
Example 0 = 0 * 1, 2 = 1 * 2, 6 = 2 * 3, 12 = 3 * 4 thus 0,2,6,12 are Pronic numbers
Write a program to generate and count all Pronic numbers in the range of M and N. where N must be greater than M.
Example 1
INPUT: M =0
N=15
OUTPUT : 0, 2, 6, 12
Total Pronic Numbers = 4
Example 2
INPUT: M =20
N=5
OUTPUT : Invalid Input
Q19. The potential of a word is found by adding the ASCII value of the alphabets.
(ASCII values of A to Z are 65 to 90).
Example: BALL
Potential = 66 + 65 + 76 + 76 = 283
Write a program to accept a sentence which may be terminated by either “ . ” , “ ? ” or “ ! ” only. The words of sentence
are separated by single blank space and are in UPPER CASE. Decode the words according to their potential and
arrange them in ascending order of their potential strength.
Test your program with the following data and some random data:
Example 1:
INPUT: HOW DO YOU DO?
OUTPUT: HOW = 238
DO = 147
YOU = 253
DO = 147
DO DO HOW YOU
Example 2:
INPUT: LOOK BEFORE YOU LEAP.
OUTPUT: LOOK = 309
BEFORE = 435
YOU = 253
LEAP = 290
YOU LEAP LOOK BEFORE
Example 3:
INPUT: HOW ARE YOU#
OUTPUT: INVALID INPUT
Q20. A Circular Prime is a prime number that remain prime under cyclic shifts of its digits. When the
leftmost digit removed and replaced at the end of the remaining 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.
Write a program to accept an integer ‘N’. Check the given integer N is a Circular Prime or N is not a
Circular Prime.
Test your program for 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