COMPUTER SCIENCE

Paper- 2

(Practical)

(planning Session AND Examination Session: Three Hours)

…………………………………………………………………………………………………………………………

The. total time to be spent on the Planning Session 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 for the Planning Session. However, if candidate finish earlier, they

are to be permitted to begin the Examination Session. (Maximum Marks: 80)

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

1. Write an algorithm for the selected problem.

(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 should be logically and syntactically correct.    

3. Document the program using mnemonic names / comments, identifying and   clearly 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, 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 of the output In the format specified in the problem.   

6.Viva-Voce on the Selected Problem .

Solve any one of the following Problems.

Question 1

A Prime-palindrome integer is a positive integer (without leading zeros) which is prime as well as a palindrome. Give two positive integers m and n, where m < n, write a program to determine how many Prime-palindrome integers are there in the range between m and n (both inclusive) and output them.

The input contains two positive integers m and n, where m < 3000 and n < 3000. Display the number of prime -palindrome integers in the specified range along with their values in the format specified below:
Test your program with the sample data and some random data:

Example 1
INPUT: m = 100

N= 1000
OUTPUT: THE PRIME PALINDROME INTEGERS ARE:
101, 131, 151. 181, 191,313, 353, 373, 383, 727, 757, 787. 797, 919, 929
FREQUENCY OF PRIME PALINDROME INTEGERS: 15

Example 2

INPUT: m = 100
N = 5000
OUTPUT: OUT OF RANGE

Question 2

Write a program to accept a sentence as input. The words In the string are to be separated by ‘ a blank. Each word must be in upper case, the sentence is terminated by either “.% “I’. or “?”.  Perform the following tasks:

(i) Obtain the length of the sentence {measured in words).

(ii) Arrange the sentence in alphabetical order of the words.

Test your program with the sample data and some random data:

Example 1
INPUT:
NECESSITY IS THE MOTHER OF INVENTION.
OUTPUT:
LENGTH: 6
REARRANGED SENTENCE
INVENTION IS MOTHER NECESSITY OF THE

Example 2
INPUT:
BE GOOD TO OTHERS.
OUTPUT:
LENGTH: 4
RF‑ARRANGED SENTENCE
BE GOOD OTHERS TO

Question 3

Write a program to declare a matrix A[ ] [ ] of order (MxN) where ‘M’ is the number of rows and 0’N’ is the number of columns such that both M and N mist be greater than 2 and less than 20.

Allow the user to input integers into this matrix. Perform the following tasks on the matrix:

(a)Display the input matrix.

(b) Find the maximum and minimum value in the matrix and display them along with their position.

(c) Sort the elements of the matrix in ascending order using any standard sorting technique and rearrange them in the matrix.

(d) Output the rearranged matrix.

your program for the following data and some random data: « Previous Next »