ICSE 2026 Computer Applications Prediction Paper ICSE Board Exam Class 10 Java Programs Question Paper Free Download Board Exam Preparation ICSE Computer Programming

ICSE Computer Applications 2026 Prediction Paper — Free Download with Java Programs & Solutions

T

Tushar Parik

Author

Updated 14 March 2026
23 min read

Your ICSE Computer Applications 2026 exam is on 18 March 2026.

This high-probability prediction paper covers every important topic, complete with answers and explanations. Scroll down to practice, or download the free PDF.

Why This Prediction Paper?

At Bright Tutorials, our expert teachers have analyzed 10+ years of ICSE Computer Applications board exam patterns to identify the most frequently tested topics, question styles, and mark distributions. This prediction paper is designed to:

  • Maximize your score — every question targets high-probability topics
  • Build exam confidence — practice under real exam conditions
  • Save revision time — focus on what actually matters for 18 March 2026
  • Provide complete solutions — detailed answers with step-by-step explanations

Download the complete paper as a formatted PDF — print it and practice!

Download PDF


ICSE CLASS X - COMPUTER APPLICATIONS

HIGH-PROBABILITY PREDICTION PAPER FOR 18 MARCH 2026

Maximum Marks: 100 Time allowed: Two hours

Answers to this Paper must be written on the paper provided separately. You will not be allowed to write during the first 15 minutes. This time is to be spent in reading the question paper. The time given at the head of this Paper is the time allowed for writing the answers.

Section A is compulsory. Attempt any four questions from Section B. The intended marks for questions or parts of questions are given in brackets [ ].


SECTION A (40 Marks)

Attempt all questions from this Section.


Question 1

Choose the correct answers to the questions from the given options. [20]

(i) What is the output of the following code?

int a = 5, b = 10;
System.out.println(a++ + ++b);
  • (a) 15
  • (b) 16
  • (c) 17
  • (d) 18

(ii) Which of the following is NOT a primitive data type in Java?

  • (a) int
  • (b) float
  • (c) String
  • (d) boolean

(iii) Assertion (A): A constructor has no return type, not even void. Reason (R): A constructor is automatically invoked when an object of the class is created.

  • (a) Both A and R are true, and R is the correct explanation of A
  • (b) Both A and R are true, but R is not the correct explanation of A
  • (c) A is true, but R is false
  • (d) A is false, but R is true

(iv) What is the output of the following code?

String s = "COMPUTER";
System.out.println(s.substring(3, 6));
  • (a) MPU
  • (b) PUT
  • (c) MPUT
  • (d) PUTE

(v) Which of the following methods of the Math class returns a double value?

  • (a) Math.abs(-5)
  • (b) Math.max(3, 7)
  • (c) Math.ceil(4.2)
  • (d) Math.round(4.7)

(vi) What is the output of the following code?

int x = 15;
System.out.println(x > 10 ? x * 2 : x + 2);
  • (a) 17
  • (b) 30
  • (c) 12
  • (d) 15

(vii) Which access specifier allows access only within the same class?

  • (a) public
  • (b) protected
  • (c) private
  • (d) default

(viii) Identify the error in the following code:

switch(x)
{
    case 1:
        System.out.println("One");
    case 2.5:
        System.out.println("Two point five");
        break;
}
  • (a) Missing break after case 1
  • (b) case label 2.5 is not valid (must be an integer or character)
  • (c) Missing default case
  • (d) switch cannot take variable x

(ix) What is the output of the following code?

int arr[] = {2, 4, 6, 8, 10};
System.out.println(arr[2] + arr[4]);
  • (a) 10
  • (b) 16
  • (c) 12
  • (d) 14

(x) Which of the following represents the concept of method overloading?

  • (a) Two methods with the same name and same parameter list
  • (b) Two methods with the same name but different parameter lists
  • (c) A subclass method overriding a superclass method
  • (d) A method calling itself recursively

(xi) Assertion (A): The == operator compares the content of two String objects. Reason (R): The equals() method compares the reference of two String objects.

  • (a) Both A and R are true, and R is the correct explanation of A
  • (b) Both A and R are true, but R is not the correct explanation of A
  • (c) A is true, but R is false
  • (d) Both A and R are false

(xii) What is the output of the following code?

