Page 493 - CA_Blue( J )_Class10
P. 493
Ans. a. Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)
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 [Analysis]
Ans. 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) [Analysis]
Ans. a. s.length
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) [Analysis]
Ans. b. (3) (4) (1) (2)
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 [Application]
Ans. c. Assertion (A) is true and Reason (R) is false
2. i. Rewrite the following code using single if statement. [2]
if(code=='g')
System.out.println("GREEN");
else if (code=='G')
System.out.println("GREEN"); [Understanding]
Ans. if ( code == 'g' II code == 'G' )
System.out.println("GREEN" );
ii. Evaluate the given expression when the value of a=2 and b=3 [2]
b*=a++-++b+++a;
System.out.println("a="+a);
System.out.println("b="+b); [Analysis]
Ans. a = 4, 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. [2]
boolean x = true;
switch(x)
{ case 1: System.out.println ("WIN"); break;
case 2: System.out.println ("LOOSE");
} [Analysis]
Ans. Statement with error - boolean x=true; To get the required output - int x = 1;
3
iv. Write the Java expression for x + y [2]
[Understanding]
Ans. Math.cbrt(x) + Math.sqrt(y).
491
ICSE SPECIMEN QUESTION PAPER (2025) 491

