MCQ
Single Best Answer
Moderate
QWhat is the output of the statement given below?
"ANGER".compareTo("ANGEL")
ID: #24167
ICSE Computer Application - Class X - 2025 PYQ
124 views
Question Info
#24167Q ID
ModerateDifficulty
ICSE Computer Application - Class X - 2025 PYQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option 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 is6. -
Since "ANGER" comes after "ANGEL" lexicographically, the result should be positive.
-
Correct answer: (c)
6(Correction from previous choice!)
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic