Bird
Raised Fist0

Which of the following is the correct syntax for using a finally block in C#?

easy📝 Syntax Q12 of Q15
C Sharp (C#) - Exception Handling
Which of the following is the correct syntax for using a finally block in C#?
Atry { } catch { } finally { }
Btry { } finally { } catch { }
Ctry { } catch { }
Dfinally { } try { } catch { }
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct order of blocks

    In C#, the order is try, then catch (optional), then finally (optional).
  2. Step 2: Match syntax

    Only try { } catch { } finally { } shows the correct order: try { } catch { } finally { }.
  3. Final Answer:

    try { } catch { } finally { } -> Option A
  4. Quick Check:

    Correct block order [OK]
Quick Trick: Remember order: try, catch, then finally [OK]
Common Mistakes:
MISTAKES
  • Placing finally before catch
  • Omitting try block
  • Using finally without try

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes