Solved

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

Question 66

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