String s = "hello world";
System.out.println(s.indexOf('o') + " " + s.lastIndexOf('o'));
  • (a) 4 4
  • (b) 4 7
  • (c) 5 8
  • (d) 4 6

(xiii) Which of the following is the correct way to create an object of class Student?

  • (a) Student s = Student();
  • (b) Student s = new Student();
  • (c) new Student s = Student();
  • (d) Student s = new Student;

(xiv) What is the return type of the compareTo() method in the String class?

  • (a) boolean
  • (b) String
  • (c) int
  • (d) char

(xv) What is the output of the following code?

int i;
for(i = 1; i <= 5; i += 2)
    System.out.print(i + " ");
System.out.println(i);
  • (a) 1 3 5 6
  • (b) 1 3 5 7
  • (c) 1 3 5
  • (d) 1 2 3 4 5

(xvi) Which of the following keywords is used to refer to the current object?

  • (a) super
  • (b) static
  • (c) this
  • (d) new

(xvii) Identify the error in the following code:

int[] a = new int(5);
  • (a) Array size should be in square brackets, not parentheses
  • (b) int[] is not a valid declaration
  • (c) Array name a is invalid
  • (d) There is no error

(xviii) What is the value of Math.floor(-3.7)?

  • (a) -3.0
  • (b) -4.0
  • (c) -3
  • (d) 4.0

(xix) What is the output of the following code?

char ch = 'A';
int n = ch + 5;
System.out.println((char)n);
  • (a) 70
  • (b) F
  • (c) E
  • (d) 69

(xx) Which of the following is an example of an impure function?

  • (a) A function that returns the sum of two parameters
  • (b) A function that modifies a class variable
  • (c) A function that returns the square of a number
  • (d) A function that returns Math.max() of two numbers

Question 2

(i) State the output of the following code: [2]

String s = "Bright Tutorials";
System.out.println(s.length());
System.out.println(s.charAt(7));
System.out.println(s.toUpperCase());
System.out.println(s.substring(7).trim());

(ii) State the output of the following code: [2]

int x = 1;
for(int i = 1; i <= 4; i++)
{
    x = x * i;
    if(x > 5)
        break;
    System.out.print(x + " ");
}
System.out.println(x);

(iii) Write a Java expression for: [2]

  • (a) ( \sqrt{a^2 + b^2} )
  • (b) ( \frac{-b + \sqrt{b^2 - 4ac}}{2a} )

(iv) State the output of the following code: [2]

int a = 20, b = 15;
a += b++;
b -= --a;
System.out.println("a = " + a + " b = " + b);

(v) Differentiate between: [2]

  • (a) break statement and continue statement (one point of difference)
  • (b) Actual parameters and Formal parameters (one point of difference)

(vi) Identify the errors in the following code and write the corrected code: [2]

class Sum
{
    public static void main(String args[])
    {
        int a = 10 b = 20;
        int sum;
        Sum = a + b;
        System.out.println("Sum = " + Sum);
    }
}

(vii) Convert the following if-else statement to an equivalent switch-case statement: [2]

if(day == 1)
    System.out.println("Monday");
else if(day == 2)
    System.out.println("Tuesday");
else if(day == 3)
    System.out.println("Wednesday");
else
    System.out.println("Other day");

(viii) Name the Java method/function to: [2]

  • (a) Check if a string starts with a particular prefix.
  • (b) Remove leading and trailing spaces from a string.
  • (c) Return the character at a specific index in a string.
  • (d) Convert a number to its String representation.

(ix) State the output of the following code: [2]

int m = 2, n = 15;
for(int i = 1; i <= 5; i++)
{
    if(n % i == 0)
        m = m + i;
}
System.out.println("m = " + m);

(x) Convert the following for loop to an equivalent while loop: [2]

for(int i = 10; i >= 1; i--)
{
    if(i % 3 == 0)
        System.out.print(i + " ");
}

SECTION B (60 Marks)

Attempt any four questions from this Section.


Question 3

Design a class PrimeComposite with the following description: [15]

Data members/instance variables: - int n — to store the number - int count — to store the count of factors

Member methods: - PrimeComposite(int num) — parameterized constructor to initialize n with num and count with 0 - void findFactors() — counts the number of factors of n (including 1 and n) and stores in count - void checkNumber() — checks and displays whether the number is Prime, Composite, or Neither (1 is neither prime nor composite) - void display() — displays the number, its factors on one line separated by commas, and whether it is Prime / Composite / Neither

