MCQ
Single Best Answer
Moderate
QGive the output of the following string functions:
"LANGUAGE".replace('A', '0'); "PROGRAM".compareTo("Program");
ID: #23885
ICSE Computer Application - Class X - Selection Examination - 2024-25 - MCQ - CALCUTTA PUBLIC SCHOOL
90 views
Question Info
#23885Q ID
ModerateDifficulty
ICSE Computer Application - Class X - Selection Examination - 2024-25 - MCQ - CALCUTTA PUBLIC SCHOOLTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option B
Explanation
Explanation:
"LANGUAGE".replace('A', '0');
Replaces all occurrences of 'A' with '0' in the string.
Result: "L0NGU0GE".
"PROGRAM".compareTo("Program");
Compares the strings lexicographically.
Java uses ASCII values, and the difference in case ('P' in uppercase vs. 'p' in lowercase) gives -32.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic