You are on page 1of 1

Practical related to string manipulation

1. Write a code which takes users first name, middle name (if any), surname, age, marital
status and sex in separate variables. Prepare a string after concatenating first, middle and
surname. Prefix Mr. (Male; >12 Years) /Mrs. (Female; Married)/Ms. (Female;
Unmarried)/Master (<12 Years; Male). Print the string.
2. Write a program which takes a string from user and capitalize each word. It should also
check and replace capital letter given by user by mistake in between word (not at
beginning) by corresponding small letter. It should also post fix full stop at the end of the
string, if not provide. But it should not post fix full stop for interrogative string. It also
needs to report number of characters (with and without white space), words and
sentences.
3. Write a program that reads several city names from the keyboard and displays only those
names beginning with characters B and C in alphabetical order.
4. Write a code for crossword puzzle, where user will be entering some characters and

computer will return all possible combination of words in alphabetical order. After
printing a new combination, code should ask user Is this combination a valid word?.
After user prompt of yes it will keep the word in list for final display and delete
memory, otherwise. Start with highest length of string as number of letter in valid word
carries points.

You might also like