KnowledgeBoat Logo
|
OPEN IN APP

Improvement 2025

Solved 2025 Improvement Paper ICSE Class 10 Computer Applications

Class 10 - ICSE Computer Applications Solved Question Papers



Section A

Question 1(i)

Which of the following String methods results into boolean data type?

  1. trim()
  2. equals()
  3. replace()
  4. concat()

Answer

equals()

Reason — In Java, the equals() method compares the contents of two strings and returns a boolean value (true or false), whereas trim(), replace(), and concat() return new strings, not boolean values.

Question 1(ii)

Which construct can be used to get only one of the required ice creams?

which construct can be used to get only one of the required ice creams. ICSE 2025 Computer Applications Solved Question Paper.
  1. switch construct
  2. while construct
  3. do.. while construct
  4. for construct

Answer

switch construct

Reason — The switch construct can be used to select and execute only the case that matches the required ice cream choice, skipping all other cases, which makes it suitable when only one specific ice cream needs to be selected from several options.

Question 1(iii)

Which statement is correct for the method prototype given below:

int check(char ch, String s)

  1. check() does not return any value
  2. check() has return type int
  3. check method has two actual parameters
  4. check() is a constructor

Answer

check() has return type int

Reason — In the method prototype int check(char ch, String s), the keyword int before the method name specifies that the method returns an integer value. The parameters char ch and String s are formal parameters, and the method is not a constructor as it has a return type.

Question 1(iv)

The Math method which returns int value is:

  1. round()
  2. cbrt()
  3. ceil()
  4. random()

Answer

round()

Reason — The round() method returns an int. Other methods like cbrt() and ceil() return double, while random() returns a double value between 0.0 and 1.0.

Question 1(v)

What is the output of the following statement:

“MONOPOLY”.lastIndexOf(‘O’);

  1. 1
  2. 3
  3. 2
  4. 5

Answer

5

Reason — In the string "MONOPOLY", the character 'O' occurs at indexes 1, 3, and 5 (indexing starts from 0). The lastIndexOf('O') method returns the last occurrence of 'O', which is at index 5.

Question 1(vi)

Typecasting is often necessary when dealing with financial data. Identify the correct syntax to typecast a double to an int using the variables:

int amount; double valueINR

  1. int amount = valueINR;
  2. int amount = Integer.parseInt (valueINR);
  3. int amount = (int) valueINR;
  4. int amount = int (valueINR);

Answer

int amount = (int) valueINR;

Reason — The correct syntax to typecast a double to an int in Java is by placing (int) before the double variable, which converts it to an integer by removing its decimal part.

Question 1(vii)

What is the output of the code snippet given below?

int lives = 5;
System.out.print(lives--);
System.out.print(lives);
  1. 4 3
  2. 5 4
  3. 5 3
  4. 4 4

Answer

5 4

Reason — In System.out.print(lives--), the post-decrement operator (lives--) prints the current value of lives (which is 5) first, then decreases it to 4. The next System.out.print(lives) prints the updated value 4.

Question 1(viii)

What will be the output of the following statement?

String s = "JavaProgramming";
System.out.println(s.substring(4, 11).toUpperCase());
  1. Programm
  2. PROGRAMM
  3. PROGRAM
  4. program

Answer

PROGRAM

Reason — In the string "JavaProgramming", indexing starts at 0. substring(4, 11) extracts characters from index 4 to 10, which is "Program". Calling .toUpperCase() converts it to "PROGRAM".

Question 1(ix)

Which of the following access specifiers will make a member accessible only within its own class?

  1. public
  2. private
  3. protected
  4. default

Answer

private

Reason — In Java, the private access specifier restricts a member’s visibility so it can be accessed only within the same class where it is declared.

Question 1(x)

What will be the output of the following Java method?

Character.isLetterOrDigit('\n')
  1. 1
  2. 0
  3. true
  4. false

Answer

false

Reason — The method Character.isLetterOrDigit('\n') checks whether the given character is a letter or a digit. The character '\n' represents a newline, which is neither a letter nor a digit, so the method returns false.

