Close
Close

Practice questions on String

Level 1

1.
Write a program to print every character of a string entered by user in a new line using loop.

2.
Write a program to check if the letter 'e' is present in the word 'Umbrella'.

3.
Write a program to check if the word 'orange' is present in the "This is orange juice".

4.
Write a program to find the first and the last occurence of the letter 'o' and character ',' in "Hello, World".

5.
Write the string after the first occurrence of ',' and the string after the last occurrence of ',' in the string "Hello, Good, Morning". World".

6.
Write a program that takes your full name as input and displays the abbreviations of the first and middle names except the last name which is displayed as it is. For example, if your name is Robert Brett Roser, then the output should be R.B.Roser.

7.
Check the occurrence of the letter 'e' and the word 'is' in the sentence "This is umbrella".

8.
Write a program to find the number of vowels, consonents, digits and white space characters in a string.

9.
Write a program to make a new string with all the consonents deleted from the string "Hello, have a good day".

Level 2

1.
Write a program to find out the largest and smallest word in the string "This is an umbrella".

2.
Write a program to check if a given string is a Palindrome.
A palindrome reads same from front and back e.g.- aba, ccaacc, mom, etc.

3.
Write down the names of 10 of your friends in a list and then sort those in alphabetically ascending order.

4.
Write a program to make a new string with the word "the" deleted in the sentence "This is the lion in the cage".

5.
Write a program to check if the two strings entered by user are anagrams or not. Two words are said to be anagrams if the letters of one word can be rearranged to form the other word. For example, jaxa and ajax are anagrams of each other.

Level 3

Ask Yours
Post Yours