Which four code segments should you insert in sequence at line 03?

DRAG DROP
You are developing an application that will write data to a file. The application includes the
following code segment. (Line numbers are included for reference only.)
You need to ensure that the WriteData() method will write data to a file.
Which four code segments should you insert in sequence at line 03? (To answer, move the
appropriate code segments from the list of code segments to the answer area and arrange
them in the correct order.)

DRAG DROP
You are developing an application that will write data to a file. The application includes the
following code segment. (Line numbers are included for reference only.)
You need to ensure that the WriteData() method will write data to a file.
Which four code segments should you insert in sequence at line 03? (To answer, move the
appropriate code segments from the list of code segments to the answer area and arrange
them in the correct order.)

Answer: See the explanation.

Explanation:
Box 1:

Box 2:

Box 3:

Box 4:

Note:
* StreamWriter Constructor (String)
Initializes a new instance of the StreamWriter class for the specified file by using the default
encoding and buffer size.
Incorrect:
The StreamWriter class has no method Open.



Leave a Reply 5

Your email address will not be published. Required fields are marked *


My'nD

My'nD

Code is missing.

Jack

Jack

3, 2, 1, 4

kasp

kasp

Looks good to me. Possible example:

class Program
{
static void Main(string[] args)
{
string stringToWrite = “Hi, My name is Bob”;

StreamWriter writer = null;
writer = new StreamWriter(@”C:\temp\target.txt”);
writer.Write(stringToWrite);
writer.Close();
}
}

theAllKnowingGuy

theAllKnowingGuy

yeah the code is missing

rao

rao

3,2,1,4

class Program
{
static void Main(string[] args)
{
string stringToWrite = “Hi, My name is Bob”;

StreamWriter writer = null;
writer = new StreamWriter(@”C:\temp\target.txt”);
writer.Write(stringToWrite);
writer.Close();
}
}

WORK!