Compiler Design | NPTEL 2022 | Week 1 Assignment Solutions

This set of MCQ(multiple choice questions) focuses on the Compiler Design NPTEL 2022 Week 1 Assignment Solutions.

Course layout

Answers COMING SOON! Kindly Wait!

Week 1: Assignment answers
Week 2: Assignment answers
Week 3: Assignment answers
Week 4: Assignment answers
Week 5: Assignment answers
Week 6: Assignment answers
Week 7: Assignment answers
Week 8: Assignment answers
Week 9: Assignment answers
Week 10: Assignment answers
Week 11: Assignment answers
Week 12: Assignment answers

NOTE: You can check your answer immediately by clicking show answer button. This set of “Compiler Design NPTEL 2022 Week 1 Assignment Solution” contains 10 questions.

Now, start attempting the quiz.

Compiler Design NPTEL 2023 Week 1 Assignment Solutions

Q1. Which phase of compiler does NOT use symbol table?

a) Code generation
b) Syntax Analysis
c) Lexical Analysis
d) None of the other options

Answer: d) None of the other options

Q2. Which of the following describes the outputs of lexical analysis phase?

a) Symbols
b) Tokens
c) Keywords
d) All of the other options

Answer: b) Tokens

Q3. Phase of the compiler scanning the input sequence is known as

a) Input scanning
b) Lexical analysis
c) Structure analysis
d) Syntax analysis

Answer: b) Lexical analysis

Q4. How can error recovery be useful?

a) It reports multiple errors
b) It rectifies multiple errors
c) It reports multiple errors but rectifies single error
d) None of the above

Answer: a) It reports multiple errors

Q5. Output of syntax analysis is called

a) Parse tree
b) Keyword tree
c) Binary tree
d) All of the other options

Answer: a) Parse tree

Compiler Design NPTEL week 1 Assignment Solutions

Q6. A compiler can check

a) Logical error
b) Syntax error
c) Both logical error and syntax error
d) Not logical and syntax error

Answer: b) Syntax error

Q7. The major area for optimization is loop as

a) Loop may go to infinite execution
b) Condition check takes exceeding large time
c) Loop body is repeated several times
d) None of the above

Answer: c) Loop body is repeated several times

Compiler Design NPTEL week 1 Assignment Solutions

Q8. Most of the programming language follows

a) Static scoping
b) Dynamic scoping
c) Both static and dynamic scoping
d) Neither static nor dynamic scoping

Answer: a) Static scoping

Compiler Design NPTEL week 1 Assignment Solutions

Q9. Loops are the major targets for optimization since

a) Loop may go to infinite execution
b) Loop body is repeated to several times
c) Condition check takes exceedingly large time
d) None of the other options

Answer: b) Loop body is repeated to several times

Q10. Symbol table is created by

a) Lexical analyzer
b) Syntax analyzer
c) Both lexical and syntax analyzer
d) Neither lexical nor syntax analyser

Answer: c) Both lexical and syntax analyzer

Compiler Design NPTEL week 1 Assignment Solutions

Q11. Which of the following relates to intermediate code?

a) Code check
b) Program analysis
c) Code optimization
d) Retargeting code

Answer: d) Retargeting code

Q12. Output file of Lex is _____ the input file is Myfile

a) Myfile.e
b) Myfile.yy.c
c) Myfile.lex
d) Myfile.obj

Answer: b) Myfile.yy.c

Q13. A programming language does not allow integer division operation. This is generally detected in the phase of

a) Lexical Analysis
b) Syntax Analysis
c) Semantic Analysis
d) None of the other options

Answer: c) Semantic Analysis

Compiler Design NPTEL 2022 Week 1 Assignment Solutions

Q1. What role does intermediate code play?

a) Retargeting code
b) Program analysis
c) Code optimization
d) Code check

Answer: a) Retargeting code

Q2. What is the name of the phase in which the compiler scans the input sequence?

a) lexical analysis
b) output scanner
c) structural analysis
d) syntax analysis

Answer: a) lexical analysis

Q3. Which computer program takes a high-level language and translates it to assembly language?

a) Linker
b) Assembler
c) Compiler
d) Interpreter

Answer: c) Compiler

Q4. Compiler helps in debugging via

a) Printing variable values
b) Slower execution of the program
c) Additional code embedding
d) None of the above options

Answer: c) Additional code embedding

Q5. Most of the programming language follows

a) dynamic scoping
b) static scoping
c) both static and dynamic scoping
d) Neither static nor dynamic scoping

Answer: b) static scoping

Compiler Design NPTEL week 1 Assignment Solutions

Q6. Which temporary variables must be allocated for the best code execution speed?

a) CPU registers
b) Swap space
c) Main Memory
d) None of the above options

Answer: a) CPU registers

Q7. What is the name of the syntax analysis output?

a) Key tree
b) binary tree
c) parse tree
d) sparse tree

Answer: c) parse tree

Compiler Design NPTEL week 1 Assignment Solutions

Q8. Converting a hardware description into actual circuitry is known as

a) HDL compilation
b) Circuit compilation
c) Silicon compilation
d) None of the other options

Answer: c) Silicon compilation

Compiler Design NPTEL week 1 Assignment Solutions

Q9. What are the results of the lexical analysis phase?

a) tokens
b) keyword
c) symbols
d) None of the above options

Answer: a) tokens

Q10. Which of the following is a result of a compiler?

a) Error messages
b) Warnings
c) Target code
d) All of the above options

Answer: d) All of the above options

Compiler Design NPTEL week 1 Assignment Solutions

Q11. Loops are the major targets for optimization since

a) Loop body is repeated several times
b) Condition check takes exceedingly large time
c) Loop may goto infinite execution
d) None of the other options

Answer: a) Loop body is repeated several times

<< Prev- Compiler Design Week 0 Assignment Solutions

>> Next- Compiler Design Week 2 Assignment Solutions


NPTEL answers: Problem solving through programming in C

Programming in Java NPTEL week 1 quiz answers

NPTEL – Python for Data Science assignment solutions

Nptel – Deep Learning assignment solutions

The above question set contains all the correct answers. But in any case, you find any typographical, grammatical or any other error in our site then kindly inform us. Don’t forget to provide the appropriate URL along with error description. So that we can easily correct it.

Thanks in advance.

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.

Leave a Comment

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