Error Detection and Recovery in Parsing MCQs January 8, 2026December 14, 2024 by u930973931_answers 15 min Score: 0 Attempted: 0/15 Subscribe 1. What is the primary goal of error detection in parsing? (A) To identify the lexical errors in the code (B) To optimize the performance of the parser (C) To detect syntax errors in the input code (D) To generate machine code from the parsed input 2. Which of the following is a common method for error recovery in parsing? (A) Halting the parsing process on the first error (B) Inserting or deleting tokens to recover from errors (C) Skipping the rest of the input (D) Ignoring the error and continuing parsing 3. Which of the following strategies is used in top-down parsing for error recovery? (A) Error productions in grammar rules (B) Backtracking (C) Panic mode recovery (D) Predictive error handling 4. In bottom-up parsing, which of the following is a common recovery method when encountering a syntax error? (A) Error rule expansion (B) Adding extra tokens to the input stream (C) Backtracking (D) Panic mode recovery 5. Which of the following is true about panic mode error recovery? (A) It continues parsing from the last valid state (B) It tries to correct errors automatically (C) It backtracks to the previous correct state (D) It skips input until a synchronizing token is found 6. Which of the following is a syntax error in a source program? (A) Missing semicolon at the end of a statement (B) Mismatched parentheses (C) Incorrect use of a variable (D) Division by zero 7. Which of the following error recovery techniques can be implemented in both top-down and bottom-up parsers? (A) Panic mode recovery (B) Backtracking (C) Lookahead parsing (D) Semantic error handling 8. In top-down parsing, if an error occurs, the parser may use which of the following recovery methods? (A) Switching to another parsing strategy (B) Deleting the erroneous tokens from the input (C) Backtracking to the previous valid state (D) Skipping symbols until a valid rule can be applied 9. Which of the following is an advantage of error productions in grammar for error recovery? (A) It enables parsing to continue despite syntax errors (B) It allows for immediate correction of errors (C) It reduces the time complexity of parsing (D) It prevents the parser from encountering errors 10. What is the key challenge in error recovery during parsing? (A) Ensuring that the parser does not backtrack too much (B) Detecting semantic errors in the code (C) Reducing the number of grammar rules (D) Finding a valid token after an error 11. Which of the following is a technique where the parser discards input until a token is found that can continue parsing? (A) Backtracking (B) Error production (C) Panic mode (D) Lookahead 12. Which of the following recovery techniques involves inserting a missing token to fix a syntax error? (A) Panic mode recovery (B) Token insertion (C) Error productions (D) Backtracking 13. Which of the following is NOT typically a part of error recovery in parsers? (A) Error detection (B) Token insertion or deletion (C) Semantic error reporting (D) Syntax error recovery 14. In bottom-up parsing, when an error is detected, what is one potential recovery method? (A) Skip to the next function definition (B) Remove the entire syntax tree (C) Backtrack and try a different rule (D) Insert a default production rule 15. Which of the following is a typical synchronizing token used in error recovery? (A) Delimiters such as parentheses, braces, or semicolons (B) Keywords like if, else, or for (C) Arithmetic operators like +, -, or * (D) Function names and identifiers