NEW
Font size
WorksheetsCompiler Design Quiz
Total questions: 25
Worksheet time: 13mins
Which of the following is true about an interpreter compared to a compiler?
Interpreter is faster in execution than compiler.
Interpreter requires less memory.
Interpreter executes source program line by line.
Interpreter generates intermediate code.
A startup develops a mobile app in Python but wants to release the same in C for performance. Which translator is needed?
Interpreter
Compiler
Cross-compiler
Assembler
A new IoT device has only 1KB RAM and needs fast execution. Which approach should the company choose?
Interpretation
Compilation
Hybrid (bytecode + VM)
None
Which of the following language processors uses two passes – one for analysis and another for synthesis?
Linker
Loader
Compiler
Interpreter
The output of a lexical analyzer is:
Parse tree
Syntax tree
Set of tokens
Machine code
A compiler detects undeclared variable use. Which phase finds this error?
Lexical analysis
Syntax analysis
Semantic analysis
Code generation
Intermediate code in a compiler is generated to:
Increase execution speed
Make compiler design machine independent
Optimize source program
Reduce parsing time
In an online judge system (like HackerRank), code is converted to an intermediate representation before execution. Which compiler phase handles this?
Lexical analysis
Intermediate code generation
Optimization
Symbol table management
If a compiler reports 'missing semicolon', which phase identifies it?
Lexical
Syntax
Semantic
Code generation
Which phase is directly responsible for mapping identifiers to memory locations?
Lexical
Semantic
Symbol table management
Code generation
Which of the following is not a token?
Identifier
Keyword
Comment
Constant
A text editor must highlight keywords while typing. Which compiler phase’s functionality is mimicked?
Semantic
Syntax
Lexical analysis
Optimization
Why is input buffering required in lexical analysis?
To store tokens
To speed up token recognition
To minimize I/O operations
Both b and c
In compiler design, the end-of-file is generally denoted by:
Blank space
Null token
EOF symbol
End of string
A web browser is parsing an HTML file. Which stage will detect
Lexical analyzer
Parser
Semantic analyzer
Intermediate code generator
Which of the following statements is true?
Every DFA is also an NFA.
Every NFA is also a DFA.
NFA and DFA have different expressive power.
None of these.
Convert regular expression (a|b)*abb into DFA. How many states minimum?
3
4
5
6
A spam filter marks any email containing 'win' or 'free'. Which concept is applied?
Context-free grammar
DFA from regular expressions
Semantic analysis
Pushdown automata
Which of the following is regular?
{anbn|n≥0}
{w ∈ {0,1}*|w has equal 0s and 1s}
{w|w is palindrome over {a,b}}
{w|number of a’s is divisible by 3}
A digital lock accepts only strings ending with 101. Which automaton models this?
NFA with 3 states
DFA with 4 states
DFA with 3 states
PDA
Which regular expression denotes binary strings divisible by 2?
(0|1)0
(0|1)1
0
(0|1)
Minimizing DFA is done to:
Reduce transition count
Reduce execution time
Improve memory efficiency
All of these
Which of the following languages is not regular?
{0n|n≥0}
{0n1n|n≥0}
{w|w contains substring 010}
{w|w ends with 00}
A company wants to develop a tool that converts log files into structured JSON format. Which compiler tool is closest?
Parser
Lex tool
Assembler
Loader
Which of the following is NOT a function of Lex tool?
Token recognition
DFA construction
Syntax tree generation
Automating lexical analysis
