[Week 1] NPTEL Compiler Design Assignment Answers 2024

Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

NPTEL Compiler Design Week 1 Assignment Answers 2024

1. Which of the following is a stage of the compilation process?

(A) Syntax analysis
(B) Intermediate code generation
(C) Code generation
(D) All of the mentioned

Answer :- For Answer click Here

2. A programmer writes instructions to multiply two numbers instead of adding them by mistake within a program. Which of the following is true in this context?

(A) Lexical analysis phase of compilation process can detect the error
(B) Syntax analysis phase of compilation process can detect the error
(C) In code generation phase the error can be detected
(D) This error cannot be detected by a compiler

Answer :- For Answer click Here

3. Name the system program that is used to combine a program’s several compiled modules into a executable form:

(A) Interpreter
(B) Assembler
(C) Compiler
(D) Linking Loader

Answer :- 

4. The output of a lexical analyzer is:

(A) A parse tree
(B) Intermediate code
(C) A stream of tokens
(D) Machine code

Answer :- 

5. How many lexemes are there in the following code: int main( ) { printf(“%d + %d = %d”, 3, 1, 4); return 0; }

(A) 18
(B) 20
(C) 22
(D) 24

Answer :- 

6. Which of the following is/are true for RISC architecture?

(A) Simplified instruction set leads to faster processing
(B) Execution in a pipeline is not possible
(C) Higher power consumption
(D) Has simple addressing modes

Answer :- For Answer click Here

7. Which particular task of compilation process uses context free grammars (CFG)?

(A) Code optimization
(B) Tokenization of input code
(C) Parsing of tokenized input
(D) None of the above

Answer :- 

8. Which of the following machine model is necessary and sufficient for designing lexical analyzer?

(A) Finite state automata
(B) Pushdown automata
(C) Turing machine
(D) None of the above

Answer :- 

9. Which of the following items are stored in the symbol table?

(A) Variable names and constants from the source program
(B) Procedure and function names from the source program
(C) Label names present in the source program
(D) All of the above mentioned

Answer :- 

10. Suppose that the access time of an implemented symbol table is logarithmic. Then the symbol table has been implemented using:

(A) Search tree
(B) Linear list
(C) Hash table
(D) None of the above

Answer :- For Answer click Here

11. Which of the following can be managed fully during compilation?

(A) Static memory allocation
(B) Dynamic memory allocation
(C) Both (A) and (B)
(D) Neither (A) nor (B)

Answer :- 

12. Which of the following is NOT TRUE in the context of syntax analysis phase of compilation?

(A) Input to the syntax analysis phase are tokens from lexical analyzer
(B) Syntax analysis phase checks syntactic (grammatical) correctness
(C) It checks if the input program can be derived from the start symbol of a grammar using the grammar rules
(D) Syntax analysis phase can determine if a variable is declared before it is being used

Answer :- For Answer click Here

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top