Phases-of-Compilers
Question 1 |
Consider the following ANSI C program:
int main() {
Integer x;
return 0;
}
Which one of the following phases in a seven-phase C compiler will throw an error?
int main() {
Integer x;
return 0;
}
Which one of the following phases in a seven-phase C compiler will throw an error?
Syntax analyzer | |
Lexical analyzer | |
Semantic analyzer | |
Machine dependent optimizer |
Question 1 Explanation:
Integer will be considered as a variable and hence it will be treated as an undeclared identifier and so it is a semantic error.
Question 2 |
Consider the following statements regarding the front-end and back-end of a compiler
S1: The front-end includes phases that are independent of the target hardware
S2: The back-end includes phases that are specific to the target hardware
S3: The back-end includes phases that are specific to the programming language used in the source code. Identify the CORRECT option
S1: The front-end includes phases that are independent of the target hardware
S2: The back-end includes phases that are specific to the target hardware
S3: The back-end includes phases that are specific to the programming language used in the source code. Identify the CORRECT option
Only S1 is TRUE | |
Only S1 and S2 are TRUE | |
S1, S2, and S3 are all TRUE | |
Only S1 and S3 are TRUE |