You are on page 1of 3

St.

Thomas’ Boys’ School Kidderpore


SELCTION EXAM CLASS XII (2021 – 2022 )
Subject : Computer Science Practical
Time : 1 hrs 30 mins marks : 15
The total time to be spent on the planning session only is 90
minutes .The paper consists of three problems from which
candidates are required to attempt any one problem
Candidates are expected to do the following :
1. Write an algorithm for the selected problem [3]
2. Write a program in JAVA language The program should follow the
algorithm . [10 ]
3. Document the program using mnemonic names / comments [ 2 ]
( since the examamination is conducted online the Examination session
is not required only Planning session is asked to perform , send your
program and algorithm to GCR in one PDF file heading :
( “ PACTICAL PLANNING SESSION “)
Question I :
Given two positive numbers M and N , such that M is between 100 and
1000 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 upto 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.
Dry run your program with the sample data :
i. INPUT M= 100 N= 11
OUTPUT REQUIRED NUMBER = 119

1
TOTAL DIGITS = 3
ii. INPUT M= 1500 N= 25
OUTPUT REQUIRED NUMBER = 1699
TOTAL DIGITS = 4

iii) INPUT M= 112 N= 130


OUTPUT INVALID INPUT
Question 2.:
Design a program to accept a day number (between 1 and 366), year ( in
4 digits ) from the user to generate 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.
Dry run the program with the following data
i) INPUT : DAY NUMBER - 360
YEAR : - 2018
DATE AFTER ( N DAYS )- 45
OUTPUT :
DATE : 26TH DECEMBER , 2018
DATE AFTR 45 DAYS - 9TH FEBRUARY , 2019

ii) INPUT : DAY NUMBER - 255


YEAR : - 2021
DATE AFTER ( N DAYS )- 22
OUTPUT :
DATE : 12TH SEPTEMBER , 2021
DATE AFTR 22 DAYS - 4TH OCTOBER , 2021

iii) INPUT : DAY NUMBER - 380


YEAR : - 2020
DATE AFTER ( N DAYS )- 33
OUTPUT : DAY NUMBER OUT OF RANGE

iv) INPUT : DAY NUMBER - 150

2
YEAR : - 2021
DATE AFTER ( N DAYS )- 330
OUTPUT : DAY AFTER (N DAYS ) OUT OF RANGE

Question 3
Write a program to accept a sentence which may be terminated either by ' . ' 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 task :
( 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 .
Dry run 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.

You might also like