PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 04?

An application will upload data by using HTML form-based encoding. The application uses a method
named SendMessage.
The SendMessage() method includes the following code. (Line numbers are included for reference
only.)

The receiving URL accepts parameters as form-encoded values.
You need to send the values intA and intB as form-encoded values named a and b, respectively.
Which code segment should you insert at line 04?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
WebClient.UploadValuesTaskAsync – Uploads the specified name/value collection to the resource
identified by the specified URI as an asynchronous operation using a task object. These methods do
not block the calling thread.
http://msdn.microsoft.com/en-us/library/system.net.webclient.uploadvaluestaskasync.aspx

2 Comments on “Which code segment should you insert at line 04?

  1. MotasemB says:

    01 public Task SendMessage(string url, int intA, intB)
    02 {
    03 var client = new WebClient();
    04
    05 }

    A) var data = string.Format(“a”={0}&b={1}”, intA, intB);
    return client.UploadSttringTaskAsync(new Uri(url), data);

    B) var data = string.Format(“a”={0}&b={1}”, intA, intB);
    return client.UploadFileTaskAsync(new Uri(url), data);

    C) var data = string.Format(“a”={0}&b={1}”, intA, intB);
    return client.UploadDataTaskAsync(new Uri(url), Encoding.UTF8.GetBytes(data));

    D) var nvc = new NameValueCollection() { { “a”, intA.ToString() }, { “b”, intB.ToString() } };
    return client.UploadValuesTaskAsync(new Uri(url), nvc);




    0



    0

Leave a Reply