Question 1(xi)

Which of the following is not a type of token in Java?

1. Method3. Literal
2. Identifier4. Keyword
  1. only 1
  2. 1 and 3
  3. only 2
  4. only 4

Answer

only 1

Reason — In Java, the main types of tokens are keywords, identifiers, literals, operators, and separators. A method is not considered a token; it is a block of code that performs a task.

Question 1(xii)

The statement given below is termed as:

public void Accept(int a)

  1. Method signature
  2. Method block
  3. Method prototype
  4. Constructor

Answer

Method prototype

Reason — In Java, a method prototype specifies the method’s access specifier, return type, name, and parameter list without including its body. The statement public void Accept(int a) shows these elements but does not contain a method body, so it is a method prototype.

Question 1(xiii)

What is the output of the following Java code?

boolean flag = false; 
if (flag) { 
System.out.println("True"); 
} else { 
System.out.println("False"); 
}
  1. True
  2. False
  3. No output
  4. Compilation error

Answer

False

Reason — The code declares a boolean variable flag with the value false, checks it in the if condition, and since it evaluates to false, the if block is skipped and the else block executes, printing False to the output.

Question 1(xiv)

Identify the static method from the list given below:

  1. length()
  2. nextLine()
  3. substring(int)
  4. isLetter(char)

Answer

isLetter(char)

Reason — The method isLetter(char) belongs to the Character class and is a static method, meaning it can be called using the class name without creating an object. The other methods (length(), nextLine(), substring(int)) are instance methods that require an object to be invoked.

Question 1(xv)

Which one of the following will be the output of the below statements?

String a[]={"Rohini", "Rajarshi", "Rajeev", "Rehan", "Rebecca"}; 
System.out.println(a[2].substring(2));
  1. jeev
  2. Ra
  3. Raj
  4. je

Answer

jeev

Reason — In the array, the element at position 2 is "Rajeev". In Java, string indexing starts from 0, so index 0 = R, index 1 = a, and index 2 = j. Using substring(2) means we take all characters from index 2 to the end, giving "jeev".

Question 1(xvi)

System.out.println(Math.round(Math.ceil(-8.8))); will result in:

  1. 8.0
  2. -8.0
  3. -9
  4. -8

Answer

-8

Reason — First, Math.ceil(-8.8) returns -8.0 because ceil() rounds a number up to the nearest integer (for negative numbers, “up” means closer to zero). Then, Math.round(-8.0) returns the integer -8, as round() converts a floating-point number to the nearest whole number.

Question 1(xvii)

Which one of the following Java statements assign 100 to the last element of a 3 × 3 array?

  1. x[2][2]=100;
  2. x[3][3]=100;
  3. x[2][3]=100;
  4. x[3][2]=100;

Answer

x[2][2]=100;

Reason — In Java, array indexing starts from 0, so a 3 × 3 array has valid row and column indices 0, 1, and 2. The last element is at row index 2 and column index 2, so x[2][2] = 100; correctly assigns the value 100 to that element.

Question 1(xviii)

Consider the Two dimensional array S[2][3], of storage devices given below, state the index of the Hard disk.

Consider the Two dimensional array S[2][3], of storage devices given below, state the index of the Hard disk? ICSE 2025 Computer Applications Solved Question Paper.
  1. S[1][0]
  2. S[0][1]
  3. S[1][2]
  4. S[0][0]

Answer

S[1][0]

Reason — In a two-dimensional array S[2][3], the first index represents the row and the second index represents the column, both starting from 0. Based on the given arrangement of storage devices, the element "Hard disk" is located in the second row (index 1) and first column (index 0), so its index is S[1][0].

Question 1(xix)

How many times the for statement given below is executed?

for(k = 10; k >= 0; k--)

  1. 10
  2. 11
  3. 12
  4. 0

Answer

11