Write the main method to create an object with a number input by the user and invoke the methods.

Sample Input: Enter a number: 28 Sample Output:

Number: 28
Factors: 1, 2, 4, 7, 14, 28
Type: Composite

Sample Input: Enter a number: 13 Sample Output:

Number: 13
Factors: 1, 13
Type: Prime

Question 4

Write a program to input a sentence and perform the following operations: [15]

  • (a) Count and display the number of words in the sentence.
  • (b) Convert the first letter of each word to uppercase and the remaining letters to lowercase.
  • (c) Display the modified sentence.
  • (d) Display the longest word in the sentence.

Sample Input: Enter a sentence: jAVA is A powerful PROGRAMMING language Sample Output:

Number of words: 6
Modified sentence: Java Is A Powerful Programming Language
Longest word: Programming

Question 5

Write a menu-driven program to perform the following operations using switch-case: [15]

(a) Automorphic Number — A number whose square ends with the number itself. Example: 25 is Automorphic because 25² = 625, which ends with 25.

(b) Niven (Harshad) Number — A number that is divisible by the sum of its digits. Example: 18 is a Niven number because 1 + 8 = 9 and 18 is divisible by 9.

For each option, input a number and check whether it satisfies the property. Display an appropriate message.

Sample Input/Output:

Menu:
1. Automorphic Number
2. Niven Number
Enter your choice: 1
Enter a number: 76
76 is an Automorphic Number (76^2 = 5776)

Menu:
1. Automorphic Number
2. Niven Number
Enter your choice: 2
Enter a number: 21
21 is a Niven Number (2 + 1 = 3, 21 / 3 = 7)

Question 6

Write a program to input 10 names into a single-dimensional String array. Sort the names in alphabetical order using Bubble Sort technique. Display the sorted array. [15]

Also, input a name to search and use Linear Search to check if the name exists in the sorted array. Display appropriate messages.

Sample Input:

Enter 10 names:
Rahul
Priya
Ankit
Zara
Meena
Dev
Kavya
Sahil
Isha
Bharat

Sample Output:

Sorted names:
Ankit
Bharat
Dev
Isha
Kavya
Meena
Priya
Rahul
Sahil
Zara

Enter name to search: Kavya
Kavya found at position 5

Question 7

Write a program to accept a 4x4 matrix of integers. Perform the following operations and display the results: [15]

  • (a) Display the original matrix in matrix form.
  • (b) Find and display the sum of each row.
  • (c) Find and display the sum of the left diagonal elements.
  • (d) Display the transpose of the matrix.

Sample Input:

Enter elements of 4x4 matrix:
2  5  3  1
7  4  8  6
1  9  2  5
3  6  7  4

Sample Output:

Original Matrix:
2  5  3  1
7  4  8  6
1  9  2  5
3  6  7  4

Sum of row 1 = 11
Sum of row 2 = 25
Sum of row 3 = 17
Sum of row 4 = 20

Sum of left diagonal = 2 + 4 + 2 + 4 = 12

Transpose of Matrix:
2  7  1  3
5  4  9  6
3  8  2  7
1  6  5  4

Question 8

Design a class StringMaster with the following description: [15]

Data members/instance variables: - String str — to store the string - int wc — to store the word count

Member methods: - StringMaster() — default constructor to initialize str to "" and wc to 0 - StringMaster(String s) — parameterized constructor to initialize str with s and wc to 0 - void countWords() — counts the number of words in str and stores in wc - String pigLatinWord(String word) — converts a single word to Pig Latin form: - If the word begins with a vowel, add "AY" at the end. Example: "ORANGE" becomes "ORANGEAY" - If the word begins with a consonant, move the first letter to the end and add "AY". Example: "COMPUTER" becomes "OMPUTERCAY" - void display() — displays the original string, word count, and each word converted to Pig Latin on a new line

Write the main method to create an object with a sentence entered by the user and invoke the methods.

Sample Input: Enter a sentence: BRIGHT IS AMAZING Sample Output:

Original String: BRIGHT IS AMAZING
Word Count: 3
Pig Latin form:
RIGHTBAY
ISAY
AMAZINGAY

ANSWER KEY & EXPLANATIONS


SECTION A ANSWERS

Question 1 (MCQ Answers)

