ICSE Computer Applications 2025

COMPUTER APPLICATIONS
Maximum marks: 100
Time allowed: Two hours

  1. Answers to this paper must be written on the paper provided separately.
  2. You will not be allowed to write during the first 15 minutes.
  3. This time is to be spent in reading the question paper.
  4. The time given at the head of this paper is the time allowed for writing the answers.
  5. This paper is divided into two sections.
  6. Attempt all questions from Section A and any four questions from Section B.
  7. The intended marks for questions or parts of questions are given in brackets [ ].

Instruction for the Supervising Examiner
Kindly read allowed the instructions given above to all the candidates present in the Examination Hall.

Question 1
Choose the correct answers to the questions from the given options.
(Do not copy the questions, write only the correct answers.)
(i) Character class methods are found in the package called:
(a) java.util
(b) java.lang
(c) java.awt
(d) java.io
(ii) System.out.println(‘Z’ + 32); will display:
(a) z
(b) Z
(c) 122
(d) 154
(iii) double x[] = {2.5, 4.5, 5.5, 6.4}; occupies ____ bytes.
(a) 16
(b) 4
(c) 8
(d) 32
(iv) The output of 42 / 6 % 2 is:
(a) 1
(b) 10
(c) 2
(d) 0
(v)
Matrix Question 2025
Consider the two-dimensional array P[2][3], of peripherals (input/output devices) given above, state the index of the device Barcode Scanner.
(a) P[1][1]
(b) P[0][1]
(c) P[1][2]
(d) P[0][0]
(vi) Which of the following is user-defined data type?
User-Defined Data Type ICSE 2025
(a) only 1
(b) 1 and 3
(c) only 2
(d) only 4
(vii) Select the infinite loop:
(a) for(int i = 1; i <= 10; i++)
(b) for(int i = 2; i != 0; i -= 3)
(c) for(int i = 5; i <= 5; i++)
(d) for(int i = 1; i >= 1; i–)
(viii) The output of Math.max(-7, Math.min(-5, -4)) is:
(a) -5
(b) -4
(c) -7
(d) error
(ix) Which of the following is true for the given object creation statement?
Game cricket = new Game();
(a) Game is an object of cricket class
(b) New keyword creates object Game
(c) Game is a class and cricket is an object
(d) Game and cricket are objects
(x) Post Office is an example for ____ access specifier.
(a) public
(b) local
(c) protected
(d) private
(xi) Assertion (A): In switch case, break statement avoids fall through.
Reason (R): break statement helps to execute only one case at a time.
(a) Both (A) and (R) are true and (R) is a correct explanation of (A).
(b) Both (A) and (R) are true and (R) is not a correct explanation of (A).
(c) (A) is true and (R) is false.
(d) (A) is false and (R) is true.
(xii) A physical education teacher asks the students to do the side stretch as shown below, 10 times. Which programming construct the teacher uses?
Side Stretch
(a) if
(b) switch
(c) for
(d) if else if
(xiii) The index (subscript) of the last element of an array ar[] is:
(a) ar.length()
(b) ar[].length
(c) ar.length() – 1
(d) ar.length – 1
(xiv) Assertion (A): A clock is a real-life example of nested loops.
Reason (R): The hour hand moves through 12 positions, while the minute hand moves through 60 positions within each hour.
(a) Both (A) and (R) are true and (R) is a correct explanation of (A).
(b) Both (A) and (R) are true and (R) is not a correct explanation of (A).
(c) (A) is true and (R) is false.
(d) (A) is false and (R) is true.
(xv) Which of the following pairs of methods will cause a compile-time error due to incorrect method overloading?
(a) void test(int a, int b) and void test(double a, double b)
(b) void test(int a, double b) and void test(double a, int b)
(c) void test(int a, double b) and void test(int a)
(d) void test(int a) and int test(int a)
(xvi) Which of the following converts “25” to 25.0?
(a) Double.Parsedouble(“25”)
(b) Double.parse(“25”)
(c) Double.parseDouble(“25”)
(d) Double.parseDouble(25)
(xvii) Consider the program segment:
int p = 0;
for(p = 4; p > 0; p -= 2);
System.out.print(p);
System.out.println(p);
The above statement will display:
(a) 42
(b) 4200
(c)
0
0
(d) 00
(xviii) System.out.println(“I said, \”It\’s wise to obey elders.\””);
The output of the above statement is:
(a) I said, ‘It is wise to obey elders.’
(b) I said, “It’s wise to obey elders.”
(c) I said, It’s wise to elders.
(d) “‘It’s wise to obey elders.'”
(xix) What is the output of the statement given below?
“ANGER”.compareTo(“ANGEL”)
(a) 3
(b) -6
(c) 6
(d) 0
(xx) Consider the following program segment in which the statements are jumbled.
Choose the correct order of statements to calculate and return the factorial of 4.
for(k = 1; k <= 4; k++) → 1
return fa; → 2
long fa = 1, k; → 3
fa *= k; → 4
(a) 1, 2, 3, 4
(b) 3, 1, 4, 2
(c) 3, 1, 2, 4
(d) 1, 3, 2, 4

