Practice free →
HomeGATE CSEcomputerscience › Compiler Design

GATE CSE Compiler Design — practice questions

28 free MCQs with worked solutions. Tap any question for the answer + explanation, or practice them all in the app.

Practice GATE CSE Compiler Design in the app →
The SCANNER (or LEXER) is the FIRST phase of a compiler. Its job is toThe DIFFERENCE between a TOKEN and a LEXEME isWhich formalism is most commonly used to specify the LEXICAL structure of programming language tokens?The MAXIMAL MUNCH rule for lexical analysis says that when two rules can both matchHow are RESERVED WORDS (keywords like 'if', 'while') typically handled by a scanner?Scanning a comment like `// hello` in C-style languages typically results inA scanner usually IGNORES which characters?An IDENTIFIER in most C-family languages follows the regexA FINITE AUTOMATON used in the scanner is typicallyIf a programmer writes `1.5e3` in a C-style language, the scanner should produceWhen the scanner encounters an INVALID character (e.g. '@' in a language that doesn't use it), it typicallyIn an LL(1) language, the scanner produces tokens that the parser examinesWhich is a token (TYPE) emitted by a typical C-style scanner?The scanner usually emits an EOF (end-of-file) token after the last real token. Why?A PARSER converts a stream of tokens intoRECURSIVE DESCENT parsers translate each grammar rule intoRecursive descent is a TOP-DOWN parsing strategy. Its main weakness isAn AMBIGUOUS grammar is one whereHow does a parser typically encode OPERATOR PRECEDENCE in the grammar?What is a SYNTAX ERROR?PANIC MODE error recovery in a parser works byLL parsers (recursive descent) parse from theAn LL(1) grammar requires that, given the leftmost non-terminal and ONE token of lookahead, the parser canWhich of these is a BOTTOM-UP (LR) parser feature?A SHIFT/REDUCE CONFLICT in an LR parser occurs whenAfter the parser produces an AST, the next compiler phase is typicallyThe FIRST(α) set of a string α in LL parsing isThe FOLLOW(A) set in LL parsing is