Solved

StreamReader InFile = New StreamReader("name.txt");

Question 44

Multiple Choice

StreamReader inFile = new StreamReader("name.txt") ;
While ((inValue = inFile.ReadLine() ) != null)
With the above code segment, how could you programmatically avoid having a FileNotFoundException or DirectoryNotFoundException exception thrown?


A) invoke File.Exists( ) before the while loop
B) invoke File.Exists( ) inside the while loop
C) include a try...catch block
D) test for File.Exists( ) instead of null

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents