GIAC
GSSP-.NET · Question #230
GSSP-.NET Question #230: Real Exam Question with Answer & Explanation
Sign in or unlock GSSP-.NET to reveal the answer and full explanation for question #230. The question stem and answer options stay visible for context.
Question
- (Topic 2) Allen works as a Software Developer for ABC Inc. He develops a Windows application. He adds a form to the application named Form1, which contains a Label control named Label1. A text file named File1.txt contains a list of products. File1.txt is located in the application directory. Each product name is listed in a new line in File1.txt. Allen wants to retrieve a list of products from File1.txt and display it in Label1. He adds the following code to the application: 1. StreamReader Reader1 = new StreamReader((Stream)File.OpenText(Server.MapPath ("File1.txt"))); 2. Stream MyStream; 3. string InputString; 4. // Insert statement here. 5. while (InputString != null) 6. { 7. Label1.Text = String.Format("{0}{1}", Label1.Text, InputString); 8. Reader1.ReadLine(); 9. } 10. Reader1.Close(); Which of the following statements will Allen add at line 4 to accomplish the task?
Options
- AInputString = Reader1.ReadLine();
- BInputString = Reader1.BaseStream.ToString();
- CInputString = MyStream.ToString();
- DInputString = MyStream.Read(b,0,Byte1.Length).ToString();
Unlock GSSP-.NET to see the answer
You've previewed enough free GSSP-.NET questions. Unlock GSSP-.NET for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.