MCQ Computer Science

Compilers Questions and Answers – Lexical Analysis – 1

This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Lexical Analysis – 1”.

 

  1. The output of lexical analyzer is
  2. a) A set of RE
  3. b) Syntax Tree
  4. c) Set of Tokens
  5. d) String Character

Answer

 

Answer: c

Explanation: A lexical analyzer coverts character sequences to set of tokens.

  1. The symbol table implementation is based on the property of locality of reference is
  2. a) Linear list
  3. b) Search tree
  4. c) Hash Table
  5. d) Self Organisation

Answer

 

Answer: c

Explanation: Hash table is used as a reference for symbol table because it is efficient.

  1. For operator precedence parsing, which one is true?
  2. a) For all pair of non-terminal
  3. b) For all pair of non-terminals
  4. c) To delimit the handle
  5. d) None of the mentioned

Answer

 

Answer: a

Explanation: There are two important properties for these operator precedence parsers is that it does not appear on the right side of any production and no production has two adjacent non-terminals. Implying that no production right side is empty or has two adjacent non-terminals. So accordingly to property option (A) is correct.

  1. Object program is a
  2. a) Program written in machine language
  3. b) Program to be translated into machine language
  4. c) Translation of high-level language into machine language
  5. d) None of the mentioned

Answer

 

Answer: c

Explanation: Since the input is the source language and the output that we get after the analysis is the machine language.

  1. Which concept of FSA is used in the compiler?
  2. a) Lexical analysis
  3. b) Parser
  4. c) Code generation
  5. d) Code optimization

Answer

 

Answer: a

Explanation: Because the lexer performs its analysis by going from one stage to another.

  1. Which concept of grammar is used in the compiler
  2. a) Lexical analysis
  3. b) Parser
  4. c) Code generation
  5. d) Code optimization

Answer

 

Answer: b

Explanation: As the lexical analysis of a grammar takes place in phases hence it is synonymous to parser.

  1. Which of the following are Lexemes?
  2. a) Identifiers
  3. b) Constants
  4. c) Keywords
  5. d) All of the mentioned

Answer

 

Answer: d

Explanation: Different Lexical Classes or Tokens or Lexemes Identifiers, Constants, Keywords, Operators.

 

Tags

Related Articles

Leave a Reply

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

Close

Adblock Detected

Please consider supporting us by disabling your ad blocker