String related problems
(Total 15 questions)
SL Problem statement Difficulty
levels
1. Write a program in C to find the length of a string without using any library function. *
Sample Input Sample Output
“My name is andy” 15
“Abc 123 7&*&*” 13
2. Write a program in C to concatenate two strings without using any library function. *
Sample Input Sample Output
“My name ” “My name is andy”
“is andy”
“123abc” “123abc*A*B”
“*A*B”
3. Write a program in C to count how many vowels are there in a string. *
Sample Input Sample Output
“My name is andy” 4
“Are you READY yet?” 7
4. Write a program in C to count the number of words in a string. *
Sample Input Sample Output
“My name is andy” 4
“Abc 123 7&*&*” 3
5. Write a program in C to find the reverse of a string. **
Sample Input Sample Output
“My name is Andy” “ydnA si eman yM”
“Abc 123 7&*&*” “*&*&7 321 cbA”
6. Write a program in C to convert lowercase string to uppercase. *
Sample Input Sample Output
“My name is andy” “MY NAME IS ANDY”
“& I am 20 years old” “& I AM 20 YEARS OLD”
7. Write a program in C to toggle the case of each character in a string. *
Sample Input Sample Output
“My name is Andy” “mY NAME IS aNDY”
“& I am 20 Years old” “& i AM 20 yEARS OLD”
8. Write a program in C to sort a string array in alphabetic order. **
Sample Input Sample Output
“My name is Andy” “ AMadeimnnsyy”
“Abc 123 7&*&*” “ &&**1237Abc”
9. Write a program in C to count the occurrences of a character in a string regardless of its case. *
Sample Input Sample Output
“My name is Andy” 2
‘a’
“WELCOME to CSE, everyone” 6
‘E’
10. Write a program in C to check whether a string is a palindrome or not. **
Sample Input Sample Output
“My name is andy” no
“madam” yes
11. Write a program in C to add the digits in a string. **
Sample Input Sample Output
“I am 20 years old” 2
“Abc 123 7&*&*” 13
12. Write a program in C to count occurrences of a word in a string. ***
Sample Input Sample Output
“I liked the story about the sad giant” 2
“the”
“It is what it is” 1
“it”
13. Write a program in C to remove all repeated characters in a string. ***
Sample Input Sample Output
“i like programming in C” “i lkeprogamnC”
“My name is Andy” “My nameisAd”
14. Write a program in C to find the maximum occurring character in a string. ***
Sample Input Sample Output
“Welcome to CSE” E (or e)
“mmmttssarrrddd” D (or d)
“mmmttssarrrDDd” D (or d)
15. Write a program in C to reverse the words in a string. ***
Sample Input Sample Output
“My name is Andy” “Andy is name My”
“Abc 123 7&*&*” “7&*&* 123 Abc”