ICSE Computer Applications 2025 Specimen Paper

COMPUTER APPLICATIONS
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.

This paper is divided into two sections.
Attempt all questions from Section A and any four questions from Section B.
The intended marks for questions or parts of questions are given in brackets [ ].

SECTION A
(Attempt all questions from this section)

Question 1
Choose the correct answer to the questions from the given options.
(Do not copy the question, write the correct answers only)
(i)

Name the above structure:
(a) One dimensional array
(b) Two-dimensional array with 4 rows and 5 columns
(c) Three-dimensional array
(d) Two-dimensional array with 5 rows and 4 columns

(ii) “Java compiled code (bytecode) can run on all operating systems.”
– Name the feature.
(a) Robust and Secure
(b) Object-Oriented
(c) Platform-independent
(d) Multithreaded

(iii) The size of ‘\n’ is:
(a) 2 bytes
(b) 4 bytes
(c) 8 bytes
(d) 16 bytes

(iv) Identify the operator that gets the highest precedence while evaluating the given expression: a + b % c * d – e
(a) +
(b) %
(c) –
(d) *

(v) Which of the following is a valid Java keyword?
(a) If
(b) BOOLEAN
(c) static
(d) Switch

(vi) The output of the following code is:
System.out.println(Math.ceil(6.4) + Math.floor(-1-2));
(a) 3.0
(b) 4
(c) 3
(d) 4.0

(vii) Which of the following returns a String?
(a) length()
(b) charAt(int)
(c) replace(char, char)
(d) indexOf(String)

(viii) Which of the following is not true with regards to a switch statement?
(a) checks for an equality between the input and the case labels
(b) supports floating point constants
(c) break is used to exit from the switch block
(d) case labels are unique

(ix) Consider the array given below:
char ch[] = {‘A’, ‘E’, ‘I’, ‘O’, ‘U’};
Write the output of the following statement:
System.out.println(ch[0] * 2);
(a) 65
(b) 130
(c) ‘A’
(d) 0

(x) To execute a loop 10 times, which of the following is correct?
(a) for(int i = 11; i <= 30; i += 2)
(b) for(int i = 11; i <= 30; i += 3)
(c) for(int i = 11; i < 20; i++)
(d) for(int i = 11; i <= 21; i++)

(xi) A single dimensional array has 50 elements, which of the following is the correct statement to initialize the last element to 100?
(a) x[51] = 100;
(b) x[48] = 100;
(c) x[49] = 100;
(d) x[50] = 100;

(xii) Method prototype for the method compute which accepts two integer arguments and returns true/false.
(a) void compute(int a, int b)
(b) boolean compute(int a, int b)
(c) Boolean compute(int a, b)
(d) int compute(int a, int b)

(xiii) The statement that brings the control back to the calling method is:
(a) break
(b) System.exit(0)
(c) continue
(d) return

(xiv) The default value of a boolean variable is:
(a) False
(b) 0
(c) false
(d) True

(xv) The method to convert a lowercase character to uppercase is:
(a) String.toUpperCase()
(b) Character.isUppercase(char)
(c) Character.toUpperCase(char)
(d) toUpperCase()

(xvi) Assertion (A): Integer class can be used in the program without calling a package.
Reason (R): It belongs to the default package java.lang.
(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A)
(c) Assertion (A) is true and Reason (R) is false
(d) Assertion (A) is false and Reason (R) is true

(xvii) A student executes the following code to increase the value of a variable ‘x’ by 2.
He has written the following statement, which is incorrect.
x =+ 2;
What will be the correct statement?
A. x += 2;
B. x = 2;
C. x = x + 2;
(a) Only A
(b) Only C
(c) All the three
(d) Both A and C

(xviii) The statement used to find the total number of strings present in the String array String s[] is:
(a) s.length
(b) s.length()
(c) length(s)
(d) len(s)

(xix) Consider the following program segment in which the statements are jumbled. Choose the correct order of statements to swap two variables using the third variable.

void swap(int a, int b){
    a = b; --> (1)
    b = t; --> (2)
    int t = 0; --> (3)
    t = a; --> (4)
}

(a) (1) (2) (3) (4)
(b) (3) (4) (1) (2)
(c) (1) (3) (4) (2)
(d) (2) (1) (4) (3)

(xx) Assertion (A): An argument is a value that is passed to a method when it is called.
Reason (R): Variables which are declared in a method prototype to receive values are called actual parameters.
(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A)
(c) Assertion (A) is true and Reason (R) is false
(d) Assertion (A) is false and Reason (R) is true

Question 2
(i) Rewrite the following code using single if statement.

if(code == 'g')
    System.out.println("GREEN");
else if(code == 'G')
    System.out.println("GREEN")
if(code == 'g' || code == 'G')
    System.out.println("GREEN");

