You are writing a method that accepts a string parameter named message.
Your method must break the message parameter into individual lines of text and pass each line to a second method named Process.
Which code segment should you use?
A. StringReader^ reader = gcnew
StringReader(message);Process(reader->ReadToEnd());reader->Close();
B. StringReader^ reader = gcnew StringReader(message);while(reader->Peak() != -1) {
String^ line = reader->Read().ToString();
Process(line);}reader->Close();
C. StringReader^ reader = gcnew
StringReader(message);Process(reader->ToString());reader->Close();
D. StringReader^ reader = gcnew StringReader(message);while(reader->Peak() != -1) {
Process(reader->ReadLine());}reader->Close();
Answer: D
Your method must break the message parameter into individual lines of text and pass each line to a second method named Process.
Which code segment should you use?
A. StringReader^ reader = gcnew
StringReader(message);Process(reader->ReadToEnd());reader->Close();
B. StringReader^ reader = gcnew StringReader(message);while(reader->Peak() != -1) {
String^ line = reader->Read().ToString();
Process(line);}reader->Close();
C. StringReader^ reader = gcnew
StringReader(message);Process(reader->ToString());reader->Close();
D. StringReader^ reader = gcnew StringReader(message);while(reader->Peak() != -1) {
Process(reader->ReadLine());}reader->Close();
Answer: D
No comments:
Post a Comment