ICSE Class 10 Computer Applications: Java String Programs — Important Questions with Answers 2026
Tushar Parik
Author
ICSE Class 10 Computer Applications: Java String Programs — Important Questions with Answers 2026
This comprehensive guide from Bright Tutorials covers everything you need to know — with clear explanations, exam tips, and key points for board exam preparation.
In This Article
Short Answer Questions (2-3 Marks)
- Q: Write a Java program to count vowels, consonants, digits and spaces in a string.
Ans: ```java public class StringAnalysis { public static void main(String[] args) { String s = "Hello World 123"; int v=0, c=0, d=0, sp=0; for (char ch : s.toLowerCase().toCharArray()) { if ("aeiou".indexOf(ch) >= 0) v++; else if (ch >= 'a' && ch <= 'z') c++; else if (ch >= '0' && ch <= '9') d++; else if (ch == ' ') sp++; } System.out.println("Vowels:" + v + " Consonants:" + c + " Digits:" + d + " Spaces:" + sp); } } ``` - Q: Write a program to convert a string to uppercase without using toUpperCase().
Ans: ```java public class ToUpper { public static void main(String[] args) { String s = "hello world"; String result = ""; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (ch >= 'a' && ch <= 'z') result += (char)(ch - 32); else result += ch; } System.out.println(result); // HELLO WORLD } } ``` Key: ASCII difference between lowercase and uppercase is 32. - Q: Write a program to check if two strings are anagrams.
Ans: ```java import java.util.Arrays; public class Anagram { public static void main(String[] args) { String s1 = "listen", s2 = "silent"; char[] a1 = s1.toLowerCase().toCharArray(); char[] a2 = s2.toLowerCase().toCharArray(); Arrays.sort(a1); Arrays.sort(a2); if (Arrays.equals(a1, a2)) System.out.println("Anagrams"); else System.out.println("Not anagrams"); } } ``` Logic: Two strings are anagrams if they have the same characters in same frequency.
Exam Tips for This Chapter
- Revise all definitions and laws from Java String Programs — they are commonly asked as 1-2 mark questions
- Practice diagrams related to Java String Programs — neat labelled diagrams carry 2-3 marks
- For numericals, always show formula → substitution → answer with correct units
- Previous year analysis shows Java String Programs carries 8-12 marks in the board exam
Need personalised coaching in Nashik?
Bright Tutorials offers expert coaching for ICSE, CBSE and competitive exams at Shop No. 53-57, Business Signature, Hariom Nagar, Nashik Road, Nashik.
📞 +91 94037 81999 | +91 94047 81990 | Serving Nashik Road, Deolali, Deolali Camp, CIDCO, Bhagur, Upnagar
Share this article