Reason — The loop starts with k = 10 and runs while k >= 0. This includes both k = 10 and k = 0, so the values of k will be: 10, 9, 8, ..., 1, 0 — a total of 11 iterations.

Question 1(xx)

Consider the following program segment in which the statements are jumbled. Choose the correct order of the statements to return the sum of first 10 natural numbers.

for(i=1; i<=10; i++)  → 1
return sum;           → 2
int sum = 0, i;       → 3
sum+=i;               → 4
  1. 1 2 3 4
  2. 3 4 1 2
  3. 1 4 2 3
  4. 3 1 4 2

Answer

3 1 4 2

Reason — To return the sum of first 10 natural numbers, we must follow the proper sequence of statements:

  1. int sum = 0, i; – Declare the variables sum and i, and initialize sum to 0.
  2. for(i=1; i<=10; i++) – Start the loop to go through numbers 1 to 10.
  3. sum+=i; – Add the current number i to sum during each loop iteration.
  4. return sum; – After the loop completes, return the total sum.

Question 2(i)

Write Java expression for the following:

x10+y10x^{10} + y^{10}

Answer

Math.pow(x, 10) + Math.pow(y, 10)

Question 2(ii)

Evaluate the given expression when x = 4.

x *= --x + x-- + x;

Answer

x *= --x + x-- + x
x = x * (--x + x-- + x)
x = 4 * (--x + x-- + x)
x = 4 * (3 + x-- + x)
x = 4 * (3 + 3 + x)
x = 4 * (3 + 3 + 2)
x = 4 * 8
x = 32

Question 2(iii)

Convert the following switch case into if else if:

switch(x) 
{ 
case 'T' : 
case  't'  : System.out.print("Teacher");  break; 
default  :  System.out.print("Student");   
}

Answer

if (x == 'T' || x == 't') {
    System.out.print("Teacher");
} else {
    System.out.print("Student");
}

Question 2(iv)

Write the output of the following program segment:

for(int a = 1; a <= 10; a++) 
{ 
if(a % 2 == 0) 
continue; 
System.out.print(a + "  "); 
}

Answer

Output
1  3  5  7  9
Explanation
  1. The loop control variable a is initialized to 1 and is incremented by 1 after each iteration until it attains the value 10.
  2. The condition if (a % 2 == 0) tests whether a is an even number. If the condition is true, the continue statement transfers control to the next iteration of the loop, thereby skipping the print statement.
  3. Consequently, only the odd values 1, 3, 5, 7, and 9 are displayed by the statement System.out.print(a + " ");.

Question 2(v)

In the example given below of class Cat, identify the variable and the methods:

Cat
Name
meow()
eat()
play()

Answer

Variable: Name

Methods: meow(), eat(), play()

Question 2(vi)

Give the output of the following program segment and mention how many times the loop is executed.

int k = 100; 
while (k>=10) 
{
    System.out.println(k); 
    k-=40; 
}

Answer

Output
100
60
20

The loop is executed 3 times.

Explanation
  • Initial value: k = 100 → printed, then reduced to 60.
  • Second iteration: k = 60 → printed, then reduced to 20.
  • Third iteration: k = 20 → printed, then reduced to -20.
  • Loop stops when k < 10.

Question 2(vii)

Consider the given array and answer the questions given below:

int z[ ] [ ] = { {2, 3, 4}, {5, 1, 2}, {7, 9, 3}};

(a) What is the order of the array z[ ][ ]?

(b) What is the value in z[2][0]?

Answer

(a) The order of the array z[ ][ ] is 3 × 3.

(b) The value in z[2][0] is 7.

Question 2(viii)

Give the output of the following:

(a) "ROSE".compareTo("ROJA")

(b) "DEDICATE".replace('D', 'L')

Answer

(a)

Output
9
Explanation

The method compareTo() compares two strings lexicographically by evaluating the Unicode value of each character from left to right until a mismatch is found.

  1. 'R' (82) vs 'R' (82) → same.
  2. 'O' (79) vs 'O' (79) → same.
  3. 'S' (83) vs 'J' (74) → difference = 83 - 74 = 9.

