Mock Test 3

  1. In your application, you have implemented the LogException(string message) method to log exceptions. When an exception is thrown from your application, you want to log and rethrow the original exception. How do you achieve this?
    1. catch(Exception ex){LogException(ex.Message); throw;}

    2. catch(Exception ex){LogException(ex.Message); throw ex;}

    3. catch{LogException(ex.Message); throw new Exception();}

    4. catch{LogException(ex.Message); rethrow;}

  2. You have created an application where you have implemented custom exception types and have also implemented multiple log methods, as follows:
public class CustomException1 : System.Exception{}public class CustomException2 : CustomException1 {}public class CustomException3 : CustomException1{} ...

Get Programming in C#: Exam 70-483 (MCSD) Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.