0% found this document useful (0 votes)
2K views2 pages

Computer Science Practical 2024

1. The document describes a 3 hour computer science exam consisting of a 90 minute planning session and 90 minute examination session. 2. Candidates must choose one of three programming problems to solve which involves writing an algorithm, program, testing it, and submitting their programming work from the year. 3. Sample problems include checking if a number is a reversible prime, processing a sentence by converting to lowercase, sorting words, and swapping rows of a matrix and finding the largest and smallest corner elements.

Uploaded by

Ashish Rajput
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)
2K views2 pages

Computer Science Practical 2024

1. The document describes a 3 hour computer science exam consisting of a 90 minute planning session and 90 minute examination session. 2. Candidates must choose one of three programming problems to solve which involves writing an algorithm, program, testing it, and submitting their programming work from the year. 3. Sample problems include checking if a number is a reversible prime, processing a sentence by converting to lowercase, sorting words, and swapping rows of a matrix and finding the largest and smallest corner elements.

Uploaded by

Ashish Rajput
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/ 2

COMPUTERSCIENCE

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 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 the
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.
(Algorithm should be expressed clearly using any standard scheme such as pseudo code or in
steps which are simple enough to be obviously computable) [3]
2. Write a program in JAVA language. The program should follow the algorithm and 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. [7]
3. Code/Type the program on the computer and get a printout(HardCopy). Typically, this should be a
program that compiles and runs correctly. [2]
4. Test run the program on the computer using the given sample data and get a print out of the output in the
format specified in the problem. [3]
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:
 Programmingassignmentsdonethroughouttheyear(bytheTeacher) [10]
 Programmingassignmentsdonethroughouttheyear(bytheVisitingExaminer) [5]
Solve any one of the following Problems.
Question1
An integer N is said to be Reversible Prime , if Nand its reverse are primes as well as both the
integers consist of 3 on either end or 9 on either end.
A number is said to be prime if it has only two factors 1 and itself.
Example : Let N=3911, its reverse is =1193. Both the numbers (3911 and 1193)are primes, as well
as N (3911) starts with digit 3 and its reverse (1193) ends with digit 3 . So, N=3911 is a Reversible
Prime.
A few Reversible integers are : 3911, 1139, 9257, 3581,3319 etc.
Accept a positive number N and check whether it is a Reversible prime or not. The number itself and
its reverse number should also be displayed. An appropriate error message should be displayed, if
the input integer is a single digit.
Test your program with the sample data and some random data :
Example 1: INPUT : N=3911
OUTPUT: ORIGINAL NUMBER=3911
REVERSE NUMBER =1193
3911 IS A REVERSIBLE PRIME

Example 2: INPUT : N=9257


OUTPUT: ORIGINAL NUMBER=9257
REVERSE NUMBER =7529
9257 IS A REVERSIBLE PRIME
Example 3: INPUT : N=17
OUTPUT: ORIGINAL NUMBER=17
REVERSE NUMBER =71
17 IS NOT A REVERSIBLE PRIME
Question 2
Write a program to accept a sentence which may be terminated by either ‘.’, ‘,’, ‘ ? ’ or ‘ ! ’ only. The words are
separated by only one blank space. Perform the following operations on the input sentence :
1. Convert the sentence into lowercase form and print the modified sentence.
2. Separate the words from the sentence and sort its letters in ascending order without using any standard sorting
technique and print the sorted word alongside using the specified format given below :
3. Test your program with the sample data and some random data :
Example1:
INPUT : Switch on the fans.
OUTPUT : MODIFIED SENTENCE = switch on the fans .
WORD SORTED WORD
switch chistw
on no
the eht
fans afns
Example 2:
INPUT : SWEET APPLE#
OUTPUT : INVALID INPUT
Question 3
Write a program a declare a square matrix A[ ][ ] of order (M X M) where ‘M’ is the number of rows
and number of columns such that ‘M’ must be greater than 2 and less than 10. Allow the user to input
positive integers into this matrix. Display an appropriate message for an invalid input. Perform the
following tasks :
1. Display the input matrix.
2. Create a new matrix by swapping the elements row-wise such that 1st row and last row are
swapped. 2nd row and 2nd last row are swapped and so on.
3. Display the swapped matrix and largest corner element and smallest corner element from the new matrix.
Test your program for the following sample data and some random data :
Example 1 : INPUT : M=4
Example 1 : INPUT : M=3 3 4 9 10
4 6 7 12
9 2 1 15 8 31 23
8 1 4 11 12 12 14
15 6 31 OUTPUT : ORIGINAL MATRIX
OUTPUT : ORIGINAL MATRIX 3 4 9 10
9 2 1 4 6 7 12
8 1 4 15 8 31 23
15 6 31 11 12 12 14
OUTPUT : SWAPPED MATRIX OUTPUT : SWAPPED MATRIX
15 6 31 11 12 12 14
8 1 4 15 8 31 23
9 2 1 4 6 7 12
LARGEST CORNER ELEMENT =31 3 4 9 10
SMALLEST CORNER ELEMENT =1 LARGEST CORNER ELEMENT =14
SMALLEST CORNER ELEMENT =3

Example 3 :
INPUT : M=2
OUTPUT : THE MATRIX SIZE IS OUT OF RANGE

You might also like