2011
2011
2011
Paper – 2
(PRACTICAL)
(Reading Time: 15 minutes)
(Planning Session AND Examination Session: Three Hours)
———————————————————————————————-------------————
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.
However, if candidates finish earlier, they are to be permitted to begin the Examination Session.
(Maximum Marks: 80)
———————————————————————————————-------------————
Write a program to input a natural number less than 1000 and display it in words.
Test your program for the given sample data and some random data.
INPUT: 29
OUTPUT: TWENTY NINE
INPUT: 17001
OUTPUT: OUT OF RANGE
INPUT: 119
OUTPUT: ONE HUNDRED AND NINETEEN
INPUT: 500
OUTPUT: FIVE HUNDRED
Question 2
Encryption is a technique of coding messages to maintain their secrecy. A String array of size ‘n’
where ‘n’ is greater than 1 and less than 10, stores single sentences (each sentence ends with a full
stop) in each row of the array.
Write a program to accept the size of the array. Display an appropriate message if the size is not
satisfying the given condition. Define a string array of the inputted size and fill it with sentences
row-wise. Change the sentence of the odd rows with an encryption of two characters ahead of the
original character. Also change the sentence of the even rows by storing the sentence in reverse
order. Display the encrypted sentences as per the sample data given below:
Test your program on the sample data and some random data.
Example 1 :
INPUT: n=4
IT IS CLOUDY.
IT MAY RAIN.
THE WEATHER IS FINE.
IT IS COOL.
OUTPUT: KV KU ENQWFA.
RAIN MAY IT.
VJG YGCVJGT KU HKPG.
COOL IS IT.
Example 2 :
INPUT: n = 13
OUTPUT: INVALID ENTRY
2
Question 3
Design a program which accepts your date of birth in dd mm yyyy format. Check whether the date
entered is valid or not. If it is valid, display “VALID DATE”, also compute and display the day
number of the year for the date of birth. If it is invalid, display “INVALID DATE” and then
terminate the program.
Test your program for the given sample data and some random data.
Example 1 :
INPUT: Enter your date of birth in dd mm yyyy format
05
01
2010
3
© www.javaforschool.com
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: