0% found this document useful (0 votes)
2 views

Class10_string programs

The document outlines a series of programming tasks focused on string handling for Class 10 students. It includes tasks such as encoding words into Piglatin, displaying patterns based on user input, checking for special and palindrome words, counting character occurrences, and manipulating strings in various ways. Each task provides sample inputs and expected outputs to guide the implementation.

Uploaded by

dioxotwitch
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Class10_string programs

The document outlines a series of programming tasks focused on string handling for Class 10 students. It includes tasks such as encoding words into Piglatin, displaying patterns based on user input, checking for special and palindrome words, counting character occurrences, and manipulating strings in various ways. Each task provides sample inputs and expected outputs to guide the implementation.

Uploaded by

dioxotwitch
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CLASS 10 PROGRAMS – STRING HANDLING

1. Write a program that encodes a word into Piglatin. To translate word into Piglatin
word, convert the word into uppercase and then place the first vowel of the original
word as the start of the new word along with the remaining alphabets. The alphabets
present before the vowel being shifted towards the end followed by "AY".

Sample Input 1: London


Output: ONDONLAY

Sample Input 2: Olympics


Output: OLYMPICSAY

2.Write a program to accept a word (say, BLUEJ) and display the pattern:

BLUEJ ABCDE A
LUEJ BCDE BC
UEJ CDE DEF
EJ DE GHIJ
J E KLMNO
BBBBB J A
L LLL EE aa
UUU UUU BBB
EE LLLL c c cc
J BBBBB D D DDD

3. Special words are those words which start and end with the same letter.
Example: EXISTENCE, COMIC, WINDOW
Palindrome words are those words which read the same from left to right and vice-
versa.
Example: MALYALAM, MADAM, LEVEL, ROTATOR, CIVIC
All palindromes are special words but all special words are not palindromes.

Write a program to accept a word. Check and display whether the word is a palindrome
or only a special word or none of them.

4. Write a Java program to display the pattern of the string entered by user. There are
two choices F and L. If user choose F, then first character of each word display. But if
user choose L, then last character of each word display.

Sample Input : HELLO WONDERS WORLD

Output : Choose F Choose L

F:HWW L:OSD
5. Write a Java program which entered a string by user and count the occurrence of
number of characters present in the string.
e.g. Input String HELLO
Output
The character E has occurred for 1 time
The character H has occurred for 1 time
The character L has occurred for 2 times
The character O has occurred for 1 times

6. Write a Java program which entered a string by user and count the occurrence of
number of words present in the string.
e.g. Input String: THE FOX IS JUMPING ON THE WALL.
Output
Occurrence of THE :2

7. A student appearing for the ICSE/ISC examination will be given an index number,
which is of the following format: Number of 7 digits/number of 3 digits. The first digit
represents ICSE(1) or ISC(2), the next two digits represent the year, the next four digits
represent the centre number, the last 3 digits represent the index number.
Example: 1244311/204
Class: 10
Year: 24
Centre number: 4311
Index number: 204
Example : 2259856/107
Class: 12 Year: 25
Centre number: 9856
Index number:107
Define a class to accept the student index number as a String and print his/her details as
above.
8. Write a program to accept a string. Convert the string to uppercase. Count and
output the number of double letter sequences that exist in the string.
e.g. Input: Aarav will buy a ball and bat tomorrow
Output: 4

9. Write a Java program to read two strings append them together and return the result.
If the strings are different lengths, remove characters from the beginning of longer
string and make them equal length.
[Hint If two strings are: “Arihant”, “Publications”, then output would be:
“Arihantcations”

10. Write a program to assign a full path and file name as given below. Using library
functions, extract and output the file path, file name and file extension separately as
shown.
Input
C:\Users\admin\Pictures\flower.jpg
Output
Path: C:\Users\admin\Pictures\
File name: flower
Extension: jpg

11. Write a program to input a sentence and print the number of characters found in the
longest word of the given sentence
Eg: India is my country
Length of longest word=7

12. Write a program to input a word & print the new word after removing all the
repeated alphabets
* sample i/p: applications
* sample o/p: aplictons

13. A computer typist has the habit of deleting the middle name 'kumar' while entering
the names containing three words,write a program to enter a name contaning three
words and display the new name after deleting middle name 'kumar'.
sample input : Ashish Kumar Nehra
Sample o/p: Ashish Nehra

15. A non-palindrome word can be made a palindrome word just by adding the reverse
of the word to the original word. Write a program to accept a non-palindrome word and
display the new word after making it a palindrome.
Sample Input : ICSE
Sample Output : The new word making it palindrome as: ICSEESCI

16. A string is said to be ‘Unique’ if none of the letters present in the string are
repeated. Write a program to accept a string and check whether the string is Unique or
not. The program displays a message accordingly.
Sample Input: COMPUTER
Sample Output: Unique String

17. Two strings are considered anagrams if they have the same characters with the
same frequency, but the order of the characters is different. Write a program to accept a
string and check whether the string is Anagram or not
Example:
"listen" and "silent" are anagrams because you can rearrange the letters in "listen" to
form "silent".

18. Write a program to accept a string. Display the new string after reversing each
character of the word.
Input: New Delhi is the capital of India
Output: weN ihleD si eht latipac fo aidn

19. Write a program to input a sentence and display only those words which begin and
end with the same alphabet.

20. Write a program to input a sentence and display only those words which begin and
end with the vowels.
21.Write a program that accepts a line of text.Find and print the word containing the
maximum number of vowels.
Sample Input : Education is a progressive discovery of our own ignorance.
Output :Education.

You might also like