The Programming Project: String
Showing posts with label String. Show all posts
Showing posts with label String. Show all posts

Monday, April 14, 2014

ISC Computer Science Practicals Solved, 2011


/*
Encryption is a technique of coding messages to maintain their secrecy.
A String array of size 'n' where 'n' is greater than 1 and less than 10,
stores single sentences (each sentence ends with a full stop) in each row of the array.
Write a program to accept the size of the array.
Display an appropriate message if the size is not satisfying the given condition.
Define a string array of the inputted size and fill it with sentences row-wise.
Change the sentence of the odd rows with an encryption of two characters ahead of the original character. Also change the sentence of the even rows by storing the sentence in reverse order.
Display the encrypted sentences as per the sample data given below.
Test your program on the sample data and some random data.
Input: n=4
IT IS CLOUDY. IT MAY RAIN. THE WEATHER IS FINE. IT IS COOL.
Output: KV KU ENQWFA. RAIN MAY IT. VJG YGCVJGT KU HKPG. COOL IS IT.
Input: n=13
Output: INVALID ENTRY
*/
/* ISC Computer Science Practicals, 2011 */ 

Saturday, April 12, 2014

ISC Computer Science Practicals, 2012 Solved


/*
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 '.','!' or '?'.
Perform the following tasks:
1. Obtain the length of the sentence (measured in words)
2. 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
Rearranged Sentence: BE GOOD OTHERS TO
*/
// ISC Computer Science Practicals, 2012 


ISC Computer Science Practical Solved, 2010


/*
Input a paragraph containing 'n' number of sentences where (1<=n<=4). The words are to be separated with single blank space and are in upper case. A sentence may be terminated either with a full stop (.) or question mark (?). Perform the followings:

(i) Enter the number of sentences, if it exceeds the limit show a message.
(ii) Find the number of words in the paragraph
(iii) Display the words in ascending order with frequency.

Example 1:

INPUT:
Enter number of sentences:
1
Enter sentences:
TO BE OR NOT TO BE.

OUTPUT:
Total number of words: 6
WORD FREQUENCY
OR 1
NOT 1
TO 2
BE 2


Example 2:

INPUT: Enter number of sentences:
3
Enter sentences:
THIS IS A STRING PROGRAM. IS THIS EASY? YES, IT IS.

OUTPUT:
Total number of words: 11
WORD FREQUENCY
A                       1
STRING            1
PROGRAM        1
EASY                1
YES                  1
IT                      1
THIS                 2
IS                      3
*/