MCQ Practice Single Best Answer Topic: ICSE Computer Application - Class X - 2025 PYQ

Q What is the output of the statement given below?

"ANGER".compareTo("ANGEL")

Question ID
#24167
Subchapter
ICSE Computer Application - Class X - 2025 PYQ
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A 3
  • B -6
  • C 6
Correct Answer: C

Explanation

The compareTo() method compares two strings lexicographically.

  • "ANGER".compareTo("ANGEL") compares characters at each position.

  • 'R' - 'L' = 82 - 76 = 6, so the result is 6.

  • Since "ANGER" comes after "ANGEL" lexicographically, the result should be positive.

  • Correct answer: (c) 6 (Correction from previous choice!)

Share This Question

Share this MCQ with your friends or study group.