0% found this document useful (0 votes)
19 views3 pages

Iscpr 2003

The document provides instructions for a computer science exam paper. It outlines 3 questions - 1) write a program to convert a 24-hour time to words, 2) write an encryption program that shifts letters of the alphabet, and 3) write a program to perform operations on a square matrix including finding the saddle point.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views3 pages

Iscpr 2003

The document provides instructions for a computer science exam paper. It outlines 3 questions - 1) write a program to convert a 24-hour time to words, 2) write an encryption program that shifts letters of the alphabet, and 3) write a program to perform operations on a square matrix including finding the saddle point.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

COMPUTER SCIENCE

Paper – 2
(Planning Session : One hours)
(Examination Session : Two hours)

Instructions
As it is a practical examination the candidate is expected to do the following:
(i) Write an algorithm for the selected problem
(ii) Write a program in C++/Java. Document your program by using mnemonic names and
comments
(iii) Test run the program on the computer using the given test data and get a print out (hard
copy) in the format specified in the problem along with the program listing.

Solve any one of the following problem.

Question 1.
Given a time in numbers we can convert it into words. For example
5 : 00 Five o'clock
5 : 10 Ten minutes past Five
5 : 15 Quarter past Five
5 : 30 Half past Five
5 : 40 Twenty minutes to Six
5 : 45 Quarter to Six
5 : 47 Thirteen minutes to Six

Write a program which first inputs two integers, the first between 1 to 12 (both inclusive) and
second between 0 to 59 (both inclusive) and prints out the time they represent, in words. Your
program should follow the format of the examples above.

SAMPLE DATA :

Input Time : 3,0


Output 3 : 00 Three o'clock
Input Time : 7,29
Output 7 : 29 Twenty nine minutes past Seven
Input Time : 6,34
Output 6 : 34 Twenty six minutes to Seven
Input Time : 12,1
Output 12 : 01 One minute past Twelve
Input Time : 12,45
Output 12 : 45 Quarter to one
Input Time : 10,59
Output 10 : 59 One minutes to Eleven
Input Time : 14,60
Output Incorrect input

Test your program for the data values given in the examples above and some random data.
Question 2.
A simple encryption system uses a shift process to hide a message. The value of the shift can be
in the range 1 to 26. For example a shift of 7 means that A=U, B=V, C=W, etc. i.e.
Text: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Code: U V W X Y Z A B C D E F G H I J K L M N O P Q R S T

First an extra space is added to the end of the string. To make things a little more difficult,
spaces within the original text are replaced with QQ before the text is encrypted. Double Q (QQ)
was selected because no English words ends or contains QQ. Additionally the coded message is
printed in blocks of six characters separated by spaces. The last block might not contain six
characters.

Write a program that takes the coded text (less than 100 characters), the shift value and prints
the decoded original text. Your program must reject any non-valid value for shift and display an
error message "INVALID SHIFT VALUE". Assume all characters are upper case. Test your
program for the following data and some data that you have coded, using the rules given above:

SAMPLE DATA:
Input Coded Text : "UHINBY LKKQCH HYLKK" Shift : 7
Output Decoded Text : ANOTHER WINNER

Input Coded Text : "RUIJGG EVGGBK SAGG" Shift : 11


Output Decoded Text : BEST OF LUCK

Input Coded Text : "DKSMMW NAMMUK QMM" Shift : 29


Output: INVALID SHIFT VALUE.

Question 3.
Write a program to declare a square matrix A[][] of order N (N<20). Allow the user to input
positive integers into this matrix. Perform the following tasks on the matrix:
(1) Output the original matrix.
(2) Find the SADDLE POINT for the matrix. A saddle point is an element of the matrix
Such that it is the minimum element fro the row to which it belongs and the maximum
element for the column to which it belongs. Saddle point for a given matrix is always
unique. If the matrix has no saddle point, out the message "NO SADDLE POINT"
(3) Sort the elements along principle diagonal in ascending order using insertion sort
technique. All other elements should remain unchanged.

Test your program for the following data and some random data:

SAMPLE DATA:
Input : N=4
Matrix A[ ][ ] = 2 5 6 9
8 4 12 3
6 7 3 1
12 24 2 11

Output : 2 5 6 9
8 4 12 3
6 7 3 1
12 24 2 11
NO SADDLE POINT

MATRIX AFTER SORTING THE PRINCIPLE DIAGONAL


2 5 6 9
8 3 12 3
6 7 4 1
12 24 2 11

Input : N=3
Matrix A[ ][ ] = 4 16 12
2 8 14
1 3 6

Output : 4 16 12
2 8 14
1 3 6

SADDLE POINT = 4

MATRIX AFTER SORTING THE PRINCIPLE DIAGONAL


4 16 12
2 6 14
1 3 8

You might also like