PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You create a Web service that exposes a Web method named CalculateStatistics.

The response returned by the CalculateStatistics method for each set of input parameters changes every 60 seconds.
You need to ensure that all requests to the CalculateStatistics method that have the same set of input parameters, and that occur within a 60-second time period, calculate the statistics only once.

Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
[WebMethod()]
public string CalculateStatistics (int[] values)
{
HttpContext.Current.Response.Cache.SetCacheability( HttpCacheability.Public, "max-age=60");

}

B.
[WebMethod(CacheDuration=60)]
public string CalculateStatistics(int[] values)
{ … }

C.
[WebMethod()]
public string CalculateStatistics (int[] values)
{
HttpContext.Current.Response.Cache.SetExpires( DateTime.Now.AddSeconds(60));

}

D.
[WebMethod(BufferResponse=60)]
public string CalculateStatistics(int[] values)
{ … }


Leave a Reply