Q Answer Explanation
(i) (b) 16 a++ uses a=5 first (post-increment), ++b makes b=11 first (pre-increment). So 5 + 11 = 16. After expression, a becomes 6.
(ii) (c) String String is a class (reference type), not a primitive data type. The 8 primitive types are: byte, short, int, long, float, double, char, boolean.
(iii) (b) Both true, R is not the correct explanation A is true (constructors have no return type). R is also true (constructors are invoked on object creation). But R does not explain why constructors have no return type — that is a language design rule.
(iv) (b) PUT substring(3, 6) extracts characters from index 3 to 5 (6 is exclusive). "COMPUTER" → index 3='P', 4='U', 5='T' → "PUT".
(v) (c) Math.ceil(4.2) Math.ceil() always returns a double value. Math.ceil(4.2) returns 5.0. Math.abs(-5) returns int, Math.max(3,7) returns int, Math.round(4.7) returns long.
(vi) (b) 30 15 > 10 is true, so the ternary operator evaluates x * 2 = 15 * 2 = 30.
(vii) (c) private private members are accessible only within the same class.
(viii) (b) case label 2.5 is not valid In a switch-case, the case labels must be integer constants, characters, or Strings — not floating-point values like 2.5.
(ix) (b) 16 arr[2] = 6, arr[4] = 10. So 6 + 10 = 16.
(x) (b) Two methods with the same name but different parameter lists Method overloading means same method name with different number or types of parameters within the same class.
(xi) (d) Both A and R are false == compares references (not content) of String objects. equals() compares content (not references). Both statements are false.
(xii) (b) 4 7 In "hello world", first 'o' is at index 4 ("hello"). Last 'o' is at index 7 ("hello world").
(xiii) (b) Student s = new Student(); The new keyword followed by the constructor call is the correct way to create an object in Java.
(xiv) (c) int compareTo() returns an integer: 0 if equal, positive if greater, negative if lesser.
(xv) (b) 1 3 5 7 Loop: i=1 (print 1), i=3 (print 3), i=5 (print 5), i=7 (loop ends since 7>5). After loop, i=7 is printed by the last println.
(xvi) (c) this The this keyword refers to the current object of the class.
(xvii) (a) Array size should be in square brackets Correct syntax: int[] a = new int[5]; — square brackets, not parentheses.
(xviii) (b) -4.0 Math.floor() returns the largest double value less than or equal to the argument. floor(-3.7) = -4.0.
(xix) (b) F 'A' has ASCII value 65. 65 + 5 = 70. (char)70 is 'F'.
(xx) (b) A function that modifies a class variable An impure function changes the state of the object (modifies instance/class variables) or has side effects.

Question 2 Answers

(i) String operations output: [2]

17
T
BRIGHT TUTORIALS
Tutorials

Explanation: - s.length() = 17 (including the space) - s.charAt(7) = 'T' (index 7 in "Bright Tutorials" is 'T') - s.toUpperCase() = "BRIGHT TUTORIALS" - s.substring(7) = "Tutorials", .trim() has no leading/trailing spaces to remove, so result is "Tutorials"

(ii) Loop with break output: [2]

1 1 2 6

Explanation: - i=1: x = 11 = 1, 1 <= 5, print "1 " - i=2: x = 12 = 2, 2 <= 5, print "2 " → Wait, let me re-trace: - Wait: After i=1: x = 11 = 1. Print "1 ". Then i=2: x = 12 = 2. Print "2 ". Then i=3: x = 2*3 = 6. 6 > 5 → break. Print 6.

Corrected output:

1 2 6

(iii) Java expressions: [2]

  • (a) Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)) or Math.sqrt(a*a + b*b)
  • (b) (-b + Math.sqrt(b*b - 4*a*c)) / (2*a) or (-b + Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a)

(iv) Compound assignment output: [2]

Step-by-step: - Initial: a = 20, b = 15 - a += b++ → a = 20 + 15 = 35, then b becomes 16 - b -= --a → a becomes 34 (pre-decrement), then b = 16 - 34 = -18

a = 34 b = -18

(v) Differences: [2]

  • (a) break vs continue:
  • break terminates the loop entirely and transfers control to the statement after the loop.
  • continue skips the remaining statements in the current iteration and proceeds to the next iteration of the loop.

  • (b) Actual vs Formal parameters:

  • Actual parameters are the values/variables passed to a method during the method call.
  • Formal parameters are the variables declared in the method definition/signature that receive the values.

