The connection string and error mode setting are correct for throwing exceptions.
Step 2: Analyze the SQL statement
The SQL statement 'INVALID SQL' is not valid SQL, so it triggers a PDOException.
Final Answer:
SQL statement is invalid causing exception -> Option A
Quick Check:
Invalid SQL causes exception = A [OK]
Hint: Invalid SQL triggers PDOException if error mode set [OK]
Common Mistakes:
Assuming connection string is wrong
Forgetting error mode is set correctly
Thinking catch block is missing
5. You want to safely insert user data into a database using PDO and handle errors with exceptions. Which of the following code snippets correctly implements this with prepared statements and exception handling?