PrepAway - Latest Free Exam Questions & Answers

How should you complete the relevant code?

DRAG DROP
You are creating a method that will split a single input file into two smaller output files.
The method must perform the following actions:
Create a file named header.dat that contains the first 20 bytes of the input file.
Create a file named body.dat that contains the remainder of the input file.
You need to create the method.
How should you complete the relevant code? (To answer, drag the appropriate code
segments to the correct locations in the answer area. Each code segment may be used
once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)

PrepAway - Latest Free Exam Questions & Answers

Answer:

9 Comments on “How should you complete the relevant code?

  1. Andre Aranha says:

    3 – 4 – 7: I tested and researched around.

    “offset” and “count” parameters of “Stream.Read” / “Stream.Write” methods ALWAYS refer to the array you are sending in the first parameter.

    The position of fsSource advances as you Read it, unless you .Seed on it.




    1



    0
      1. kasp says:

        if you use
        fsBody.Write(body, 20, body.Length);
        you get the following exception:

        Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.




        2



        0

Leave a Reply