‹ Back to the paper
Write a program to accept a sentence which may be terminated by either ‘.’ , ‘?’ or ‘!’ only. The…
Write a program to accept a sentence which may be terminated by either ‘.’ , ‘?’ or ‘!’ only. The words are to be separated by a single blank space and are in lower case. Perform the following tasks:
Design your program which will enable the output in the format given below:
Sample 1
INPUT: the lines are printed in reverse order.
OUTPUT:
The lines are printed in reverse order.
In the are lines order printed reverse.
Sample 2
INPUT: print the sentence in ascending order.
OUTPUT:
Print the sentence in ascending order.
In the print order sentence ascending.
Sample 3
INPUT: i love my country.
OUTPUT:
I love my country.
I my love country.
(a)
Check for the validity of the accepted sentence and for the terminating character.
(b)
Arrange the words contained in the sentence according to the size of the words in ascending order. If two words are of the same length then the first occurring comes first. The sentence should begin with a capital alphabet in both the cases i.e. Input and Output.
(c)
Display both the sentences separately with each sentence beginning with a capital alphabet.
Answer
No answer yet.
From ISC 2021 Specimen Computer Science Paper 2, question 2.