ISC2021 Computer Science Practical Paper

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

COMPUTER SCIENCE

Paper-2

(PRACTICAL)
(Maximum Marks: 30)

Time allowed:

1-Planningsession:
90minutes
Day
session: 90 minutes
Examination the paper
Day 2- reading
additional 15minutes
for only
candidates are allowed
(On Day 1, time.)
writing during this
TheymustNOT start candidates a r e
reguired to
attempt

from which
I s paper
consists ofthree problems
any one problem.

the following:
Candidates are expected to do

A. During Planning Session


Day 1:
on 3marks
the selected problem. such as pseudo
1. Write an algorithm for standard scheme
be expressed clearly using
any
(Algorithm should to be obviously
computable.)
which are simple enough
code or in steps
algorithm and
[7marks]
should follow the
The program
Write a program in JAVA language. Document the program
using
2. correct.
should be logically and syntactically
describing the
choice of data
identifying and clearly
mnemonic names/ comments,
of variables.
types and meaning o v e r the
Answer Scripts,
the candidates must hand Answer
this session, Examiner. These
Note: At ihe end of to the Supervising
their Question Papers, candidates on the day
along with will be handed over to the
Papers
Seripts and the Question
Examination Session.
ofthe

Examination Session on Day 2:


B. During
the computer and get
on
a printout (hard copy). [2marks]
Code/ Type the program
1. and runs correctly.
should be a program that compiles
Typically, this
the given sample data and get
a [3marks|
program on
the computer using
2 Test run the in the problem.
in the format specified
printout of the output
items such as pen /pencil /
eraser

candidates must not carry any stationery


Note: The
this session.
to the Computer Laboratory for

This Paper consists of 5 printed pages and 1 blank page.


Turn over
1221-868BB
OCopyright reserved.
Solve any one of n e jolOwing Probleme

Question1
one which whenthemultiplied by 2 and 3 and ther
agtingnu the rioinal number,
new number
contains all the after the
digits froresultstoare
oigi
A Fas
concatenated
with any number of zeros and are to be ignored.
cana
There

once.
exactly
Example: 273
Exanp 273xI=273
546
273x 2
273 x3 8 1 9

Concatenating the results get, 273546819 which contains all


digits from 1 to 9
once.
exactly
number.
Fascinating
Thus, 273
is a
Accept two positive integers mand n, where mmust be lless than n and the values of both 'm
and'n' must be greater than 99 and less than 10000 as user input. Display all Fascina 'm
(both inclusive) output them alongnating
in the range between m and n and
numbers that are

in the format given below: with


the frequency,
Test your program
with the tollowing data and some random data:

Example
INPUT: m=100
n = 500

OUTPUT: THE FASCINATING NUMBERS ARE:


192 219 273 327

FREQUENCY OF FASCINATING NUMBERS IS: 4

Example 2
INPUT: m= 900
n 5000

OUTPUT: THE FASCINATING NUMBERS ARE:


1902 1920 2019 2190 2703 2730 3027
3270

FREQUENCY OF FASCINATING NUMBERS IS: 8

Example 3
INPUT: m 400
n = 900

OUTPUT: THE
FASCINATING NUMBERS ARE:
NIL
FREQUENCY OF FASCINATING NUMBERS IS: 0

1221-868B 2
Example 4
m= 70
INPUT: n =450
OUTPUT: INVALID INPUT

Question 2
Write a program to accept a paragraph containing TWO sentences only. The
Sentencesmay be terminated by either ' , " or " only. Any other charactermay
be ignored. The words are to be separated by a single blank space and must be in
UPPER CASE.
Perform the following tasks:
Check for the validity of the accepted paragraph for the number of sentences
(a)
and for the terminating character.

(b) Separate the two sentences from the paragraph and find the common words in
the two sentences with their frequency of occurrence in the paragraph.
Display both the sentences separately along with the common words and their
frequency, in the format given below:
Test your program for the following data and some random data:

Example 1
INPUT: IS IT RAINING? YOU MAY GET WET IF IT IS RAINING.

OUTPUT: IS IT RAINING?
YOU MAY GET WET IF IT IS RAINING.
COMMON WORDS FREQUENCY
IS 2
IT 2
RAINING 2

Example 2
INPUT: NDIA IS MY MOTHERLAND AND I AM PROUD OF MY
MOTHERLAND. ALL INDIANS ARE MY BROTHERS AND
SISTERS.

OUTPUT: NDIA IS MY MOTHERLAND AND I AM PROUD OF MY


MOTHERLAND.
ALL INDIANS ARE MY BROTHERS AND SISTERS.
COMMON WORDS FREQUENCY
MY
AND 2

3
1221-868B Turn over
Example 3

INPUT ARE YOU COMING? I AM GETTING LATE.

OUTPUT: ARE YOU COMING?


I AM GETTING LATE.

NO COMMON WORDS

Example 4
INPUT: AT LAST, THE TIGER WAS SAVED

OUTPUT: INVALID INPUT

Question 3

Write a program to declare a matrix A[][] of order (M * N) where "M is the


of rows and 'N' is the number of columns such that the value of both 'M'
number
and N' must
be greater than 2 and less than 8. Allow the user to
input integers into the matrix.
Perform the following tasks on the matrix:
(a)Sort the matrix elements in descending order using any standard sorting
b) Calculate the sum of the boundary elements of the matrix before technique.
sorting. sorting and after
(c) Display the original matrix and the sorted matrix along with the sum of
their
boundary elements respectively.
Test your program for the following data and some random data:
Example 1
INPUT: M-3
N =4
ENTER ELEMENTS OF MATRIX
11 2 3 5
7 13 6
4 9 8

OUTPUT: ORIGINAL MATRIX


11 2 5
17 13 6
0 4 9 8
SUM OF THE BOUNDARY
ELEMENTS (UNSORTED) =
43

1221-868B
SORTED MATRIX

13 11 9 8
5 4
1 -3
2 1
1 INM OF THE BOUNDARY ELEMENTS (SORTED)= <5

Example2

M=3
INPUT:

N3
MATRIX
ELEMENTS OF
2 S
E N T E R

6
14 1 17
9 4 8
OUTPUT: ORIGINAL MATRIX

6 2
14 1 17
94 8
SUM OF THE BOUNDARY ELEMENTS
SORTED MATRIX
(UNSORTED) 65

17 14 9
8 6 5
4 2 1
SUM OF THE BOUNDARY ELEMENTS
(SORTED) =60
Example 3

INPUT: M 2
N 6

OUTPUT: OUT OF RANGE

Example 4

INPUT: M=4
N 9

OUTPUT: OUT OF RANGE

In addition to the above, the practical file of the candidate containing the practical work
Frelated to programming assignments done during the year will be evaluated as follows:

Programming assignments done throughout the year (by the teacher) [10marks
Programming assignments done throughout the year (by the Visiting Examiner) [Smarks]

1221-868B

You might also like