‹ Back to the paper
In Java, the String class is used to create and manipulate strings, and it is immutable. Given…
Assertion: In Java, the String class is used to create and manipulate strings, and it is immutable.
Reason: Immutability ensures that once a String object is created, its value cannot be changed.
Given below are two statements marked Assertion and Reason. Read the two statements carefully and choose the correct option.
- (a)Both Assertion and Reason are true and Reason is the correct explanation for Assertion.
- (b)Both Assertion and Reason are true but Reason is not the correct explanation for Assertion.
- (c)Assertion is true and Reason is false.
- (d)Assertion is false and Reason is true.
Answer
Answer
Official answer keyCorrect option: (a)
Answer: (a) Both Assertion and Reason are true and Reason is the correct explanation for Assertion.
The Assertion is true: Java's String class is used to create and manipulate strings, and String objects are immutable. The Reason is true and directly explains the Assertion: immutability means that once a String object is created, its value/content can never be changed - any apparent modification actually creates a new String object.
From ISC 2025 Specimen Computer Science Paper 1, question 1(vii).