Question 2
(i) Write the Java expression to find the product of square root of P and the square root of Q using the methods of Math class.
Math.sqrt(P) * Math.sqrt(Q)
(ii) Write the output of the following String method:
String x = “talent”;
String y = “matrix”;
System.out.println(x.substring(3).concat(y.substring(3)));
entrix
(iii) Write the Java statement for creating an object named ‘sifra’ of the class ‘Robot’, which takes three double parameters.
Robot sifra = new Robot(2.5, 3.5, 4.5);
(iv) Convert the given loop into exit-controlled loop.
int a, b;
for(a = 10, b = 1; a >= 1; a -= 2){
b += a;
b++;
}
System.out.println(b);
int a = 10, b = 1;
do{
b += a;
b++;
a -= 2;
}while(a >= 1);

System.out.println(b);
(v) Consider and give the output of the following program:

class report{
    int a, b;
    report(){
        a = 10;
        b = 15;
    }
    report(int x, int y){
        a = x;
        b = y;
    }
    void print(){
        System.out.println(a * b);
    }
    static void main(){
        report r = new report();
        r.print();
        report p = new report(4, 5);
        p.print();
    }
}

150
20

(vi) (a) Name one String method which results in positive integer only.
length()
(b) Name one String method which results in a character.
charAt()

(vii) John was asked to write a Java code to calculate the surface area of a cone. The following code was written by him:
Surface area of cone is A = πrl
Formula of Length

class area{
    double area(double r, double h){
        double l, a;
        a = 22.0 / 7 * r * l;
        l = Math.sqrt(r * r + h * h);
        return a;
    }
}

Specify the type of the error in the above program, correct and write the program to be error free.
Compile-time error

class area{
    double findArea(double r, double h){
        double l, a;
        l = Math.sqrt(r * r + h * h);
        a = 22.0 / 7 * r * l;
        return a;
    }
}

(viii) Consider the following array and answer the questions given below:
int a[] = {12, 10, 8, 4, 6, 2, 3, 5, 7};
(a) What is the output of System.out.print(a[0] + a[5]);?
14
(b) What is the index (subscript) of the largest element of the array a[]?
0

(ix) (a) Write the Java statement to initialize the first 6 odd numbers in a 3 × 2 array.
a[3][2] = {{1, 3}, {5, 7}, {9, 11}};
(b) What is the result of x[0][1] + x[2][1] of the above array?
14

(x) Give the output of the following program segment and specify how many times the loop is executed.

String x = "JAVA";
for(i = 0; i < s.length(); i += 2)
    System.out.println(s.substring(i));

JAVA
VA

SECTION B (60 Marks)
(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.

Question 3
Define a class named CloudStorage with the following specifications:
Member Variables:
int acno – stores the user’s account number
int space – stores the amount of storage space in GB purchased by the user
double bill – stores the total price to be paid by the user
Member Methods:
void accept() – prompts the user to input their account number and storage space using Scanner class methods only.
void calculate() – calculates the bill total price based on the storage space purchased using the pricing table provided:

Storage rangePrice per GB (Rs)
First 15 GB15
Next 15 GB13
Above 30 GB11

void display() – displays the account number, storage space and bill to be paid.

Write a main method to create an object of the class and invoke the methods of the class with respect to the object.

import java.util.Scanner;
class CloudStorage{
    int acno;
    int space;
    double bill;
    public void accept(){
        Scanner in = new Scanner(System.in);
        System.out.print("Account number: ");
        acno = Integer.parseInt(in.nextLine());
        System.out.print("Space: ");
        space = Integer.parseInt(in.nextLine());
    }
    public void calculate(){
        if(space <= 15)
            bill = space * 15;
        else if(space <= 30)
            bill = 225 + (space - 15) * 13;
        else
            bill = 420 + (space - 30) * 11;
    }
    public void display(){
        System.out.println("Account No. " + acno);
        System.out.println("Storage space: " + space);
        System.out.println("Bill: " + bill);
    }
    public static void main(String[] args){
        CloudStorage obj = new CloudStorage();
        obj.accept();
        obj.calculate();
        obj.display();
    }
}

Question 4
Define a class to accept values into a 4 × 4 integer array. Calculate and print the NORM of the array. NORM is the square root of sum of squares of all elements.

1213
5216
3612
3463

Sum of squares of elements = 1 + 4 + 1 + 9 + 25 + 4 + 1 + 36 + 9 + 36 + 1 + 4 + 9 + 16 + 36 + 9 = 201
NORM = Square root of 201 = 14.177446878757825

import java.util.Scanner;
class Norm{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a[][] = new int[4][4];
        int sum = 0;
        System.out.println("Enter array elements:");
        for(int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){
                a[i][j] = Integer.parseInt(in.nextLine());
                sum += a[i][j] * a[i][j];
            }
        }
        double root = Math.sqrt(sum);
        System.out.println("NORM = " + root);
    }
}

Question 5
Define a class to accept a String and print if it is a Super String or not. A String is Super if the number of uppercase letters are equal to the number of lowercase letters. [Use Character and String methods only]
Example: “COmmITmeNt”
Number of uppercase letters = 5
Number of lowercase letters = 5
String is a Super String

import java.util.Scanner;
class SuperString{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        System.out.print("Enter the string: ");
        String s = in.nextLine();
        int upper = 0;
        int lower = 0;
        for(int i = 0; i < s.length(); i++){
            char ch = s.charAt(i);
            if(Character.isUpperCase(ch))
                upper++;
            else if(Character.isLowerCase(ch))
                lower++;
        }
        if(upper == lower)
            System.out.println("String is a Super String");
        else
            System.out.println("String is not a Super String");
    }
}

Question 6
Define a class to initialize the following data in an array.
Search for a given character input by the user, using the Binary Search technique.
Print “Search successful” if the character is found otherwise print “Search is not successful”.
‘A’, ‘H’, ‘N’, ‘P’, ‘S’, ‘U’, ‘W’, ‘Y’, ‘Z’, ‘b’, ‘d’

import java.util.Scanner;
class Search{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        char a[] = {'A', 'H', 'N', 'P', 'S', 'U', 'W', 'Y', 'Z', 'b', 'd'};
        System.out.print("Character to be searched: ");
        char key = in.nextLine().charAt(0);
        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 is not successful");
        else
            System.out.println("Search is successful");
    }
}

Question 7
Define a class to overload the method print() as follows:
void print() – To print the given format using nested loops.
@#@#@
@#@#@
@#@#@
@#@#@
double print(double a, double b) – To display the sum of numbers between a and b with difference of 0.5.
e.g. if a = 1.0, b = 4.0
Output is: 1.0 + 1.5 + 2.0 + 2.5 + … + 4.0
int print(char ch1, char ch2) – Compare the two characters and return the ASCII code of the largest character.

class Overload{
    public void print(){
        for(int i = 0; i < 4; i++){
            char ch = '@';
            for(int j = 0; j < 5; j++){
                System.out.print(ch);
                if(ch == '@')
                    ch = '#';
                else
                    ch = '@';
            }
            System.out.println();
        }
    }
    public double print(double a, double b){
        double sum = 0.0;
        for(double i = a; i <= b; i += 0.5)
            sum += i;
        System.out.println("Sum = " + sum);
        return sum;
    }
    public int print(char ch1, char ch2){
        if(ch1 > ch2)
            return (int)ch1;
        return (int)ch2;
    }
}

Question 8
Define a class to accept a number. Check if the sum of the largest digit and the smallest digit is an even number or an odd number. Print appropriate messages.

Sample Input:64253748
Largest digit:68
Smallest digit:23
Sample Output:Sum is evenSum is odd
import java.util.Scanner;
class Find{
    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 smallest = num % 10;
        int largest = num % 10;
        for(int i = num; i != 0; i /= 10){
            int digit = i % 10;
            if(smallest > digit)
                smallest = digit;
            if(largest < digit)
                largest = digit;
        }
        sum = smallest + largest;
        if(sum % 2 == 0)
            System.out.println("Sum is even");
        else
            System.out.println("Sum is odd");
    }
}