Which of the following code segments will you use to accomplish the task?

Posted by: Pdfprep Category: GSSP-.NET Tags: , ,

You work as a Software Developer for ABC Inc. The company uses Visual Studio .NET 2005 as its application development platform. You are creating an application using .NET Framework 2.0. You are using the StringBuilder class to string values. You want to create a StringBuilder object that can store 75 characters and should be initialized with "ABC". You also want to append a formatted string to the end of the StringBuilder object.

Which of the following code segments will you use to accomplish the task? Each correct answer represents a complete solution. Choose all that apply.
A . StringBuilder MyStrBuild = new StringBuilder(75);
MyStrBuild.AppendFormat("ABC{0}{1}{2}", "INDIA", ‘U’, ‘S’);
B . StringBuilder MyStrBuild = new StringBuilder("ABC", 75);
MyStrBuild.Append("INDIAUS");
C . StringBuilder MyStrBuild = new StringBuilder("ABC");
MyStrBuil.Capacity=75;
MyStrBuild.AppendFormat("INDIA{0}{1}", ‘U’, ‘S’);

D . StringBuilder MyStrBuild = new StringBuilder("ABC", 75);
MyStrBuild.AppendFormat("INDIA{0}{1}", ‘U’, ‘S’);

Answer: C,D

Leave a Reply

Your email address will not be published.