(vi) Corrected code: [2]

Errors: 1. Missing comma between variable declarations: int a = 10 b = 20; should be int a = 10, b = 20; 2. Variable name mismatch: Sum (uppercase) should be sum (lowercase) — Java is case-sensitive.

class Sum
{
    public static void main(String args[])
    {
        int a = 10, b = 20;
        int sum;
        sum = a + b;
        System.out.println("Sum = " + sum);
    }
}

(vii) Equivalent switch-case: [2]

switch(day)
{
    case 1:
        System.out.println("Monday");
        break;
    case 2:
        System.out.println("Tuesday");
        break;
    case 3:
        System.out.println("Wednesday");
        break;
    default:
        System.out.println("Other day");
}

(viii) Java methods: [2]

  • (a) startsWith()
  • (b) trim()
  • (c) charAt()
  • (d) String.valueOf() or Integer.toString()

(ix) Loop output: [2]

Factors of 15 from 1 to 5: 15 % 1 == 0 (yes), 15 % 2 == 0 (no), 15 % 3 == 0 (yes), 15 % 4 == 0 (no), 15 % 5 == 0 (yes)

  • m starts at 2
  • i=1: 15 % 1 == 0 → m = 2 + 1 = 3
  • i=2: 15 % 2 != 0 → no change
  • i=3: 15 % 3 == 0 → m = 3 + 3 = 6
  • i=4: 15 % 4 != 0 → no change
  • i=5: 15 % 5 == 0 → m = 6 + 5 = 11
m = 11

(x) Equivalent while loop: [2]

int i = 10;
while(i >= 1)
{
    if(i % 3 == 0)
        System.out.print(i + " ");
    i--;
}

SECTION B ANSWERS

Question 3 — PrimeComposite Class

import java.util.Scanner;

class PrimeComposite
{
    int n;
    int count;

    PrimeComposite(int num)
    {
        n = num;
        count = 0;
    }

    void findFactors()
    {
        count = 0;
        for(int i = 1; i <= n; i++)
        {
            if(n % i == 0)
                count++;
        }
    }

    void checkNumber()
    {
        if(n == 1)
            System.out.println("Type: Neither");
        else if(count == 2)
            System.out.println("Type: Prime");
        else
            System.out.println("Type: Composite");
    }

    void display()
    {
        System.out.println("Number: " + n);
        System.out.print("Factors: ");
        for(int i = 1; i <= n; i++)
        {
            if(n % i == 0)
            {
                if(i == n)
                    System.out.print(i);
                else
                    System.out.print(i + ", ");
            }
        }
        System.out.println();
        checkNumber();
    }

    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int num = sc.nextInt();
        PrimeComposite obj = new PrimeComposite(num);
        obj.findFactors();
        obj.display();
    }
}

Question 4 — Sentence Processing

import java.util.Scanner;

class SentenceProcessor
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a sentence: ");
        String sen = sc.nextLine().trim();

        // Count words
        int wordCount = 0;
        String temp = sen;
        while(temp.length() > 0)
        {
            int spaceIdx = temp.indexOf(' ');
            if(spaceIdx == -1)
            {
                wordCount++;
                break;
            }
            else
            {
                wordCount++;
                temp = temp.substring(spaceIdx + 1).trim();
            }
        }
        System.out.println("Number of words: " + wordCount);

        // Convert to title case and find longest word
        String modified = "";
        String longest = "";
        String remaining = sen;

        while(remaining.length() > 0)
        {
            int sp = remaining.indexOf(' ');
            String word;
            if(sp == -1)
            {
                word = remaining;
                remaining = "";
            }
            else
            {
                word = remaining.substring(0, sp);
                remaining = remaining.substring(sp + 1).trim();
            }

            // Title case
            String converted = Character.toUpperCase(word.charAt(0))
                + word.substring(1).toLowerCase();
            if(modified.length() == 0)
                modified = converted;
            else
                modified = modified + " " + converted;

            // Longest word
            if(word.length() > longest.length())
                longest = converted;
        }

        System.out.println("Modified sentence: " + modified);
        System.out.println("Longest word: " + longest);
    }
}

Question 5 — Menu-Driven (Automorphic / Niven)

import java.util.Scanner;

