Question: Which code snippet correctly declares a custom exception named InvalidResponse?

  1. struct InvalidResponse: Exception {}
  2. class InvalidResponse: Exception {}
  3. public Exception InvalidResponse = new Exception ();
  4. public Exception InvalidResponse () -> Exception;

Answer: The correct answer of the above question is Option B:class InvalidResponse: Exception {}