0% found this document useful (0 votes)
92 views5 pages

ICSE Class 10 String Coding Questions

The document contains a compilation of string coding questions for ICSE Class 10, sourced from recent board exams. It includes problem statements with examples for various tasks such as character classification, vowel detection, anagram checking, and more. Additionally, it lists key string methods that students should master for their exams.

Uploaded by

prajot
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views5 pages

ICSE Class 10 String Coding Questions

The document contains a compilation of string coding questions for ICSE Class 10, sourced from recent board exams. It includes problem statements with examples for various tasks such as character classification, vowel detection, anagram checking, and more. Additionally, it lists key string methods that students should master for their exams.

Uploaded by

prajot
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ICSE Board Exam

String Coding Questions


Class 10
Compiled from Recent Board Exams (2023 & Previous Years)

Authentic ICSE Board String Questions


1. Character Classification (ICSE 2023 - Actual Board Question)
Problem Statement:
Define a class to accept a String and print the number of digits, alphabets and special
characters in the string.

Example
Input: S = ”KAPILDEV@83”
Output:
Number of digits – 2
Number of Alphabets – 8
Number of Special characters – 1

2. Words with All Five Vowels


Problem Statement:
Write a program to input a sentence and print only those words which have all the five
vowels present in it (A, E, I, O, U).

Example
Input: ”EDUCATION IS A MUST FOR THE DEVELOPMENT OF THE
COUNTRY”
Output: EDUCATION
ICSE Class 10 - String Programming Questions Board Exam Pattern

3. Reverse Word Order in Sentence


Problem Statement:
Write a program to input a sentence and print the sentence in reverse order without
reversing each word.

Example
Input: ”He went to the market”
Output: ”market the to went He”

4. Anagram Checker
Problem Statement:
Write a program that figures out whether one string is an anagram of another string.
The program should ignore white space and punctuation.

Example
Examples:
• ”parliament” is an anagram of ”partial men”
• ”software” is an anagram of ”swear oft”

2
ICSE Class 10 - String Programming Questions Board Exam Pattern

5. City and STD Code Search


Problem Statement:
Write a program to accept the names of 10 cities in a single dimensional string array and
their STD codes in another single dimensional integer array. Search for a name of a city
input by the user. If found, display ”Search Successful” and print the name of the city
along with its STD code, or else display ”Search Unsuccessful, No such city in the list”.

6. Character Frequency Counter


Problem Statement:
Write a method void check(String str, char ch) to find and print the frequency of
a character in a string.

Example
Input: str = ”success”, ch = ’s’
Output: Number of s present is = 3

7. Display Only Vowels


Problem Statement:
Write a method void check(String s1) to display only vowels from string s1, after
converting it to lowercase.

Example
Input: s1 = ”computer”
Output: o u e

8. Overloaded Joystring Methods


Problem Statement:
Create overloaded methods for the following tasks:
a) void Joystring(String s, char ch1, char ch2)
Replaces ch1 with ch2 in string s

Example
Input: ”TECHNALAGY”, ’A’, ’O’
Output: ”TECHNOLOGY”

b) void Joystring(String s)
Prints position of first and last space

3
ICSE Class 10 - String Programming Questions Board Exam Pattern

Example
Input: ”Cloud computing means Internet based computing”
Output: First index: 5, Last index: 36

c) void Joystring(String s1, String s2)


Combines two strings with a space

Example
Input: ”COMMON WEALTH” + ”GAMES”
Output: ”COMMON WEALTH GAMES”

4
ICSE Class 10 - String Programming Questions Board Exam Pattern

9. Country Names Starting with Vowel


Problem Statement:
Write a program to store 10 different country names and their capitals in two different
Single Dimensional Arrays. Display the country names that start with a vowel along with
their capitals.

10. Names in Alphabetical Order with Phone Numbers


Problem Statement:
Write a program to store 20 different names and telephone numbers of your friends in
two different Single Dimensional Arrays. Arrange all the names in alphabetical order and
display all the names along with their respective telephone numbers using selection sort
technique.

Key String Methods to Master for ICSE Class 10


• length() – returns length of string

• charAt(int index) – returns character at index

• substring(int start, int end) – extracts substring

• toUpperCase() / toLowerCase() – case conversion

• trim() – removes leading and trailing spaces

• replace(char old, char new) – replaces characters

• equals() / equalsIgnoreCase() – string comparison

• compareTo() – lexicographic comparison

• indexOf(char ch) – finds position of character

• startsWith() / endsWith() – checks prefix/suffix

• [Link]() / isLowerCase() – character checks

• [Link]() / isLetter() – character type checks

Note: These questions represent the actual pattern and difficulty level of ICSE
Board examinations. Practice these thoroughly to excel in your board exams!

Common questions

Powered by AI

Method overloading allows defining multiple methods with the same name but different parameter lists. In string manipulation, you can create overloaded methods like Joystring(String, char, char) to replace characters, Joystring(String) to find first and last space indices, and Joystring(String, String) to concatenate strings. This demonstrates versatility in handling different operations related to strings .

Store the city names in one array and their corresponding STD codes in another. To search, iterate over the city names array and compare each element with the user's input. If found, retrieve the STD code from the same index in the STD codes array and print alongside "Search Successful". If not found, print "Search Unsuccessful, No such city in the list" .

You can achieve this by splitting the sentence into words using space as a delimiter, then reversing the array of words, and finally joining them back into a sentence with spaces between each word. For example, reversing the words in 'He went to the market' yields 'market the to went He' .

You can write a loop that traverses the string, incrementing a counter each time the target character matches the current character in the string. For example, in the string 'success', the frequency of 's' is 3 .

Convert the string to lowercase and iterate through it, checking each character with a condition that it should be one of the vowels ('a', 'e', 'i', 'o', 'u'). Print each vowel that meets this condition. For instance, from the string 'computer', the vowels 'o u e' are extracted .

These methods provide essential operations for string manipulation. length() returns the total number of characters, enabling iterations; substring(start, end) extracts specific parts of a string; replace(old, new) finds all instances of a character and swaps them. Together, these methods facilitate complex operations on strings such as truncating, parsing, or reconstructing strings efficiently .

Use the Selection Sort algorithm to arrange names in alphabetical order. During each iteration, identify the minimum element among the unsorted names and swap it with the first unsorted element, adjusting both names and the corresponding phone numbers in parallel. Continue until the entire array is sorted .

To determine the number of digits, alphabets, and special characters in a given string, you can iterate through each character of the string and categorize it using condition checks: use Character.isDigit(char) to find digits, Character.isLetter(char) for alphabets, and treat others as special characters. For example, in the string 'KAPILDEV@83', there are 2 digits, 8 alphabets, and 1 special character .

A program should split the sentence into words and check each word for the presence of all vowels by converting it to lowercase and checking if 'a', 'e', 'i', 'o', 'u' are all present using conditionals or a set intersection method. For instance, in the sentence 'EDUCATION IS A MUST FOR THE DEVELOPMENT OF THE COUNTRY', the word 'EDUCATION' contains all five vowels .

To determine if two strings are anagrams, first remove spaces and punctuation, then convert both strings to lowercase, sort the characters of each string, and finally compare the sorted strings for equality. For instance, 'parliament' is an anagram of 'partial men' after ignoring spaces and sorting the letters .

You might also like