{Week 1 & 2} Compiler Design nptel Assignment Answers 2025

NPTEL Compiler Design Week 2 Assignment Answers 2025

1. A regular expression represents

a) Part of a language
b) Cannot represent any language
c) Constituent strings of a language
d) None of the other options

Answer :- c

2. When expression sum=3+2 is tokenized then what is the token category of 3

a) Identifier
b) Assignment operator
c) Integer literal
d) Addition operator

Answer :- c

📚 Did you know that 60-80% of the questions in the final exam are often repeated from previous years? 🎯 Boost your chances of success by exploring answers for NPTEL courses from past years on Answer GPT! 👇👇👇👇

3. For the Fortran language statement “DO 5 1 = 1.25” returns token IDENTIFIER for DO 5
I after looking upto

a) 1
b) =
c) •
d) 5

Answer :- For Answer Click Here 

4. Which of the following are Lexemes?

a) Identifiers
b) Constants
c) Keywords
d) All of the mentioned

Answer :- 

5. A regular expression for accepting strings with exactly one 1 more than O’s is

a) 01
b) (0|1)*1(0|1)*
c) (0|1)*1(0|1)*|1(0|1)*
d) Not Possible

Answer :- 

6. Which one of the following languages over the alphabet (0,1} is described by the regular
expression: (0+1)*0(0+1)*0(0+1)*

a) The set of all strings containing the substring 00.
b) The set of all strings containing at most two O’s.
C) The set of all strings containing at least two O’s.
d) The set of all strings that begin and end with either 0 or 1.

Answer :- 

7. Finite automata is an implementation of

a) Regular expression
b) Any grammar
c) Part of the regular expression
d) None of the other options

Answer :- 

8. The automation which allows transformation to a new state without consuming any input
symbols:

a) NFA
b) DFA
c) Pushdown automata
d) All of the mentioned

Answer :- For Answer Click Here 

9. The____________ of a set of states, P, of an NFA is defined as the set of states reachable from
any state in P following s-transitions

a) s-closure
b) s-park
c) Q in the tuple
d) None of the mentioned

Answer :- 

10. Between NFA and DFA which one is powerful

a) NFA
b) DFA
c) Equally powerful
d) Cannot be said definitely

Answer :- 

11. Subset Construction method refers to

a) Conversion of NFA to DFA
b) DFA minimization
c) Eliminating null references
d) &-NFA to NFA

Answer :- 

12. Which of the following do we use to form an NFA from a regular expression

a) Subset construction method
b) Powerful set construction method
c) Thompson construction method
d) Scott construction method

Answer :- 

13. A certain compiler corrects errors like “fi” to “if” automatically. This is an example of recovery in

a) Panic mode
b) Delete character
c) Replace Character
d) Transpose character

Answer :- For Answer Click Here 

NPTEL Compiler Design Week 1 Assignment Answers 2025

1. 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

2. Which phase of compiler is Syntax Analysis?

a) First
b) Second
c) Third
d) None of the mentioned

Answer :- b

3. Output of the syntax analysis is called

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

Answer :- For Answer Click Here 

4. A peter am the 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 :- 

5. Which of these is not true about Symbol Table

a) All the labels of the instructions are symbols
b) Table has entry for symbol name address value
c) Perform the processing of the assembler directives
d) Created during pass 1

Answer :- 

6. A compiler can check

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

Answer :- For Answer Click Here 

7. Error recovery helps to

a) Report multiple errors
b) Rectify multiple errors
c) Both report and rectify multiple errors
d) None of the other options

Answer :- 

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

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

Answer :- 

9. 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 :- 

10. For maximum speed of execution of target code, temporary variables be best allocated to

a) Swap space
b) Main memory
c) CPU registers
d) None of the other options

Answer :- 

11. Intermediate code helps in

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

Answer :- 

12. Output file of Lex is___________ the input file is Myfile

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

Answer :- For Answer Click Here 

Leave a Comment