11. Which tool is used for grouping of characters in tokens in the compiler?
- Parser
- Code generator
- Scanner
- Code optimizer
Answer : C Explanation: Scanner is used for grouping of characters in tokens in the compiler. Scanner is a subroutine which is called by the compiler program and it combines the characters and implements them to produce tokens. So, option C is correct.
12. A set of instructions executed directly by a computer’s central processing unit is
- Command Language
- Machine Language
- Style Sheet Language
- Markup Language
Answer : B Explanation: A set of instructions executed directly by a computer’s central processing unit is machine language.
13. The method which merges the bodies of two loops is
- Loop unrolling
- Constant folding
- Loop jamming
- None of the above
Answer : C Explanation: The method which merges the bodies of two loop is loop jamming.
14. Which of the following actions an operator precedence parser may take to recover from an error?
- Delete symbols from the stack
- Inserting or deleting symbols from the input
- Insert symbols onto the stack
- All of the above
Answer : D Explanation: The actions an operator precedence parser may take to recover from an error are: Delete symbols from the stack, Inserting or deleting symbols from the input and Insert symbols onto the stack, so all of the above option is correct.
15. What is the output of the lexical analyzer?
- A parse tree
- A list of tokens
- Machine code
- Intermediate code
Answer : B Explanation: The output of lexical analyzer is a list of tokens.
Computer Networks MCQ Questions And Answers
16. When is the type checking usually done?
- During syntax directed translation
- During syntax analysis
- During lexical analysis
- During code optimization
Answer : A Explanation: The type checking usually done during syntax directed translation.
17. A grammar that produces more than one parse tree for some sentence is called as
- Unambiguous
- Ambiguous
- Regular
- None of the above
Answer : B Explanation: A grammar that produces more than one parse tree for some sentence is called as ambiguous grammar.
18. Lexical analysis is about breaking a sequence of characters into
- Packets
- Lines
- Tokens
- Groups
Answer : C Explanation: Lexical analysis is about breaking a sequence of characters into tokens.
19. What is the use of a symbol table in compiler design?
- Finding name’s scope
- Type checking
- Keeping all of the names of all entities in one place
- All of the above
Answer : D Explanation: The use of a symbol table in compiler design are: Finding name’s scope, Type checking, Keeping all of the names of all entities in one place. So, all of the above option is correct.
20. Identify the data structure which has minimum access time in case of symbol table implementation?
- Hash table
- Self-organizing list
- Linear
- Search tree
Answer : A Explanation: The access time of hash table is O(1) which makes it the most efficient data structure in the case of symbol table implementation.