Since a mismatch occurs at the third character, the comparison stops; therefore, the characters 'E' and 'A' are not compared.

Hence, the method returns 9.

(b)

Output
LELICATE
Explanation

The replace('D', 'L') method substitutes every occurrence of the character 'D' in the string "DEDICATE" with 'L', resulting in "LELICATE".

Question 2(ix)

Consider the following array and answer the questions given below:

char ch [ ] = { ‘A’, ‘%’, ‘y’, ‘@’, ‘7’, ‘p’};

(a) How many bytes does the array occupy?

(b) What is the output of the statement Character.isDigit(ch[4])?

Answer

(a) In Java, each element of type char occupies 2 bytes of memory. The given array has 6 elements, therefore:

Total memory = 6 × 2 = 12 bytes.

(b)

Output
true
Explanation
  • The element ch[4] contains the character '7'.
  • The method Character.isDigit('7') returns true because '7' is a numeric digit.

Question 2(x)

class perform 
{ 
int  m;  String name; 
perform(int x, String y) 
{ 
m=x; 
name=y; 
} 
void print()  
{ 
System.out.print(name + "     " + m); 
}      
public static void main() 
{ 
perform ob1=new perform(95 , "Xavier"); 
ob1.print();
} 
}

(a) Give the output of the code given above.

(b) Name the type of the constructor used.

Answer

(a)

Output
Xavier     95
Explanation
  • A perform object ob1 is created using new perform(95, "Xavier").
  • The constructor assigns m = 95 and name = "Xavier".
  • The print() method outputs the name followed by spaces and then m.

(b) The constructor perform(int x, String y) accepts arguments, hence it is a parameterized constructor.

Section B

Question 3

Define a class with following specifications.
class name: Hotel
Member variables:
String name – stores name of customer name
long mobno – stores mobile number
int days – stores number of days customer stayed in hotel
int bill – stores customer bill

Member method:
void input() – input values using Scanner class methods only
void charge() – calculate bill as per the following criteria

dayscharge/day
first 3 days1000 Rs/ day
next 4 days900 Rs/day
> 7 days800 Rs/day

bill = bill + gst (18% of bill)

void print() - Display customer name, mobile number and bill.

Invoke all the above methods in main method with the help of an object.

import java.util.Scanner;

class Hotel {
    String name;
    long mobno;
    int days;
    int bill;

    void input() {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter customer name: ");
        name = sc.nextLine();
        System.out.print("Enter mobile number: ");
        mobno = sc.nextLong();
        System.out.print("Enter number of days stayed: ");
        days = sc.nextInt();
    }

    void charge() {
        if (days <= 3) {
            bill = days * 1000;
        } else if (days <= 7) {
            bill = (3 * 1000) + (days - 3) * 900;
        } else {
            bill = (3 * 1000) + (4 * 900) + (days - 7) * 800;
        }
        bill += bill * 0.18;
    }

    void print() {
        System.out.println("Customer Name : " + name);
        System.out.println("Mobile Number : " + mobno);
        System.out.println("Total Bill    : Rs " + bill);
    }

    public static void main(String[] args) {
        Hotel h = new Hotel();
        h.input();
        h.charge();
        h.print();
    }
}
Output
BlueJ output of Hotel.java

Question 4

Define a class to accept values into a 3x3 integer array and print the product of each row elements.

Example:

312
421
512

Output:

Row 0 – 6
Row 1 – 8
Row 2 – 10

import java.util.Scanner;

public class RowProduct {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] arr = new int[3][3];

        System.out.println("Enter 9 integers for the 3x3 array:");
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                arr[i][j] = sc.nextInt();
            }
        }

        for (int i = 0; i < 3; i++) {
            int product = 1;
            for (int j = 0; j < 3; j++) {
                product *= arr[i][j];
            }
            System.out.println("Row " + i + " – " + product);
        }
    }
}
Output
BlueJ output of RowProduct.java

Question 5

Define a class to overload the method transform as follows:

