PrepAway - Latest Free Exam Questions & Answers

Which two code segments can you use to achieve this goal?

You are developing an application by using C#. The application includes a method named SendMessage. The
SendMessage() method requires a string input.
You need to replace “Hello” with “Goodbye” in the parameter that is passed to the SendMessage() method.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete
solution. Choose two.)

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
* The first parameter should be Hello.
* String.Replace Method (String, String)
Returns a new string in which all occurrences of a specified string in the current instance are replaced with
another specified string.
This method does not modify the value of the current instance. Instead, it returns a new string in which all
occurrences of oldValue are replaced by newValue.

2 Comments on “Which two code segments can you use to achieve this goal?


Leave a Reply