class SpecialNumbers
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Menu:");
        System.out.println("1. Automorphic Number");
        System.out.println("2. Niven Number");
        System.out.print("Enter your choice: ");
        int choice = sc.nextInt();

        switch(choice)
        {
            case 1:
                System.out.print("Enter a number: ");
                int n = sc.nextInt();
                int sq = n * n;
                int temp = n;
                int digits = 0;
                while(temp > 0)
                {
                    digits++;
                    temp = temp / 10;
                }
                int lastDigits = sq % (int)Math.pow(10, digits);
                if(lastDigits == n)
                    System.out.println(n + " is an Automorphic Number ("
                        + n + "^2 = " + sq + ")");
                else
                    System.out.println(n + " is NOT an Automorphic Number ("
                        + n + "^2 = " + sq + ")");
                break;

            case 2:
                System.out.print("Enter a number: ");
                int num = sc.nextInt();
                int sum = 0;
                int t = num;
                while(t > 0)
                {
                    sum += t % 10;
                    t = t / 10;
                }
                if(num % sum == 0)
                    System.out.println(num + " is a Niven Number ("
                        + "sum of digits = " + sum + ", "
                        + num + " / " + sum + " = " + (num / sum) + ")");
                else
                    System.out.println(num + " is NOT a Niven Number ("
                        + "sum of digits = " + sum + ")");
                break;

            default:
                System.out.println("Invalid choice");
        }
    }
}

Question 6 — Bubble Sort and Linear Search

import java.util.Scanner;

class NameSorter
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        String names[] = new String[10];

        System.out.println("Enter 10 names:");
        for(int i = 0; i < 10; i++)
        {
            names[i] = sc.nextLine();
        }

        // Bubble Sort (alphabetical order)
        for(int i = 0; i < 9; i++)
        {
            for(int j = 0; j < 9 - i; j++)
            {
                if(names[j].compareToIgnoreCase(names[j + 1]) > 0)
                {
                    String temp = names[j];
                    names[j] = names[j + 1];
                    names[j + 1] = temp;
                }
            }
        }

        // Display sorted array
        System.out.println("\nSorted names:");
        for(int i = 0; i < 10; i++)
        {
            System.out.println(names[i]);
        }

        // Linear Search
        System.out.print("\nEnter name to search: ");
        String search = sc.nextLine();
        int pos = -1;
        for(int i = 0; i < 10; i++)
        {
            if(names[i].equalsIgnoreCase(search))
            {
                pos = i;
                break;
            }
        }

        if(pos != -1)
            System.out.println(search + " found at position " + (pos + 1));
        else
            System.out.println(search + " not found in the list");
    }
}

Question 7 — Matrix Operations

import java.util.Scanner;

class MatrixOperations
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int mat[][] = new int[4][4];

        System.out.println("Enter elements of 4x4 matrix:");
        for(int i = 0; i < 4; i++)
        {
            for(int j = 0; j < 4; j++)
            {
                mat[i][j] = sc.nextInt();
            }
        }

        // Display original matrix
        System.out.println("\nOriginal Matrix:");
        for(int i = 0; i < 4; i++)
        {
            for(int j = 0; j < 4; j++)
            {
                System.out.print(mat[i][j] + "\t");
            }
            System.out.println();
        }

        // Sum of each row
        System.out.println();
        for(int i = 0; i < 4; i++)
        {
            int rowSum = 0;
            for(int j = 0; j < 4; j++)
            {
                rowSum += mat[i][j];
            }
            System.out.println("Sum of row " + (i + 1) + " = " + rowSum);
        }

        // Sum of left diagonal
        int diagSum = 0;
        System.out.print("\nSum of left diagonal = ");
        for(int i = 0; i < 4; i++)
        {
            diagSum += mat[i][i];
            if(i < 3)
                System.out.print(mat[i][i] + " + ");
            else
                System.out.print(mat[i][i]);
        }
        System.out.println(" = " + diagSum);

        // Transpose
        System.out.println("\nTranspose of Matrix:");
        for(int i = 0; i < 4; i++)
        {
            for(int j = 0; j < 4; j++)
            {
                System.out.print(mat[j][i] + "\t");
            }
            System.out.println();
        }
    }
}

Question 8 — StringMaster (Pig Latin)

import java.util.Scanner;

class StringMaster
{
    String str;
    int wc;

    StringMaster()
    {
        str = "";
        wc = 0;
    }

