Homework June2018
Homework June2018
Practice Questions
1. to accept a character and check the case (upper/ lower) otherwise check
whether it is a digit or a special character.
2. to accept a letter of the English alphabet and display the letter in the
changed case and its ASCII value.
6. accept a string and count the number of vowels present in the string.
7. accept a string and change the case of each letter in the string and display
the changed string.
11.to accept a string and print the string in the alphabetical order of its
constituent letters.
12.to accept a string in the lower case. Convert all the first characters of the
string in upper case and display the new string.
13.to remove all occurrence of a character entered by the user from the given
string.
14.that asks the user to enter a sentence and print the number of words in
that sentence.
15.that asks the user to enter a sentence and print the length of the longest
word (s) in that sentence.
16.that asks the user to enter a sentence and count the number of vowels in
the sentence. Print the sentence with all vowels in uppercase and all
others in lowercase.
17.that asks the user to enter a sentence and print the number of times each
vowel occurs in that sentence. Do not print a vowel if it occurs zero
times.
18.that accepts a string from the user and changes the case of each character
of the string and display the new string.
19.that asks the user to enter a sentence and prints the sentence in reverse
order, with the case of each letter reversed.
20.to accept a string and find number of blank spaces, number of words and
number of characters present in the string.
21.to accept a string and display the number of upper case letters, number of
lower case letters, number of special characters and number of digits
present in the string.
22.to accept a name (containing 3 words) and display the initials along with
the surname.
23.to accept a string (containing 3 words) and display the same in the reverse
order.
Sample input: java is fun
Output: fun is java
24.to accept a string (containing 3 words) and display the new string after
reversing each character of the world.
Sample input: India is my country
Output: aidnI si ym yrtnuoc
26.that asks the user to enter a word, and print all the 2 letter combinations
of that word. For example, if the word is “ABCD”, the output should
include AB, AC, AD, BA, BC, BD, CA, CB, CD, DA, DB, DC.
27.that asks the user to enter a word, and print all the UNIQUE two-letter
combinations that exist of that word.
28.that asks the user to enter a sentence, and count the number of times each
of the 26 letters of the English alphabet occurs in that sentence. Print the
same in decreasing order of the frequency of occurrence.
29.that asks the user to enter two sentences, and print all the common words
in both the sentences. The same word should not be printed more than
once.
30.that asks the user to enter a word and print all right rotations of that word.
For example: