हिंदी

Given that: String wt = "TELL ME WHEN WILL YOU COME?"; String wu = wt.replace('E', 'A'); How many replacements will take place?

Advertisements
Advertisements

प्रश्न

Given that:

String wt = "TELL ME WHEN WILL YOU COME?";

String wu = wt.replace('E', 'A'); 

How many replacements will take place?

विकल्प

  • 4

  • 3

  • 2

  • 1

MCQ
Advertisements

उत्तर

4

Explanation:

  • The replace('E', 'A') method scans the entire string from left to right and substitutes every single occurrence of the character 'E' with the character 'A'.
  • By looking at the string "T**E**LL M**E** WH**E**N WILL YOU COM**E**?", we can see that the letter 'E' appears exactly four times, meaning four individual character replacements will take place.
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 10: String Handling - Exercises [पृष्ठ २४५]

APPEARS IN

रुपा पंडित Computer Applications [English] Class 10 ICSE
अध्याय 10 String Handling
Exercises | Q 1. (vi) | पृष्ठ २४५
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×