
Compiler Construction - 6001310-3
Mid Term Exam – 29 Nov 2016-11-28
Answer all Questions
Question 1 : True or False
1. Parsers do not parse the whole code if some errors exist in the program. (F)
2. Lexemes are said to be a sequence of characters alphanumeric in a token. (T)
3. There are some predefined rules for every lexeme to be identified as a valid
token.(T)
4. In programming language, keywords, constants, identifiers, strings, numbers,
operators and punctuations symbols can be considered as tokens. (T)
5. CFG is a helpful tool in describing the syntax of programming languages (T)
6. Lexical analysis is the second phase of a compiler. (F)
7. Syntax analyzer takes the modified source code from language preprocessors that
are written in the form of sentences. (F)
8. The lexical analyzer works closely with the syntax analyzer. (T)
9. Syntax analysis or scanner is the first phase of a compiler. (F)
10. We have seen that a syntax analyzer can identify tokens with the help of regular
expressions and pattern rules. (F)
11. Syntax analyzer checks whether the parse tree constructed follows the rules of
language.(F)
12. The semantic analyzer breaks these syntaxes into a series of tokens, by removing
any whitespace or comments in the source code.(F)
13. Regular expressions cannot check balancing tokens, such as parenthesis. (T)
14. Optimization can be assumed as something that removes unnecessary code lines,
and arranges the sequence of statements in order to speed up the program
execution without wasting resources (CPU, memory). (T)
15. If the lexical analyzer finds a token invalid, it generates an error. (T)
16. A pattern explains what can be a token, and these patterns are defined by means of
regular expressions.(T)
17. Lexical analyzer cannot check the syntax of a given sentence due to the limitations
of the regular expressions. (T)
18. Lexical analyzer uses context-free grammar (CFG), which is recognized by push-down
automata.(F)
19. Semantic analyzer keeps track of identifiers, their types and expressions. (T)
20. Regular Grammar is also context-free. (T)