Iscpr 2003
Iscpr 2003
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.
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 :
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
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
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