0% found this document useful (0 votes)
527 views

ISC 2015 Computer Science Paper 2 Practical

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
527 views

ISC 2015 Computer Science Paper 2 Practical

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

COMPUTER SCIENCE

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)
———————————————————————————————------------

As it is a practical examination the candidate is expected to do the following:

1. Write an algorithm for the selected problem. [10]


(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 [20]
should be logically and syntactically correct.
3. Document the program using mnemonic names / comments, identifying and clearly [10]
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, [10]
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 [10]
of the output in the format specified in the problem.
6. Viva-Voce on the Selected Problem. [20]

This Paper consists of 4 printed pages.


1215-868 B © www.guideforschool.com Turn over
Solve any one of the following Problems:

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

2
1215-868 B © www.guideforschool.com
Question 2

Write a program to declare a square matrix A[ ][ ] of order MxM where 'M' is the
number of rows and the number of columns, such that M must be greater than 2 and
less than I 0. 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) Rotate the matrix 90° clockwise as shown below:
Original matrix Rotated matrix
1 2 3 7 4 1
4 5 6 8 5 2
7 8 9 9 6 3
(c) Find the sum of the elements of the four comers of the matrix.
Test your program with the sample data and some random data:
Example 1
INPUT : M=3
3 4 9
2 5 8
1 6 7
OUTPUT :
ORIGINAL MATRIX
3 4 9
2 5 8
1 6 7
MATRIX AFTER ROTATION
1 2 3
6 5 4
7 8 9
Sum of the corner elements = 20
Example 2
INPUT : M=4
1 2 4 9
2 5 8 3
1 6 7 4
3 7 6 5
OUTPUT :
ORIGINAL MATRIX
1 2 4 9
2 5 8 3
1 6 7 4
3 7 6 5

3
1215-868 B © www.guideforschool.com Turn over
MATRIX AFTER ROTATION
3 1 2 1
7 6 5 2
6 7 8 4
5 4 3 9
Sum of the corner elements = 18
Example 3
INPUT : M = 14
OUTPUT : SIZE OUT OF RANGE

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

4
1215-868 B © www.guideforschool.com

You might also like