2024 - 25 - Board Practical - Specimen - Edited
2024 - 25 - Board Practical - Specimen - Edited
PAPER – 2
PRACTICALS
(Maximum Marks: 30)
Time allowed: Three Hours
(Candidates are allowed additional 15 minutes for only reading the paper.)
They must NOT start writing during this time.)
The total time to be spent on the Planning Session and the Examination Session is Three hours.
After completing the Planning Session, the candidate may begin the Examination Session.
A maximum of 90 minutes is permitted for the Planning Session.
However, if candidates finish earlier, they are permitted to begin the Examination Session.
This paper consists of three problems from which candidates are required to attempt any one problem.
A. Planning Session:
1. Write an algorithm for the selected problem. [3marks]
(Algorithm should be expressed clearly using any standard scheme such as
pseudo code or in steps which are simple enough to be obviously computable.)
2. Write a program in JAVA language. The program should follow the algorithm [7marks]
and should be logically and syntactically correct. Document the program using
mnemonic names / comments, identifying and clearly describing the choice of
data types and meaning of variables.
B. Examination Session:
1. Code / Type the program on the computer and get a printout (hard copy). [2marks]
Typically, this should be a program that compiles and runs correctly.
2. Test run the program on the computer using the given sample data and get a [3marks]
printout of the output in the format specified in the problem.
Note: The candidates must not carry any stationery, items such as pen / pencil / eraser
to the Computer Laboratory for the Examination Session.
1
SAMPLE PAPER 1
Question 1
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<=N<=50) and
generate odd prime twin of ‘N’
Test your program for the following data and some random data.
Example 1
INPUT: N = 14
OUTPUT: ODD PRIME PAIRS ARE: 3, 11
7, 7
Example 2
INPUT: N = 20
OUTPUT: ODD PRIME PAIRS ARE: 17, 3
13, 7
Example 3
INPUT: N = 44
OUTPUT: ODD PRIME PAIRS ARE: 41, 3
37, 7
31, 13
Example 4
INPUT: N = 25
OUTPUT: INVALID INPUT
2
Question 2
3
Question 3
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: 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 #
OUTPUT: INVALID INPUT
4
SAMPLE PAPER 2
Question 1
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: 2024
N: 25
OUTPUT: ENTERED DATE: FEBRUARY 19, 2024
25 DAYS LATER: MARCH 15, 2024
Example 2
INPUT: DAY NUMBER: 321
YEAR: 2024
N: 77
OUTPUT: ENTERED DATE: NOVEMBER 16, 2024
77 DAYS LATER: FEBRUARY 1, 2025
Example 3
INPUT: DAY NUMBER: 400
YEAR: 2024
N: 125
OUTPUT: INCORRECT DAY NUMBER
INCORRECT VALUE OF ‘N’
5
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) Check if the given matrix is Symmetric or not.
A square matrix is said to be Symmetric, if the element of the ith row and jth column
is equal to the element of the jth row and ith 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:
Example 1
INPUT: M=3
Enter elements of the matrix:
1 2 3
2 4 5
3 5 6
OUTPUT: ORIGINAL MATRIX
1 2 3
2 4 5
3 5 6
THE GIVEN MATRIX IS SYMMETRIC
The sum of the left diagonal = 11
The sum of the right diagonal = 10
Example 2
INPUT: M=4
Enter elements of the matrix:
7 8 9 2
4 5 6 3
8 5 3 1
7 6 4 2
OUTPUT: ORIGINAL MATRIX
7 8 9 2
4 5 6 3
8 5 3 1
7 6 4 2
THE GIVEN MATRIX IS NOT SYMMETRIC
The sum of the left diagonal = 17
The sum of the right diagonal = 20
Example 3
INPUT: M = 12
OUTPUT: SIZE IS OUT OF RANGE
6
Question 3
Most (NOT ALL) cell phone keypads look like the following arrangement (the letters are
above the respective number)
ABC DEF
1 2 3
GHI JKL MNO
4 5 6
PQRS TUV WXYZ
7 8 9
[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 2:
INPUT: Thanks
Example 3:
INPUT: Good-Bye
7
SAMPLE PAPER 3
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
Example 2
INPUT: m = 2505
n = 2525
2506, 2507, 2508, 2509, 2510, 2513, 2514, 2516, 2517, 2518, 2519
Example 3
INPUT: m = 2520
n = 2529
8
Question 2
(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.
Test your program for the following data and some random data:
Example 1
INPUT: M=3
N=4
Enter elements of the matrix:
8 7 9 3
-2 0 4 5
1 3 6 -4
8 7 9 3
-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
3 3 4 5
6 7 8 9
9
Example 2
INPUT: M=3
N=3
Enter elements of the matrix:
7 9 3
-2 4 5
1 16 4
7 9 3
-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
4 4 5
7 9 16
Example 3
INPUT: M=3
N = 22
10
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
Example 2
Example 3
Example 4
11