ICSE Computer Applications 2025
ICSE Computer Applications 2025
= 0; i -= 3)
(c) for(int i = 5; i <= 5; i++)
(d) for(int i = 1; i >= 1; i–)
COMPUTER APPLICATIONS
(viii) The output of Math.max(-7, Math.min(-5, -4)) is:
Maximum marks: 100
(a) -5
Time allowed: Two hours
(b) -4
1. Answers to this paper must be written on the paper provided
(c) -7
separately.
(d) error
2. You will not be allowed to write during the first 15 minutes.
(ix) Which of the following is true for the given object creation
3. This time is to be spent in reading the question paper.
statement?
4. The time given at the head of this paper is the time allowed
Game cricket = new Game();
for writing the answers.
(a) Game is an object of cricket class
5. This paper is divided into two sections.
(b) New keyword creates object Game
6. Attempt all questions from Section A and any four questions
(c) Game is a class and cricket is an object
from Section B.
(d) Game and cricket are objects
7. The intended marks for questions or parts of questions are
(x) Post Office is an example for ____ access specifier.
given in brackets [ ].
(a) public
Instruction for the Supervising Examiner
(b) local
Kindly read allowed the instructions given above to all the candidates
(c) protected
present in the Examination Hall.
(d) private
Question 1
(xi) Assertion (A): In switch case, break statement avoids fall
Choose the correct answers to the questions from the given options.
through.
(Do not copy the questions, write only the correct answers.)
Reason (R): break statement helps to execute only one case at a time.
(i) Character class methods are found in the package called:
(a) Both (A) and (R) are true and (R) is a correct explanation of
(a) java.util
(A).
(b) java.lang
(b) Both (A) and (R) are true and (R) is not a correct explanation of
(c) java.awt
(A).
(d) java.io
(c) (A) is true and (R) is false.
(ii) System.out.println(‘Z’ + 32); will display:
(d) (A) is false and (R) is true.
(a) z
(xii) A physical education teacher asks the students to do the side
(b) Z
stretch as shown below, 10 times. Which programming construct the
(c) 122
teacher uses?
(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)
(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()
Consider the two-dimensional array P[2][3], of peripherals (b) ar[].length
(input/output devices) given above, state the index of the device (c) ar.length() – 1
Barcode Scanner. (d) ar.length – 1
(a) P[1][1] (xiv) Assertion (A): A clock is a real-life example of nested loops.
(b) P[0][1] Reason (R): The hour hand moves through 12 positions, while the
(c) P[1][2] minute hand moves through 60 positions within each hour.
(d) P[0][0] (a) Both (A) and (R) are true and (R) is a correct explanation of
(vi) Which of the following is user-defined data type? (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.
(a) only 1 (xv) Which of the following pairs of methods will cause a compile-
(b) 1 and 3 time error due to incorrect method overloading?
(c) only 2 (a) void test(int a, int b) and void test(double a, double b)
(d) only 4 (b) void test(int a, double b) and void test(double a, int b)
(vii) Select the infinite loop: (c) void test(int a, double b) and void test(int a)
(a) for(int i = 1; i <= 10; i++) (d) void test(int a) and int test(int a)
(xvi) Which of the following converts “25” to 25.0? int a, b;
(a) Double.Parsedouble(“25”) report(){
(b) Double.parse(“25”) a = 10;
(c) Double.parseDouble(“25”) b = 15;
(d) Double.parseDouble(25) }
(xvii) Consider the program segment: report(int x, int y){
int p = 0; a = x;
for(p = 4; p > 0; p -= 2); b = y;
System.out.print(p); }
System.out.println(p); void print(){
The above statement will display: System.out.println(a * b);
(a) 42 }
(b) 4200 static void main(){
(c) report r = new report();
0 r.print();
0 report p = new report(4, 5);
(d) 00 p.print();
(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.’ 150
(b) I said, “It’s wise to obey elders.” 20
(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? (vi) (a) Name one String method which results in positive integer
“ANGER”.compareTo(“ANGEL”) only.
(a) 3 length()
(b) -6 (b) Name one String method which results in a character.
(c) 6 charAt()
(d) 0
(xx) Consider the following program segment in which the
statements are jumbled. (vii) John was asked to write a Java code to calculate the surface area
Choose the correct order of statements to calculate and return the of a cone. The following code was written by him:
factorial of 4. Surface area of cone is A = πrl
for(k = 1; k <= 4; k++) → 1
return fa; → 2
long fa = 1, k; → 3
fa *= k; → 4
(a) 1, 2, 3, 4 class area{
(b) 3, 1, 4, 2 double area(double r, double h){
(c) 3, 1, 2, 4 double l, a;
(d) 1, 3, 2, 4 a = 22.0 / 7 * r * l;
Question 2 l = Math.sqrt(r * r + h * h);
(i) Write the Java expression to find the product of square root of P return a;
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: Specify the type of the error in the above program, correct and write
String x = “talent”; the program to be error free.
String y = “matrix”; Compile-time error
System.out.println(x.substring(3).concat(y.substring(3)));
entrix
(iii) Write the Java statement for creating an object named ‘sifra’ of class area{
the class ‘Robot’, which takes three double parameters. double findArea(double r, double h){
Robot sifra = new Robot(2.5, 3.5, 4.5); double l, a;
(iv) Convert the given loop into exit-controlled loop. l = Math.sqrt(r * r + h * h);
int a, b; a = 22.0 / 7 * r * l;
for(a = 10, b = 1; a >= 1; a -= 2){ return a;
b += a; }
b++; }
} (viii) Consider the following array and answer the questions given
System.out.println(b); below:
int a = 10, b = 1; int a[] = {12, 10, 8, 4, 6, 2, 3, 5, 7};
do{ (a) What is the output of System.out.print(a[0] + a[5]);?
b += a; 14
(b) What is the index (subscript) of the largest element of the array
b++;
a[]?
a -= 2;
0
}while(a >= 1);
System.out.println(b);
(v) Consider and give the output of the following program:
class report{
(ix) (a) Write the Java statement to initialize the first 6 odd numbers bill = space * 15;
in a 3 × 2 array. else if(space <= 30)
a[3][2] = {{1, 3}, {5, 7}, {9, 11}}; bill = 225 + (space - 15) * 13;
(b) What is the result of x[0][1] + x[2][1] of the above array? else
14 bill = 420 + (space - 30) * 11;
}
public void display(){
(x) Give the output of the following program segment and specify System.out.println("Account No. " + acno);
how many times the loop is executed. System.out.println("Storage space: " + space);
System.out.println("Bill: " + bill);
}
String x = "JAVA"; public static void main(String[] args){
for(i = 0; i < s.length(); i += 2) CloudStorage obj = new CloudStorage();
System.out.println(s.substring(i)); obj.accept();
JAVA obj.calculate();
VA obj.display();
}
}
SECTION B (60 Marks) Question 4
(Answer any four questions from this section) Define a class to accept values into a 4 × 4 integer array. Calculate
The answers in this section should consist of the programs in either and print the NORM of the array. NORM is the square root of sum of
BlueJ environment or any program environment with Java as the squares of all elements.
base. 1 2 1 3
Each program should be written using variable description/mnemonic
5 2 1 6
codes so that the logic of the program is clearly depicted.
3 6 1 2
Flowcharts and algorithms are not required.
3 4 6 3
Question 3
Define a class named CloudStorage with the following Sum of squares of elements = 1 + 4 + 1 + 9 + 25 + 4 + 1 + 36 + 9 +
specifications: 36 + 1 + 4 + 9 + 16 + 36 + 9 = 201
Member Variables: NORM = Square root of 201 = 14.177446878757825
int acno – stores the user’s account number
int space – stores the amount of storage space in GB purchased by the
import java.util.Scanner;
user
class Norm{
double bill – stores the total price to be paid by the user
public static void main(String[] args){
Member Methods:
Scanner in = new Scanner(System.in);
void accept() – prompts the user to input their account number and
int a[][] = new int[4][4];
storage space using Scanner class methods only.
int sum = 0;
void calculate() – calculates the bill total price based on the storage
System.out.println("Enter array elements:");
space purchased using the pricing table provided:
for(int i = 0; i < 4; i++){
Storage range Price per GB (Rs) for(int j = 0; j < 4; j++){
a[i][j] = Integer.parseInt(in.nextLine());
First 15 GB 15 sum += a[i][j] * a[i][j];
}
}
Next 15 GB 13 double root = Math.sqrt(sum);
System.out.println("NORM = " + root);
Above 30 GB 11 }
}
void display() – displays the account number, storage space and bill
Question 5
to be paid.
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
Write a main method to create an object of the class and invoke the the number of lowercase letters. [Use Character and String methods
methods of the class with respect to the object. only]
Example: “COmmITmeNt”
Number of uppercase letters = 5
import java.util.Scanner; Number of lowercase letters = 5
class CloudStorage{ String is a Super String
int acno; import java.util.Scanner;
int space; class SuperString{
double bill; public static void main(String[] args){
public void accept(){ Scanner in = new Scanner(System.in);
Scanner in = new Scanner(System.in); System.out.print("Enter the string: ");
System.out.print("Account number: "); String s = in.nextLine();
acno = Integer.parseInt(in.nextLine()); int upper = 0;
System.out.print("Space: "); int lower = 0;
space = Integer.parseInt(in.nextLine()); for(int i = 0; i < s.length(); i++){
} char ch = s.charAt(i);
public void calculate(){ if(Character.isUpperCase(ch))
if(space <= 15) upper++;
else if(Character.isLowerCase(ch)) }
lower++; public double print(double a, double b){
} double sum = 0.0;
if(upper == lower) for(double i = a; i <= b; i += 0.5)
System.out.println("String is a Super String"); sum += i;
else System.out.println("Sum = " + sum);
System.out.println("String is not a Super String"); return sum;
} }
} public int print(char ch1, char ch2){
Question 6 if(ch1 > ch2)
Define a class to initialize the following data in an array. return (int)ch1;
Search for a given character input by the user, using the Binary return (int)ch2;
Search technique. }
Print “Search successful” if the character is found otherwise print }
“Search is not successful”. Question 8
‘A’, ‘H’, ‘N’, ‘P’, ‘S’, ‘U’, ‘W’, ‘Y’, ‘Z’, ‘b’, ‘d’ Define a class to accept a number. Check if the sum of the largest
import java.util.Scanner; digit and the smallest digit is an even number or an odd number. Print
class Search{ appropriate messages.
public static void main(String[] args){ Sample Input: 6425 3748
Scanner in = new Scanner(System.in); Largest digit: 6 8
char a[] = {'A', 'H', 'N', 'P', 'S', 'U', 'W', 'Y', 'Z', 'b', 'd'}; Smallest digit: 2 3
System.out.print("Character to be searched: "); Sample Output: Sum is even Sum is odd
char key = in.nextLine().charAt(0); import java.util.Scanner;
int low = 0; class Find{
int high = a.length - 1; public static void main(String[] args){
int mid = 0; Scanner in = new Scanner(System.in);
while(low <= high){ System.out.print("Enter the number: ");
mid = (low + high) / 2; int num = Integer.parseInt(in.nextLine());
if(key == a[mid]) int sum = 0;
break; int smallest = num % 10;
else if(key < a[mid]) int largest = num % 10;
high = mid - 1; for(int i = num; i != 0; i /= 10){
else int digit = i % 10;
low = mid + 1; if(smallest > digit)
} smallest = digit;
if(low > high) if(largest < digit)
System.out.println("Search is not successful"); largest = digit;
else }
System.out.println("Search is successful"); sum = smallest + largest;
} if(sum % 2 == 0)
} System.out.println("Sum is even");
Question 7 else
Define a class to overload the method print() as follows: System.out.println("Sum is odd");
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();
}