 The total time to be spent on the Planning and the Examination Session is Three hours.
After completing the Planning Session, the candidate may begin with the Examination Session.
A maximum of 90 minutes is permitted to begin the Examination Session.
—————————————————————————————————————
As it is a practical examination the candidate is expected to do the following:
1. Write an algorithm for the selected problem. 
(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 and 
should be logically and syntactically correct.
3. Document the program using mnemonic names / comments, identifying and clearly 
describing the choice of data types and meaning of variables.
4. Code / Type the program on the computer and get a printout (hard copy). Typically, 
this should be a program that compiles and runs correctly.
5. Test run the program on the computer using the given sample data and get a printout 
of the output in the format specified in the problem.
6. Viva-Voce on the Selected Problem. 

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
Input a paragraph containing ‘n’ number of sentences where (1 = < n < 4). The words are to be separated with a single blank space and are in UPPERCASE. A sentence may be terminated either with a full stop ‘.’ or a question mark ‘?’ only. Any other character may be ignored. Perform the following operations:
i. Accept the number of sentences. If the number of sentences exceeds the limit, an appropriate error message must be displayed.
ii. Find the number of words in the whole paragraph
iii. Display the words in ascending order of their frequency. Words with same frequency may appear in any order.
Example 1
INPUT:
Enter number of sentences.
1
Enter sentences.
TO BE OR NOT TO BE.
OUTPUT:
Total number of words: 6
WORD FREQUENCY
OR 1
NOT 1
TO 2
BE 2
Example 2
INPUT:
Enter number of sentences
3
Enter sentences.
THIS IS A STRING PROGRAM.IS THIS EASY?YES,IT IS.
OUTPUT:
Total number of words: 11
WORD FREQUENCY
A 1
STRING 1
PROGRAM 1
EASY 1
YES 1
IT 1
THIS 2
IS 3
Example 3
INPUT:
Enter number of sentences
5
OUTPUT: Invalid entry

Question 3.
Given a square matrix M[][] of order ‘n’. The maximum value possible for n is 10. Accept
three different characters from the keyboard and fill the array according to the instruction
given below:
Fill the upper and lower elements formed by the intersection of the diagonals by character 1.
Fill the left and right elements formed by the intersection of the diagonals by character 2.
Fill both diagonals by character 3.
Output the result in the format given below:
Example 1.
ENTER SIZE : 4
INPUT : FIRST CHARACTER ‘*’
SECOND CHARACTER ‘?’
THIRD CHARACTER ‘#’
OUTPUT
# * * #
? # # ?
? # # ?
# * * #

3
Example 2.
ENTER SIZE : 5
INPUT : FIRST CHARACTER ‘\$’
SECOND CHARACTER ‘!’
THIRD CHARACTER ‘@’
OUTPUT
@ \$ \$ \$ @
! @ \$ @ !
! ! @ ! !
! \$ \$ \$ @
Example 3.
ENTER SIZE : 65
OUTPUT SIZE OUT OF RANGE

SHARE
Previous articlePractical sample paper-1 class 12
Next articlePractice Test-6 class 10