ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2025 ICSE Computer Science Paper



Share with a Friend

Solved 2025 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Short Questions/Answers - ICSE 2025 Computer Science

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)  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?
 (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?

(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.

OUTPUT:

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)));

OUTPUT:

entrix


(iii) Write the Java statement for creating an object named ‘sifra’ of the class ‘Robot’, which takes three double parameters.

OUTPUT:

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++;
}

OUTPUT:

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.

OUTPUT:

length()


(b) Name one String method which results in a character.

OUTPUT:

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

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.

OUTPUT:

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]);?

OUTPUT:

14
(b) What is the index (subscript) of the largest element of the array a[]?

OUTPUT:

0

 

(ix) (a) Write the Java statement to initialize the first 6 odd numbers in a 3 × 2 array.

OUTPUT:

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?

OUTPUT:

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));

OUTPUT:

JAVA
VA