(ii) Evaluate the given expression when the value of a = 2 and b = 3.
b *= a++ – ++b + ++a;
System.out.println(“a = ” + a);
System.out.println(“b = ” + b);
b = b * (a++ – ++b + ++a)
b = 3 * (2 – 4 + 4)
b = 3 * 2
b = 6

(iii) A student executes the following program segment and gets an error. Identify the statement which has an error. Correct the same to get the output as WIN.

boolean x = true;
switch(x){
    case 1: System.out.println("WIN"); break;
    case 2: System.out.println("LOOSE");
}
boolean x = true;
switch(x){
    case true: System.out.println("WIN"); break;
    case false: System.out.println("LOOSE");
}

(iv) Write the Java expression for:
Mathematical Expression
Math.cbrt(x) + Math.sqrt(y)

(v) How many times will the following loop execute? Write the output of the code:

int x = 10;
while(true){
    System.out.println(x++ * 2);
    if(x % 3 == 0)
        break;
}

OUTPUT:
20
22
The loop executes 2 times.

(vi) Write the output of the following String methods:
String x = “Galaxy”, y = “Games”;
(a) System.out.println(x.charAt(0) == y.charAt(0));
(b) System.out.println(x.compareTo(y));
(a) true
(b) -1

(vii) Predict the output of the following code snippet:

char ch = 'B';
char chr = Character.toLowerCase(ch);
int n = (int)chr - 10;
System.out.println((char)n + "\t" + chr);
OUTPUT:
X       b

(viii) A student is trying to convert the string present in x to a numerical value, so that he can find the square root of the converted value. However, the code has an error. Name the error (syntax/logical/runtime). Correct the code so that it compiles and runs correctly.

String x = "25";
int y = Double.parseDouble(x);
double r = Math.sqrt(y);
System.out.println(r);
It is a syntax error.
String x = "25";
int y = Integer.parseInt(x);
double r = Math.sqrt(y);
System.out.println(r);

(ix) Consider the following program segment and answer the questions below:

class calculate{
    int a; double b;
    calculate(){
        a = 0;
        b = 0.0;
    }
    calculate(int x, double y){
        a = x;
        b = y;
    }
    void sum(){
        System.out.println(a * b);
    }
}

Name the type of constructors used in the above program segment.
Non-parameterized and parameterized constructors.

(x) Consider the following program segment and answer the questions given below:
int x[][] = {{2, 4, 5, 6}, {5, 7, 8, 1}, {34, 1, 10, 9}};
(a) What is the position of 34?
(b) What is the result of x[2][3] + x[1][2]?
(a) x[2][0]
(b) 9 + 8 = 17

SECTION B
(Answer any four questions from this section)
The answers in this section should consist of the programs in either BlueJ environment or any program environment with Java as the base.
Each program should be written using variable description/mnemonic codes so that the logic of the program is clearly depicted.
Flowcharts and algorithms are not required.
BufferedReader/DataInputStream should not be used in the programs.

Question 3
Define a class with the following specifications:
Class name: Bank
Member variables:
double p – stores the principal amount
double n – stores the time period in years
double r – stores the rate of interest
double a – stores the amount
Member methods:
void accept() – input values for p and n using Scanner class methods only.
void calculate() – calculate the amount based on the following conditions:

Time in (Years)Rate %
Up to 1/29
> 1/2 to 1 year10
> 1 to 3 years11
> 3 years12

void display() – displays the details in the given format:

Principal    Time    Rate    Amount
xxx          xxx     xxx     xxx

Write the main() method to create an object and call the above methods.

import java.util.Scanner;
class Bank{
    double p;
    double n;
    double r;
    double a;
    public void accept(){
        Scanner in = new Scanner(System.in);
        System.out.print("Principal amount: ");
        p = Double.parseDouble(in.nextLine());
        System.out.print("Time period in years: ");
        n = Double.parseDouble(in.nextLine());
    }
    public void calculate(){
        if(n <= 0.5)
            r = 9.0;
        else if(n <= 1.0)
            r = 10.0;
        else if(n <= 3.0)
            r = 11.0;
        else
            r = 12.0;
        a = p * Math.pow(1 + r / 100, n);
    }
    public void display(){
        System.out.println("Principal\tTime\tRate\tAmount");
        System.out.println(p + "\t\t" + n + "\t" + r + "\t" + a);
    }
    public static void main(String[] args) {
        Bank obj = new Bank();
        obj.accept();
        obj.calculate();
        obj.display();
    }
}

Question 4
Define a class to search for a value input by the user from the list of values given below. If it is found display the message “Search successful”, otherwise display the message “Search element not found” using Binary search technique.
5.6, 11.5, 20.8, 35.4, 43.1, 52.4, 66.6, 78.9, 80.0, 95.5.

