Panic Mode and Phrase-Level Recovery MCQs January 8, 2026December 14, 2024 by u930973931_answers 30 min Score: 0 Attempted: 0/30 Subscribe 1. What is the main purpose of error recovery in compiler design? (A) To stop compilation immediately (B) To generate runtime errors (C) To detect and correct errors so that compilation can continue (D) To optimize the code 2. What is panic mode error recovery? (A) Corrects the error and continues from the exact point (B) Discards input symbols until a designated synchronizing token is found (C) Stops compilation entirely (D) Automatically fixes syntax errors without skipping tokens 3. What is the primary advantage of panic mode recovery? (A) It can correct all errors (B) It provides semantic analysis (C) It is simple and guarantees that the parser will eventually continue (D) It avoids scanning the input entirely 4. Which type of errors is panic mode particularly effective for? (A) Single syntax errors (B) Semantic errors (C) Runtime errors (D) Lexical errors 5. How does phrase-level recovery differ from panic mode? (A) It only stops compilation (B) It ignores errors completely (C) It makes local corrections to replace, insert, or delete tokens and then continues (D) It discards the entire program 6. What is a key disadvantage of phrase-level recovery? (A) It is too slow to implement (B) It stops compilation (C) It may introduce cascading errors if the local fix is incorrect (D) It cannot detect syntax errors 7. In panic mode, what is typically used as synchronizing tokens? (A) Random symbols (B) Compiler internal codes (C) Lexical keywords only (D) Statement terminators like semicolons or closing braces 8. Which error recovery method is considered safer for preserving the parse structure? (A) Panic mode (B) Ignoring errors (C) Stopping compilation (D) Phrase-level recovery 9. Which method is easier to implement in a parser? (A) Runtime evaluation (B) Phrase-level recovery (C) Semantic correction (D) Panic mode 10. When a parser discards tokens until a semicolon is found, which error recovery method is it using? (A) Panic mode (B) Phrase-level recovery (C) Semantic recovery (D) Token insertion 11. Phrase-level recovery typically involves which operations? (A) Recompile the source code (B) Discard the entire program (C) Stop compilation (D) Insert, delete, or replace tokens 12. Which of the following is true about panic mode recovery? (A) It corrects errors locally (B) It never loses input symbols (C) It may skip large portions of input (D) It is slow and complex 13. How does panic mode prevent the parser from getting stuck? (A) By inserting random tokens (B) By restarting compilation (C) By rewriting the grammar (D) By skipping symbols until a synchronizing token is found 14. What is a “cascading error”? (A) Errors caused by an earlier incorrect error recovery (B) An error in the lexical analyzer (C) Compiler optimization failure (D) A semantic error 15. Which recovery method tries to minimize cascading errors? (A) Panic mode (B) Phrase-level recovery (C) Stopping compilation (D) Ignoring errors 16. In phrase-level recovery, what is the main goal? (A) Discard all input (B) Skip the entire program (C) Make minimal changes to resume parsing (D) Generate runtime errors 17. Which of the following is an example of a synchronizing token? (A) Variable name (B) Function parameter (C) Semicolon (;) (D) Comment 18. Which error recovery method is generally more robust for large programs? (A) Panic mode (B) Phrase-level recovery (C) Lexical analysis only (D) Semantic checking 19. What is the main risk of using panic mode in nested structures? (A) Skipping important code blocks and losing context (B) Compiler crash (C) Syntax correctness (D) Token insertion errors 20. In phrase-level recovery, replacing a missing token is an example of: (A) Replacement (B) Insertion (C) Deletion (D) Skipping 21. Which error recovery strategy is preferred for interactive development environments? (A) Panic mode (B) Ignore errors (C) Stop compilation (D) Phrase-level recovery 22. When using panic mode, which happens if no synchronizing token is found? (A) The parser guesses the syntax (B) The parser inserts random tokens (C) The parser stops scanning the input (D) The parser continues normally 23. Which method of error recovery can handle multiple errors in a single input efficiently? (A) Phrase-level recovery (B) Panic mode (C) Stopping compilation (D) Ignoring errors 24. What is the simplest form of phrase-level recovery? (A) Restarting compilation (B) Inserting multiple tokens (C) Deleting an unexpected token (D) Ignoring the program 25. What is a common combination in compilers for error recovery? (A) Panic mode only (B) Phrase-level recovery only (C) Panic mode with limited phrase-level recovery (D) Stopping compilation after the first error 26. Which type of grammar errors are most challenging for panic mode? (A) Single missing semicolons (B) Extra whitespace (C) Nested or recursive structures (D) Single-character typos 27. In phrase-level recovery, what is the effect of token insertion? (A) It removes a token (B) It stops parsing (C) It simulates a missing token to continue parsing (D) It restarts the compiler 28. Which method requires less compiler logic to implement? (A) Panic mode (B) Phrase-level recovery (C) Both are equally complex (D) Neither 29. Why is error recovery important in compilers? (A) To make compilation faster (B) To reduce code optimization (C) To allow the detection of multiple errors in one compilation run (D) To replace the source code automatically 30. Which of the following best describes phrase-level recovery? (A) It skips all input after an error (B) It tries local corrections and continues parsing with minimal disruption (C) It stops compilation entirely (D) It discards global variables