    StringMaster(String s)
    {
        str = s;
        wc = 0;
    }

    void countWords()
    {
        wc = 0;
        String temp = str.trim();
        if(temp.length() == 0)
            return;
        wc = 1;
        for(int i = 0; i < temp.length(); i++)
        {
            if(temp.charAt(i) == ' ')
                wc++;
        }
    }

    String pigLatinWord(String word)
    {
        char first = Character.toUpperCase(word.charAt(0));
        if(first == 'A' || first == 'E' || first == 'I'
            || first == 'O' || first == 'U')
        {
            return word + "AY";
        }
        else
        {
            return word.substring(1) + word.charAt(0) + "AY";
        }
    }

    void display()
    {
        System.out.println("Original String: " + str);
        System.out.println("Word Count: " + wc);
        System.out.println("Pig Latin form:");

        String remaining = str.trim();
        while(remaining.length() > 0)
        {
            int sp = remaining.indexOf(' ');
            String word;
            if(sp == -1)
            {
                word = remaining;
                remaining = "";
            }
            else
            {
                word = remaining.substring(0, sp);
                remaining = remaining.substring(sp + 1).trim();
            }
            System.out.println(pigLatinWord(word));
        }
    }

    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a sentence: ");
        String sentence = sc.nextLine();
        StringMaster obj = new StringMaster(sentence);
        obj.countWords();
        obj.display();
    }
}

TOPIC-WISE PROBABILITY ANALYSIS

Topic Probability of Appearing Marks Expected
String Handling & Manipulation ⬛⬛⬛⬛⬛ Very High 15-20 marks
Arrays (1D and 2D) ⬛⬛⬛⬛⬛ Very High 15-20 marks
Constructors & OOP Concepts ⬛⬛⬛⬛⬛ Very High 12-15 marks
Iterative Constructs (Loops) ⬛⬛⬛⬛⬛ Very High 10-15 marks
Method Overloading & Functions ⬛⬛⬛⬛ High 8-12 marks
Conditional Constructs (if-else, switch) ⬛⬛⬛⬛ High 8-10 marks
Number Programs (Special Numbers) ⬛⬛⬛⬛ High 10-15 marks
Operators & Expressions ⬛⬛⬛⬛ High 6-10 marks
Data Types & Type Casting ⬛⬛⬛ Medium 4-6 marks
Math Library Methods ⬛⬛⬛ Medium 4-6 marks
Scanner Class & Input ⬛⬛ Low 2-4 marks
Access Specifiers & Encapsulation ⬛⬛ Low 2-4 marks

KEY TOPICS TO REVISE (Highest Priority)

  1. String Methods — Practice substring(), indexOf(), charAt(), compareTo(), toUpperCase(), toLowerCase(), trim(), equals(), length(), replace(), startsWith(), endsWith(), contains(), lastIndexOf(), valueOf(). Know return types for each.
  2. Arrays — 1D array: declaration, input/output, Bubble Sort, Selection Sort, Linear Search, Binary Search. 2D array: matrix input/output, row/column sum, diagonal sum, transpose.
  3. OOP & Constructors — Default vs parameterized constructors, constructor overloading, this keyword, class design with data members and methods. Practice writing complete class definitions.
  4. Number Programs — Prime, Palindrome, Armstrong, Niven/Harshad, Automorphic, Spy, Duck, Happy, Twin Prime, Fibonacci. Know the logic for each.
  5. Loop Output Tracing — Practice tracing for, while, do-while loops step by step. Watch for break, continue, pre/post increment.
  6. Method Overloading — Writing overloaded methods with different parameter lists. Understand how Java decides which method to call.
  7. Switch-Case — Menu-driven programs, fall-through behavior, valid case label types.
  8. Operators — Precedence rules, short-circuit evaluation (&&, ||), ternary operator, type casting in expressions.
  9. Pattern Programs — Star patterns, number patterns, character patterns using nested loops.
  10. Sentence/Word Manipulation — Extracting words, counting vowels/consonants, reversing words, Pig Latin, frequency counting.

You May Also Like

Tags: ICSE 2026 Computer Applications Prediction Paper ICSE Board Exam Class 10 Java Programs Question Paper Free Download Board Exam Preparation ICSE Computer Programming

Comments

0

No comments yet. Be the first to share your thoughts!

Sign in to join the conversation and leave a comment.

Sign in to comment