int transform(int n) – to return the sum of the digits of the given number

Example: n = 458
output : 17

void transform(String s) – to convert the given String to upper case and print

Example: if S = “Blue”
Output : BLUE

void transform (char ch) – to print the character ch in 3 rows and 3 columns using nested loops.

Example: if ch = ‘@’
Output :

@@@  
@@@
@@@
import java.util.Scanner;

public class OverloadTransform {

    int transform(int n) {
        int sum = 0;
        while (n > 0) {
            int d = n % 10;
            sum += d;
            n /= 10;
        }
        return sum;
    }

    void transform(String s) {
        String str = s.toUpperCase();
        System.out.println(str);
    }

    void transform(char ch) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                System.out.print(ch);
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        OverloadTransform obj = new OverloadTransform();

        System.out.print("Enter an integer: ");
        int num = sc.nextInt();
        System.out.println("Sum of digits: " + obj.transform(num));

        sc.nextLine();
        System.out.print("Enter a string: ");
        String str = sc.nextLine();
        obj.transform(str);

        System.out.print("Enter a character: ");
        char ch = sc.next().charAt(0);
        obj.transform(ch);
    }
}
Output
BlueJ output of OverloadTransform.java

Question 6

Define a class to accept a string. Check if it is a Special String or not.
A String is Special if the number of vowels equals to the number of consonants.
Example: MINE
Number of vowels = 2
Number of Consonants = 2

import java.util.Scanner;

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

        System.out.print("Enter a string: ");
        String str = sc.nextLine().toUpperCase();

        int vowels = 0, consonants = 0;
        int len = str.length();

        for (int i = 0; i < len; i++) {
            char ch = str.charAt(i);
            if (ch >= 'A' && ch <= 'Z') {
                if (ch == 'A' 
                    || ch == 'E' 
                    || ch == 'I' 
                    || ch == 'O' 
                    || ch == 'U')
                    vowels++;
                else
                    consonants++;
            }
        }

        System.out.println("Number of vowels = " + vowels);
        System.out.println("Number of consonants = " + consonants);

        if (vowels == consonants)
            System.out.println("It is a Special String");
        else
            System.out.println("It is not a Special String");
    }
}
Output
BlueJ output of SpecialString.java
BlueJ output of SpecialString.java

Question 7

Define a class to accept a number and check if the sum of the first digit and the last digit is an even number or an odd number.

Example:

            N = 2396    N = 9316
First digit:   2         9
Last digit:    6         6
Sum:           8         15
Output: Sum is even  Sum is odd
import java.util.Scanner;

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

        System.out.print("Enter a number: ");
        int n = sc.nextInt();

        int lastDigit = n % 10;
        int firstDigit = n;
        while (firstDigit >= 10) {
            firstDigit /= 10;
        }

        int sum = firstDigit + lastDigit;

        System.out.println("First digit: " + firstDigit);
        System.out.println("Last digit: " + lastDigit);
        System.out.println("Sum: " + sum);

        if (sum % 2 == 0)
            System.out.println("Sum is even");
        else
            System.out.println("Sum is odd");
    }
}
Output
BlueJ output of FirstLastSum.java
BlueJ output of FirstLastSum.java

Question 8

Define a class to accept 10 integers in an array, search for the given value using the Linear Search technique and print appropriate messages.

import java.util.Scanner;
public class LinearSearchArray {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[10];

        System.out.println("Enter 10 integers:");
        for (int i = 0; i < 10; i++) {
            arr[i] = sc.nextInt();
        }
        System.out.print("Enter the value to search: ");
        int key = sc.nextInt();
        int i = 0;

        for (i = 0; i < 10; i++) {
            if (arr[i] == key) {
                break;
            }
        }
        
        if (i < 10)
            System.out.println("Value found at position: " + (i + 1));
        else
            System.out.println("Value not found in the array");
    }
}
Output
BlueJ output of LinearSearchArray.java
BlueJ output of LinearSearchArray.java
PrevNext