ICSE CLASS X PRACTICAL FILE
Computer Applications (Subject Code: 86)
PROGRAMS BASED ON STRINGS AND
ARRAYS IN JAVA
Student’s Full Name:
Class & Section: X -
Roll Number:
School Name:
Academic Year: 2026 - 2027
Clean • Structured • Examiner-Friendly
1 PROGRAM 1: String Palindrome & Frequency Analyzer
1.2 PROGRAM DESCRIPTION
Variable Name Data Type Purpose
str String Stores the user’s input string
rev String Stores the reversed version of the string
v int Counts the number of vowels
c int Counts the number of consonants
freq int[] Stores ASCII frequencies of characters
1.4 JAVA CODE
1 import [Link]. Scanner ;
2
3 public class PalindromeFreq {
4 public static void main( String [] args) {
5 Scanner in = new Scanner ( System .in);
6 System .[Link] ("Enter string : ");
7 String str = in. nextLine ();
8
9 String rev = "";
10 int v = 0, c = 0;
11 int [] freq = new int [256];
12
13 for (int i = str. length () - 1; i >= 0; i--) {
14 char ch = str. charAt (i);
15 rev += ch;
16 freq[ch ]++;
17
18 char lh = Character . toLowerCase (ch);
19 if (lh >= 'a' && lh <= 'z') {
1
20 if (lh == 'a' || lh == 'e' || lh == 'i' || lh == 'o' || lh == 'u
') v++;
21 else c++;
22 }
23 }
24
25 System .out. println (" Palindrome : " + str. equalsIgnoreCase (rev));
26 System .out. println (" Vowels : " + v + " | Consonants : " + c);
27 System .out. println (" Character Frequencies :");
28 for (int i = 0; i < 256; i++) {
29 if (freq[i] > 0 && i != ' ') {
30 System .out. println (" " + (char)i + ": " + freq[i]);
31 }
32 }
33 [Link] ();
34 }
35 }
1.5 INPUT / OUTPUT
Enter string: madam
Palindrome: true
Vowels: 2 | Consonants: 3
Character Frequencies:
a: 2
d: 1
m: 2
2
2 PROGRAM 2: Sentence Statistics & Word Processor
2.2 PROGRAM DESCRIPTION
Variable Name Data Type Purpose
sen String Stores the input sentence
words String[] Stores individual words split by spaces
longest String Tracks the longest word
shortest String Tracks the shortest word
tc String Stores the Title Case converted output
2.4 JAVA CODE
1 import [Link]. Scanner ;
2
3 public class SentenceProcessor {
4 public static void main( String [] args) {
5 Scanner in = new Scanner ( System .in);
6 System .[Link] ("Enter sentence : ");
7 String sen = in. nextLine ().trim ();
8
9 String [] words = sen. split ("\\s+");
10 String longest = words [0] , shortest = words [0];
11 String tc = "";
12
13 for ( String w : words) {
14 if (w. length () > longest . length ()) longest = w;
15 if (w. length () < shortest . length ()) shortest = w;
16
17 tc += Character . toUpperCase (w. charAt (0)) + w. substring (1).
toLowerCase () + " ";
18 }
19
20 System .out. println (" Total Words : " + words . length );
3
21 System .out. println (" Longest Word: " + longest );
22 System .out. println (" Shortest Word: " + shortest );
23 System .out. println (" Title Case: " + [Link] ());
24 [Link] ();
25 }
26 }
2.5 INPUT / OUTPUT
Enter sentence: java is fun
Total Words: 3
Longest Word: java
Shortest Word: is
Title Case: Java Is Fun
4
3 PROGRAM 3: Student Marks Management System
3.2 PROGRAM DESCRIPTION
Variable Name Data Type Purpose
m int[] Stores marks of 10 students
max int Stores the highest marks
min int Stores the lowest marks
search int Target value to search for in the array
found boolean Search flag indicator
3.4 JAVA CODE
1 import [Link]. Scanner ;
2
3 public class MarksSystem {
4 public static void main( String [] args) {
5 Scanner in = new Scanner ( System .in);
6 int [] m = new int [10];
7 int sum = 0, max = 0, min = 100;
8
9 System .out. println (" Enter 10 marks :");
10 for (int i = 0; i < 10; i++) {
11 m[i] = in. nextInt ();
12 sum += m[i];
13 if (m[i] > max) max = m[i];
14 if (m[i] < min) min = m[i];
15 }
16
17 // Bubble Sort
18 for (int i = 0; i < 9; i++) {
19 for (int j = 0; j < 9 - i; j++) {
20 if (m[j] > m[j+1]) {
21 int temp = m[j];
5
22 m[j] = m[j+1];
23 m[j+1] = temp;
24 }
25 }
26 }
27
28 System .[Link]("Enter mark to search : ");
29 int search = in. nextInt ();
30 boolean found = false ;
31 for (int mark : m) {
32 if (mark == search ) { found = true; break ; }
33 }
34
35 System .out. println (" Average : " + (sum / 10.0) + " | Max: " + max + " |
Min: " + min);
36 System .out. println (" Search Found : " + found);
37 System .[Link](" Sorted Marks : ");
38 for (int mark : m) System .[Link](mark + " ");
39 [Link] ();
40 }
41 }
3.5 INPUT / OUTPUT
Enter 10 marks:
90 40 75 80 55 60 95 65 70 85
Enter mark to search: 55
Average: 71.5 | Max: 95 | Min: 40
Search Found: true
Sorted Marks: 40 55 60 65 70 75 80 85 90 95
6
4 PROGRAM 4: Matrix Operations Suite (3×3)
4.2 PROGRAM DESCRIPTION
Variable Name Data Type Purpose
A int[][] First 3x3 2D matrix
B int[][] Second 3x3 2D matrix
sum int[][] Stores matrix addition result
pDiag int Sum of main diagonal elements
sym boolean Symmetry check flag status
4.4 JAVA CODE
1 import [Link]. Scanner ;
2
3 public class MatrixSuite {
4 public static void main( String [] args) {
5 Scanner in = new Scanner ( System .in);
6 int [][] A = new int [3][3];
7 int [][] B = new int [3][3];
8 int [][] sum = new int [3][3];
9 int pDiag = 0;
10 boolean sym = true;
11
12 System .out. println (" Enter 3x3 Matrix A:");
13 for (int i = 0; i < 3; i++)
14 for (int j = 0; j < 3; j++)
15 A[i][j] = in. nextInt ();
16
17 System .out. println (" Enter 3x3 Matrix B:");
18 for (int i = 0; i < 3; i++)
19 for (int j = 0; j < 3; j++) {
20 B[i][j] = in. nextInt ();
21 sum[i][j] = A[i][j] + B[i][j];
22 }
7
23
24 for (int i = 0; i < 3; i++) {
25 pDiag += A[i][i];
26 for (int j = 0; j < 3; j++) {
27 if (A[i][j] != A[j][i]) sym = false ;
28 }
29 }
30
31 System .out. println (" Diagonal Sum: " + pDiag);
32 System .out. println (" Matrix A Symmetric : " + sym);
33 System .out. println ("Sum Matrix :");
34 for (int i = 0; i < 3; i++) {
35 for (int j = 0; j < 3; j++) System .[Link](sum[i][j] + "\t");
36 System .out. println ();
37 }
38 [Link] ();
39 }
40 }
4.5 INPUT / OUTPUT
Enter 3x3 Matrix A:
100
010
001
Enter 3x3 Matrix B:
123
456
789
Diagonal Sum: 3
Matrix A Symmetric: true
Sum Matrix:
2 2 3
4 6 6
7 8 10
8
5 PROGRAM 5: Student Directory Management System
5.2 PROGRAM DESCRIPTION
Variable Name Data Type Purpose
names String[] Array of size 10 to store names
key String Store query name to search
pos int Index position of target name
vCount int Counts names starting with a vowel letter
5.4 JAVA CODE
1 import [Link]. Scanner ;
2
3 public class DirectorySystem {
4 public static void main( String [] args) {
5 Scanner in = new Scanner ( System .in);
6 String [] names = new String [10];
7 int vCount = 0, pos = -1;
8
9 System .out. println (" Enter 10 names :");
10 for (int i = 0; i < 10; i++) {
11 names [i] = in. nextLine ().trim ();
12 char f = Character . toLowerCase (names [i]. charAt (0));
13 if (f == 'a' || f == 'e' || f == 'i' || f == 'o' || f == 'u') vCount
++;
14 }
15
16 // String Sort
17 for (int i = 0; i < 9; i++) {
18 for (int j = 0; j < 9 - i; j++) {
19 if (names[j]. compareToIgnoreCase ( names[j+1]) > 0) {
20 String temp = names[j];
21 names[j] = names[j+1];
22 names[j+1] = temp;
9
23 }
24 }
25 }
26
27 System .[Link]("Enter name to search : ");
28 String key = in. nextLine ().trim ();
29 for (int i = 0; i < 10; i++) {
30 if (names[i]. equalsIgnoreCase (key)) { pos = i + 1; break ; }
31 }
32
33 System .out. println (" Starts with Vowel : " + vCount );
34 System .out. println (" Search Position ( Sorted ): " + (pos == -1 ? "Not
Found " : pos));
35 System .out. println (" Sorted Directory :");
36 for ( String name : names) System .out. println (" " + name);
37 [Link] ();
38 }
39 }
5.5 INPUT / OUTPUT
Enter 10 names:
Kabir Rohit Aarav Yash Ethan Diya Ishaan Ananya Meera Olivia
Enter name to search: Rohit
Starts with Vowel: 5
Search Position (Sorted): 8
Sorted Directory:
Aarav
Ananya
Diya
Ethan
Ishaan
Kabir
Meera
Rohit
Olivia
Yash
10