DP-700 · Question #45
You have the following code segment: def loading_pattern_sample(df_source): try: deltatable = DeltaTable.forName(spark, target_table) except Exception as e…
The correct answer is B. No. The provided Python code segment contains a fundamental error in its exception handling structure, making the second except block unreachable.
Question
Options
- AYes
- BNo
How the community answered
(38 responses)- A37% (14)
- B63% (24)
Why each option
The provided Python code segment contains a fundamental error in its exception handling structure, making the second `except` block unreachable.
The statement is false because the code contains a structural error where the second `except` block is unreachable, leading to incorrect error handling logic.
The code has a logical flaw in its exception handling structure: the second `except Exception as e:` block directly following the first `try-except` block will never be executed. If an exception occurs within the initial `try` block, it will be caught by the first `except Exception as e:`, making the subsequent `except` block unreachable according to Python's exception handling rules.
Concept tested: Python try-except block execution flow
Topics
Community Discussion
No community discussion yet for this question.