Multiple choice technology programming languages

Try catch block should be used whenever

  1. I/O operation

  2. Database operation

  3. Networking

  4. All of the above

  5. None of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Try-catch blocks should be used for operations that throw checked exceptions: I/O operations (FileNotFoundException, IOException), database operations (SQLException), and networking (SocketException, UnknownHostException). All these scenarios require proper exception handling for robust code.