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


Answer: A

Computer Science & Information Technology

You might also like to view...

We can use a shift operator when doubling the capacity of the array or cutting the capacity of an array in half because:

A. shift operators always multiply or divide by a power of 2 B. the array capacity is always a power of 2 in our array expansion/contraction strategy C. doubling the array and cutting the capacity of the array in half both change the capacity of the array from one power of 2 to another D. All of the above

Computer Science & Information Technology

Describe the major difference between lists and libraries

What will be an ideal response?

Computer Science & Information Technology

Which of the Insert Table options allows you to select the number of rows and columns for a table by pointing to individual cells?

A) Insert Table B) Draw Table C) Import D) Table Grid

Computer Science & Information Technology

What software is typically used for larger systems?

a. Microsoft Server b. Canon c. Open Office d. Bitly

Computer Science & Information Technology