import java.util.Scanner;
class Search{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        double a[] = {5.6, 11.5, 20.8, 35.4, 43.1, 52.4, 66.6, 78.9, 80.0, 95.5};
        System.out.print("Element to be searched: ");
        double key = Double.parseDouble(in.nextLine());
        int low = 0;
        int high = a.length - 1;
        int mid = 0;
        while(low <= high){
            mid = (low + high) / 2;
            if(key == a[mid])
                break;
            else if(key < a[mid])
                high = mid - 1;
            else
                low = mid + 1;
        }
        if(low > high)
            System.out.println("Search element not found");
        else
            System.out.println("Search successful");
    }
}

Question 5
Define a class to accept a string and convert the same to uppercase. Create and display the new string by replacing each vowel by immediate next character and every consonant by the previous character. The other characters remain the same.
Example:
Input: #IMAGINATION@2024
Output: #JLBFJMBSJPM@2024

import java.util.Scanner;
class Change{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        System.out.print("Enter the string: ");
        String s = in.nextLine().toUpperCase();
        String t = "";
        for(int i = 0; i < s.length(); i++){
            char ch = s.charAt(i);
            if(Character.isLetter(ch)){
                if("AEIOU".indexOf(ch) >= 0)
                    t += (char)(ch + 1);
                else
                    t += (char)(ch - 1);
            }
            else
                t += ch;
        }
        System.out.println(t);
    }
}

Question 6
Define a class to accept values into 4 × 4 array and find and display the sum of each row.
Example:
A[][] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {1, 3, 5, 7}, {2, 5, 3, 1}};
Output:
sum of row 1 = 10 (1 + 2 + 3 + 4)
sum of row 2 = 26 (5 + 6 + 7 + 8)
sum of row 3 = 16 (1 + 3 + 5 + 7)
sum of row 4 = 11 (2 + 5 + 3 + 1)

import java.util.Scanner;
class Matrix{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a[][] = new int[4][4];
        System.out.println("Enter matrix elements:");
        for(int i = 0; i < a.length; i++){
            for(int j = 0; j < a.length; j++){
                a[i][j] = Integer.parseInt(in.nextLine());
            }
        }
        System.out.println("Original Matrix:");
        for(int i = 0; i < a.length; i++){
            for(int j = 0; j < a.length; j++){
                System.out.print(a[i][j] + "\t");
            }
            System.out.println();
        }
        for(int i = 0; i < a.length; i++){
            int sum = 0;
            for(int j = 0; j < a.length; j++){
                sum += a[i][j];
            }
            System.out.println("sum of row " + (i + 1) + " = " + sum);
        }
    }
}

Question 7
Define a class to accept a number and check whether it is a SUPERSPY number or not. A number is called SUPERSPY if the sum of the digits equals the number of the digits.
Example 1:
Input: 1021
Output: SUPERSPY number [SUM OF THE DIGITS = 1 + 0 + 2 + 1 = 4, NUMBER OF DIGITS = 4]
Example 2:
Input: 125
Output: Not a SUPERSPY number [1 + 2 + 5 is not equal to 3]

import java.util.Scanner;
class SuperSpy{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        System.out.print("Enter the number: ");
        int num = Integer.parseInt(in.nextLine());
        int sum = 0;
        int count = 0;
        for(int i = num; i != 0; i /= 10){
            count++;
            sum += i % 10;
        }
        if(sum == count)
            System.out.println(num + " is a superspy number!");
        else
            System.out.println(num + " is not a superspy number.");
    }
}

Question 8
Define a class to overload the method display() as follows:
void display(): To print the following format using nested loop.

1 2 1 2 1
1 2 1 2 1
1 2 1 2 1

void display(int n, int m): To print the quotient of the division of m and n if m is greater than n otherwise print the sum of twice n and thrice m.
double display(double a, double b, double c): to print the value of z where z = p × q
p = (a + b) / c
q = a + b + c

class Overload{
    public static void display(){
        for(int i = 1; i <= 3; i++){
            int value = 1;
            for(int j = 1; j <= 5; j++){
                System.out.print(value + " ");
                if(value == 1)
                    value = 2;
                else
                    value = 1;
            }
            System.out.println();
        }
    }
    public static void display(int n, int m){
        if(m > n){
            int q = m / n;
            System.out.println("Quotient = " + q);
        }
        else{
            int sum = 2 * n + 3 * m;
            System.out.println("Sum = " + sum);
        }
    }
    public static double display(double a, double b, double c){
        double p = (a + b) / c;
        double q = a + b + c;
        double z = p * q;
        System.out.println("z = " + z);
        return z;
    }
}

14 thoughts on “ICSE Computer Applications 2025 Specimen Paper

    • Integer.parseInt()
      The Integer class resides in java.lang package.
      We can use it with Scanner class in the following manner:
      int num = Integer.parseInt(in.nextLine());
      In the above piece of code, the nextLine() method resides in the Scanner class.
      The nextLine() returns a string which is converted to int using the parseInt() method.

Leave a Reply

Your email address will not be published. Required fields are marked *