ISC Class 12 Question Paper 2020 for Computer Science Practical – Text
Read the full text of this question paper below — useful to quickly search, copy and reference the content online without downloading the PDF.
📄 View text version (5 pages)
Page 1
COMPUTER SCIENCE
Paper – 2
(PRACTICAL)
(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.
Planning session: 90 minutes
Examination session: 90 minutes
Note: Candidates are to be permitted to proceed to the Examination Session only after
90 minutes of the Planning Session are over.
----------------------------------------------------------------------------------------------------------------------
This 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]
(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 [7]
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.
3. Code / Type the program on the computer and get a printout (hard copy). Typically, [2]
this should be a program that compiles and runs correctly.
4. Test run the program on the computer using the given sample data and get a printout [3]
of the output in the format specified in the problem.
In addition to the above, the practical file of the candidate containing the practical work related
to programming assignments done during the year is to be evaluated as follows:
• Programming assignments done throughout the year (by the teacher) [10]
• Programming assignments done throughout the year (by the Visiting Examiner) [5]
Solve any one of the following Problems.
-------------------------------------------------------------------------------------------------------------------
This Paper consists of 5 printed pages and 1 blank page.
1220-868B Turn over
© Copyright reserved.
Page 2
Solve any one of the following problems
Question 1
A Prime-Adam integer is a positive integer (without leading zeros) which is a prime as well
as an Adam number.
Prime number: A number which has only two factors, i.e. 1 and the number itself.
Example: 2, 3, 5, 7 … etc.
Adam number: The square of a number and the square of its reverse
are reverse to each other.
Example: If n=13 and reverse of ‘n’= 31, then,
(13)2 = 169
(31)2 = 961 which is reverse of 169
thus 13, is an Adam number.
Accept two positive integers m and n, where m is less than n as user input. Display all
Prime-Adam integers that are in the range between m and n (both inclusive) and output them
along with the frequency, in the format given below:
Test your program with the following data and some random data:
INPUT: m=5
n = 100
OUTPUT: THE PRIME-ADAM INTEGERS ARE:
11 13 31
FREQUENCY OF PRIME-ADAM INTEGERS IS: 3
INPUT: m = 100
n = 200
OUTPUT: THE PRIME-ADAM INTEGERS ARE:
101 103 113
FREQUENCY OF PRIME-ADAM INTEGERS IS: 3
INPUT: m = 50
n = 70
OUTPUT: THE PRIME-ADAM INTEGERS ARE:
NIL
FREQUENCY OF PRIME-ADAM INTEGERS IS: 0
INPUT: m = 700
n = 450
OUTPUT: INVALID INPUT.
------------------------------------------------------------------------------------------------------------------------
2
1220-868B
Page 3
Question 2
Write a program to declare a matrix A[ ] [ ] of order (M x N) where ‘M’ is the number of
rows and ‘N’ is the number of columns such that the value of ‘M’ must be greater than 0
and less than 10 and the value of ‘N’ must be greater than 2 and less than 6. Allow the
user to input digits ( 0 - 7 ) only at each location, such that each row represents an octal
number.
Example: 2 3 1 ( decimal equivalent of 1st row = 153 i.e. 2x82 + 3x81 + 1x80)
4 0 5 ( decimal equivalent of 2nd row = 261 i.e. 4x82 + 0x81 + 5x80)
1 5 6 ( decimal equivalent of 3rd row = 110 i.e. 1x82 + 5x81 + 6x80)
Perform the following tasks on the matrix:
(a) Display the original matrix.
(b) Calculate the decimal equivalent for each row and display as per the format given
below.
Test your program for the following data and some random data:
INPUT: M=1
N =3
ENTER ELEMENTS FOR ROW 1: 1 4 4
OUTPUT: FILLED MATRIX DECIMAL EQUIVALENT
1 4 4 100
INPUT: M=3
N =4
ENTER ELEMENTS FOR ROW 1: 1 1 3 7
ENTER ELEMENTS FOR ROW 2: 2 1 0 6
ENTER ELEMENTS FOR ROW 3: 0 2 4 5
OUTPUT: FILLED MATRIX DECIMAL EQUIVALENT
1 1 3 7 607
2 1 0 6 1094
0 2 4 5 165
-----------------------------------------------------------------------------------------------------------------------
3
1220-868B Turn over
Page 4
INPUT: M=3
N =3
ENTER ELEMENTS FOR ROW 1: 2 4 8
OUTPUT: INVALID INPUT
INPUT: M=4
N =6
OUTPUT: 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 and are in UPPER
CASE.
Perform the following tasks:
(a) Check for the validity of the accepted sentence only for the terminating
character.
(b) Arrange the words in ascending order of their length. If two or more words
have the same length, then sort them alphabetically.
(c) Display the original sentence along with the converted sentence.
Test your program for the following data and some random data:
INPUT: AS YOU SOW SO SHALLYOU REAP.
OUTPUT: AS YOU SOW SO SHALLYOU REAP.
AS SO SOW YOU YOU REAP SHALL
INPUT: SELF HELP IS THE BEST HELP.
OUTPUT: SELF HELP IS THE BEST HELP.
IS THE BEST HELP HELP SELF
------------------------------------------------------------------------------------------------------------------------
4
1220-868B
Page 5
INPUT: BE KIND TO OTHERS.
OUTPUT: BE KIND TO OTHERS.
BE TO KIND OTHERS
INPUT: NOTHING IS IMPOSSIBLE#
OUTPUT: INVALID INPUT
-----------------------------------------------------------------------------------------------------------------------
5
1220-868B Turn over