Wednesday, February 26, 2020

2020 ISC Computer Practical Paper BlueJ Programs With Solutions


PROGRAM 1



A Prime-Adam integer is a positive integer (without leading zeros) which is 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 it's reverse are reverse to each other.
Example: If n=13 and reverse of 'n'=31 then square of 13 = 169 and square of 31 is 961 which is reverse of 169.

Thus 13 is an Adam number

Input two positive integers m and n, where m is less than n as user input. Display all the 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

Example 1:

INPUT: m=5
              n=100

OUTPUT: THE PRIME-ADAM INTEGERS ARE:
11  13  31

FREQUENCY OF PRIME-ADAM INTEGERS IS: 3


Example 2:

INPUT: m=100
              n=200

OUTPUT: THE PRIME-ADAM INTEGERS ARE:
101  103  113

FREQUENCY OF PRIME-ADAM INTEGERS IS: 3

Example 3:

INPUT: m=50
             n=70

OUTPUT: THE PRIME-ADAM INTEGERS ARE:
NIL

FREQUENCY OF PRIME-ADAM INTEGERS IS: 0

Example 4:

INPUT: m=700
             n=450

OUTPUT: INVALID INPUT


FOR SOLUTION: CLICK HERE


PROGRAM 2

Write  a program to declare a matrixA[][] of order (MxN) 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 lst row = 153 i.e. 2x8^2 + 3x8^1 + 1x8^0)
4 0 5 (decimal equivalent of 2nd row=261 i.e. 4x8^2 + 0x8^1 + 5x.8^0)
1 5 6 (decimal equivalent of 3rd row=110 i.e. lx.8^2 + 5x.8^1 + 6x8^0)

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:

Example 1

INPUT: M=I
                        N=3
ENTER ELEMENT SFOR ROW 1 : 1 4 4


OUTPUT: FILLED MATRIX

1 4 4

DECIMAL EQUIVALENT
100




Example 2


INPUT:

M=3
N=4
ENTER ELEMENTS FOR ROW 1: 1 1 3 7
ENTER ELEMENTS FOR ROW 2: 2 l 0 6
ENTER ELEMENTS FOR ROW 3: 0 2 4 5



OUTPUT: FILLED MATRIX

1 1 3 7
2 l 0 6
0 2 4 5

DECIMAL EQUIVALENT
607
1094
165


Example 3


INPUT:

M=3
N=3
ENTER ELEMENTS FOR ROW 1: 2 4 8

OUTPUT

INVALID INPUT

Example 4


INPUT:


M=4
N=6

OUTPUT

OUT OF RANGE

FOR SOLUTION: CLICK HERE 

PROGRAM 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 UPPERCASE.

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:


Example 1

INPUT: AS YOU SOW SO SHALL YOU REAP.

OUTPUT: AS YOU SOW SO SHALL YOU REAP.
                  AS SO SOW YOU YOU REAP SHALL



Example 2

INPUT: SELF HELP IS THE BEST HELP.


OUTPUT: SELF HELP IS THE BEST HELP.
                  IS THE BEST HELP HELP SELF


Example 3

INPUT: BE KIND TO OTHERS.


OUTPUT: BE KIND TO OTHERS.
                  BE TO KIND OTHERS

Example 4

INPUT: NOTHING IS IMPOSSIBLE#


OUTPUT: INVALID INPUT

FOR SOLUTION: CLICK HERE 




No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner