Tools for Syntax Analysis (e.g., YACC, Bison) MCQs January 8, 2026December 14, 2024 by u930973931_answers 15 min Score: 0 Attempted: 0/15 Subscribe 1. What does YACC stand for? (A) Yet Another Compiler Compiler (B) Yet Another Context-free Compiler (C) Your Automated Compiler Compiler (D) Your Advanced Compiler Creation 2. Which of the following tools is used for generating parsers based on context-free grammars? (A) YACC (B) Lex (C) GCC (D) Git 3. Which of the following is a primary use of YACC and Bison? (A) Generating tokenizers (B) Compiling source code into machine code (C) Performing syntax analysis (D) Generating parsers from a formal grammar 4. Which of the following tools is a free software replacement for YACC? (A) Lex (B) Bison (C) Flex (D) GCC 5. Which of the following is a feature of the Bison tool? (A) It generates parsers for deterministic context-free grammars (DCFG) (B) It is only compatible with C programming language (C) It is used for lexical analysis (D) It is used for memory management in programming languages 6. In YACC/Bison, the syntax of a grammar rule is defined using: (A) Regular expressions (B) Backus-Naur Form (BNF) (C) Object-Oriented Programming (OOP) (D) Regular grammar 7. What is the output of a YACC/Bison parser? (A) An Abstract Syntax Tree (AST) (B) A lexer (C) Machine code (D) A syntax error report 8. Which of the following is the role of the yacc command in Unix-based systems? (A) Generate a lexical analyzer (B) Generate a parser from grammar specifications (C) Generate machine code (D) Compile source code into object code 9. What is the purpose of the flex tool, often used in combination with YACC/Bison? (A) To optimize the performance of a parser (B) To handle memory management in parsers (C) To generate a lexer from regular expressions (D) To analyze syntax errors in grammar rules 10. Which of the following programming languages are commonly used with YACC and Bison? (A) Python and Java (B) C and C++ (C) JavaScript and PHP (D) Ruby and Perl 11. What does the yyparse() function do in YACC/Bison? (A) It initializes the parser (B) It analyzes the input to ensure it matches the grammar rules (C) It creates a lexical analyzer (D) It compiles the source code into machine code 12. Which of the following is a key difference between YACC and Bison? (A) There is no difference; they are the same tool (B) YACC supports more advanced grammar types than Bison (C) YACC is written in C++, while Bison is written in C (D) Bison is the modern, open-source version of YACC 13. In YACC/Bison, the action code (e.g., C code) is written: (A) In the %% section (B) Between the << and >> symbols (C) Between the %{ and %} symbols (D) In the grammar rule section 14. Which of the following is true about error handling in YACC/Bison? (A) YACC/Bison automatically handles errors without the need for additional code (B) YACC/Bison cannot detect errors in the grammar rules (C) YACC/Bison requires explicit error-handling rules to detect and report syntax errors (D) Error handling in YACC/Bison is only available for lexical analysis, not syntax analysis 15. Which of the following is used in Bison to define precedence and associativity for operators? (A) %left and %right directives (B) %prec directive (C) %type directive (D) %token directive