nerdexam
GIAC

GSSP-NET · Question #272

Peter works as a Software Developer for PentaSoft Inc. He develops an application, named App1, using Visual C# .NET. The application is intended to deal with several file input and output…

The correct answer is A. The catch block that handles an exception of type IOException will be executed. See the full explanation below for the reasoning.

Question

Peter works as a Software Developer for PentaSoft Inc. He develops an application, named App1, using Visual C# .NET. The application is intended to deal with several file input and output operations. He uses the following try structure in the application code to handle errors that occur during the execution of App1. try { //Statements that might cause a runtime error. } catch (System.IO.FileNotFoundException ex) { //Statements } catch (System.IO.PathTooLongException ex) { //Statements } catch (System.IO.IOException ex) { //Statements } catch (Exception ex) { //Statements } What will happen if an exception of type System.IO.DirectoryNotFoundException occurs in the try block?

Options

  • AThe catch block that handles an exception of type IOException will be executed.
  • BThe catch block that handles an exception of type Exception will be executed.
  • CThe catch block that handles an exception of type FileNotFoundException will be executed.
  • DThe catch block that handles an exception of type PathTooLongException will be executed.

How the community answered

(40 responses)
  • A
    75% (30)
  • B
    15% (6)
  • C
    3% (1)
  • D
    8% (3)

Community Discussion

No community discussion yet for this question.

Full GSSP-NET Practice