PrepAway - Latest Free Exam Questions & Answers

How should you complete the relevant code?

You develop an application that displays information from log files.
When a user opens a log file by using the application, the application throws an exception and closes.
The application must preserve the original stack trace information when an exception occurs.
You need to implement the method that reads the logfiles.
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 orscroll to view content.)

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:

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

  1. fhmcnkskl says:

    StringReader takes input as string and read over this input string.
    StreamReader takes input as string of file path and stream over this file.

    So answer is;
    using (StringReader sr = new StringReader(“log.txt”))
    throw;




    0



    1
    1. MrTrueAnswer says:

      Exactly as you said “StreamReader takes input as string of file path and stream over this file.”

      so answer is:
      using (StreamReader sr = new StreamReader(“log.txt”))
      throw;




      5



      0
  2. Karabo Sepoloabe says:

    The Compiler will not execute the try inside using.
    isn’t the syntax for using after interpretation/compilation
    try
    {
    try
    {

    }
    catch(FileNotFoundException ex)
    {
    throw;
    }
    }
    finally
    {

    }

    //since the exception is thrown in the outer try the try inside will never execute




    0



    1

Leave a Reply