Computer Application ICSE_Sample Paper 2_X_2024-25
Computer Application ICSE_Sample Paper 2_X_2024-25
CLASS X (2024-25)
Sample Paper 2
Maximum Marks: 100 Time allowed: 2 hours
Question 1 [20]
(i)
ps
Choose the correct answers to the questions from the given options.
Which keyword is used to achieve abstraction in Java?
(a) abstract
(b) interface
(c) extends
(d) implements
(iii) Which of the following is the correct syntax for the conditional (ternary) operator in
Java?
(a) x ? y : z
(b) x ? y -> z
(c) x : y ? z
(d) x -> y : z
(viii) How do you check if the next input is an integer using the Scanner class?
(ix)
ps
(a) isInt()
(b) hasNextInt()
(c) nextInt()
(d) checkInt()
(xi) Which of the following is a valid way to compare if two strings, str1 and str2, are
equal in Java?
(a) str1 == str2
(b) str1.equals(str2)
(c) str1.equals = str2
(d) str1.compare(str2)
(xv) If a class does not define any constructors, what kind of constructor(s) will be provided
by default in Java?
(a) Default constructor with parameters
(b) No constructor will be provided
(c) Default constructor without parameters
(d) Parameterized constructor with default values
(xvi) ps
Assertion (A): A class in Java is known as an object factory.
Reason (R): Objects are created from a class that contains common attributes and
behaviour.
(a) Both Assertion and Reason are true and Reason is the correct explanation of
Assertion.
(b) Both Assertion and Reason are true and Reason is not the correct explanation of
Assertion.
(c) Assertion is true and Reason is false.
(d) Assertion is false and Reason is true.
(xix) What is the purpose of this keyword within a class method in Java?
(a) To refer to the current instance of the class
(b) To create a new object
(c) To access a static variable
(d) To declare a constructor
Question 2
(i) Write the output of the following: [2]
(a) "Java Programming".substring(5, 12)
(b) "Java is fun!".indexOf("Python") + ""
(ii) Predict the output of the following code snippet: [2]
String a = "15";
String b = "3";
int result = Integer.parseInt(a)/Integer.parseInt(b);
System.out.print(result);
(iii) How many times will the following loop execute? [2]
int limit = 8;
for (int i = 3; i <= 10; i++) {
if (i > limit) {
ps break;
}
System.out.println("Iteration " + i);
}
Question 3 [15]
Write a program to accept a number and print it in the reverse order.
Question 4 [15]
Write a program to initialise the given data in an array and find the minimum and maximum
values along with the sum of the given elements.
Numbers: 12, 15, 14, 11, 13
Output:
Minimum value: 11
Maximum value: 15
Sum of the elements: 65
Question 5 [15]
Write a program to input ten words in an array. Arrange these words in descending order of
alphabets, using selection sort technique. Print the sorted array.
ps
Question 6 [15]
Write a program to input a number and check and print whether it is a Pronic number or not.
(Pronic number is a number which is the product of two consecutive integers.)
Examples:
42 = 6 × 72
40 = 15 × 16
Question 7 [15]
Ki
Design a class to overload a function area( ) as follows:
(i) double area (double a, double b, double c) with three double arguments, returns the area
of a scalene triangle using the formula:
𝑎𝑟𝑒𝑎 = √𝑠(𝑠 − 𝑎)(𝑠 − 𝑏)(𝑠 − 𝑐)
where
𝑎+𝑏+𝑐
𝑠=
2
(ii) double area(int a, int b, int height) with three integer arguments, returns the area of a
trapezium using the formula:
1
𝑎𝑟𝑒𝑎 = ℎ𝑒𝑖𝑔ℎ𝑡(𝑎 + 𝑏)
2
(iii) double area(double diagonal1, double diagonal) with two double arguments, returns the
area of a rhombus using the formula:
1
𝑎𝑟𝑒𝑎 = (𝑑𝑖𝑎𝑔𝑜𝑛𝑎𝑙1 ∗ 𝑑𝑖𝑎𝑔𝑜𝑛𝑎𝑙2)
2
\********/
*\******/*
**\****/**
***\**/***
****\/****
****/\****
***/**\***
**/****\**
*/******\*
/********\
ps
Ki