Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

Multiple choice question for engineering

Set 1

1. Terminal table
a) Contains all constants in the program
b) Is a permanent table of decision rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure?
c) Consist of a full or partial list of the token is as they appear in the program created by lexical analysis and used for syntax analysis and interpretation
d) Is a permanent table which lists all keywords and special symbols of the language in symbolic form?

View Answer

Answer: d [Reason:] A permanent database that has entry for each terminal symbols such as arithmetic operators, keywords, punctuation characters such as ‘;’, ‘,’etc Fields: Name of the symbol.

2. Advantage of incorporating the macro-processor into pass 1 is that
a) Many functions have to be implemented twice
b) Functions are combined not necessarily creating intermediate files as output from the macro-processor and input to the assembler
c) More flexibility is provided to the programmer in that he may use all the features of the assembler in conjunction with macros
d) All of the mentioned

View Answer

Answer: d [Reason:] A general-purpose macro processor or general purpose pre-processor is a macro …designed primarily for string manipulation, macro definition

3. Which of the following is a phase of a compilation process?
a) Lexical Analysis
b) Code Generation
c) Lexical Analysis & Code Generation
d) None of the mentioned

View Answer

Answer: c [Reason:] Lexical analysis and code generation is a phase of compilation process

4. System program such a s compiler are designed so that they are
a) Re-enterable
b) Non reusable
c) Serially usable
d) None of the mentioned

View Answer

Answer: a [Reason:] Re-enterable is the keyword for compiler being designed

5. A series of statements explaining how the data is to be processed is called
a) Assembly
b) Machine
c) COBOL
d) Program

View Answer

Answer: d [Reason:] A program is a sequence of instructions, written to perform a task by computer. It requires programs to function, typically executing the program’s instructions in a central processor.

6. A loader is a program that
a) Program that places functions into memory and prepares them for execution
b) Program that automates the translation of assembly language into machine language
c) Program accepting another program written in a high level language and produces as object program
d) None of the mentioned

View Answer

Answer: a [Reason:] A loader is the part of an operating system that is responsible for loading programs and libraries. It is important in the process of placing the programs into memory and executing them.

7. A system program that setup an executable program in main memory ready for execution is
a) Assembler
b) Linker
c) Loader
d) Load and go

View Answer

Answer: c [Reason:] a loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them for execution

8. Which of the following system program forgoes the production of object code to generate absolute machine code and load it into the physical main storage location from which it will be executed immediately upon completion of the assembly?
a) Two pass assembler
b) Load and go assembler
c) Macro processor
d) Linker

View Answer

Answer: b [Reason:] A load and go assembler generates absolute machine code and loads it to physical memory

9. Uniform symbol table
a) Has all constants in the program
b) Permanent table of rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure
c) Consists of full or partial list of the tokens as they appear in the program created by Lexical analysis and used for syntax analysis and interpretation
d) A permanent table which has all key words and special symbols of the language in symbolic form

View Answer

Answer: c [Reason:] Each pass scans the program, the first pass generates the symbol table and the second pass generates the machine code.

10. Assembler is a program that
a) Puts programs into memory and executes them
b) Translates the assembly language into machine language
c) Writes in high level language and produces an object program
d) None of the mentioned

View Answer

Answer: b [Reason:] An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer’s processor can use to perform its basic operations.

Set 2

1. In a compiler the module that checks every character of the source text is called
a) The code generator
b) The code optimizer
c) The lexical analyzer
d) The syntax analyzer

View Answer

Answer: a [Reason:] Lexical analysis is the process of converting a sequence of characters into a sequence of tokens.

2. The context free grammar is ambiguous if
a) The grammar contains non-terminals
b) Produces more than one parse tree
c) Production has two non-terminals side by side
d) None of the mentioned

View Answer

Answer: b [Reason:] Since more than one parse tree is generated hence one than option is available .Therefore it’s ambiguous.

3. Another Name for Lexical Analyser
a) Linear Phase
b) Linear Analysis
c) Scanning
d) All of the mentioned

View Answer

Answer: d [Reason:] Lexical Analyzer is also called “Linear Phase” or “Linear Analysis” or “Scanning“.

4. An individual token is called ________
a) Lexeme
b) Lex
c) Lexeme & Lex
d) None of the mentioned

View Answer

Answer: a [Reason:] Individual Token is also Called Lexeme.

5. Lexical Analyser’s Output is given to Syntax Analysis.
a) True
b) False

View Answer

Answer: a [Reason:] Lexical Analyzer’s Output is given to Syntax Analysis.

6. Which phase of the compiler is Lexical Analyser?
a) First
b) Second
c) Third
d) None of the mentioned

View Answer

Answer: a [Reason:] Lexical Analyzer is First Phase of Compiler.

7. Input to Lexical Analyser is
a) Source Code
b) Object Code
c) Lexeme
d) None of the mentioned

View Answer

Answer: a [Reason:] Lexical analyser’s Input is Source Code.

8. Lexical Analysis Identifies Different Lexical Units in a _______
a) Source Code
b) Object Code
c) Lexeme
d) None of the mentioned

View Answer

Answer: a [Reason:] Lexical Analysis Identifies Different Lexical Units in a source Code.

9. Which one is a type of Lexeme
a) Identifiers
b) Constants
c) Keywords
d) All of the mentioned

View Answer

Answer: d [Reason:] All of them along with Operators are different types of lexemes.

10. A________ is a string of characters which form a syntactic unit.
a) Lexeme
b) Lex
c) Lexeme & Lex
d) None of the mentioned

View Answer

Answer: a [Reason:] A lexeme is a string of characters which forms a syntactic unit.

Set 3

1. The process of forming tokens from an input stream of characters is called_____
a) Liberalisation
b) Characterisation
c) Tokenization
d) None of the mentioned

View Answer

Answer: c [Reason:] The process of forming tokens from an input stream of characters is called tokenization.

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

View Answer

Answer: c [Reason:] Lexeme Token category Sum “Identifier” = “Assignment operator” 3 “Integer literal” + “Addition operator” 2 “Integer literal” ; “End of statement”.

3. Which grammar defines Lexical Syntax
a) Regular Grammar
b) Syntactic Grammar
c) Context free Grammar
d) Lexical Grammar

View Answer

Answer: d [Reason:] The specification of a programming language often includes a set of rules, the lexical grammar, which defines the lexical syntax.

4. Two Important lexical categories are
a) White Space
b) Comments
c) None of the mentioned
d) White Space & Comments

View Answer

Answer: d [Reason:] Two important common lexical categories are white space and comments.

5. It has encoded within it information on the possible sequences of characters that can be contained within any of the tokens it handles .Above motioned function is performed by?
a) Scanner
b) Parser
c) Syntactic Analyser
d) All of the mentioned

View Answer

Answer: a [Reason:] The first stage, the scanner, is FSM. It has encoded information on the possible sequences of characters that can be contained within any of the tokens it handles .

6. What goes over the characters of the lexeme to produce a value?
a) Scanner
b) Parser
c) Evaluator
d) Lexical generator

View Answer

Answer: a [Reason:] In order to construct a token, the lexical analyzer needs a second stage, the evaluator, which goes over the characters of the lexeme to produce a value.

7. Lexers are often generated by a lexer generator, same as parser generators,
a) True
b) False

View Answer

Answer: a [Reason:] Lexers are often generated by a lexer generator same as parser.

8. Which one is a lexer Generator
a) ANTLR
b) DRASTAR
c) FLEX
d) All of the mentioned

View Answer

Answer: d [Reason:] ANTLR – Can generate lexical analyzers and parsers. DFASTAR – Generates DFA matrix table-driven lexers in C++. Flex – variant of the “lex” (C/C++). Ragel – A state machine and lexer generator with output in C, C++, C#, Objective-C, D, Java, Go and Ruby.

9. Which of the lexical analyser can handle Unicode
a) Java CC
b) JFLex
c) Quex
d) All of the mentioned

View Answer

Answer: d [Reason:] JavaCC – JavaCC generates lexical analyzers written in Java. JFLex – A lexical analyzer generator for Java. Quex – A fast universal lexical analyzer generator for C and C++. FsLex – A lexer generator for byte and Unicode character input for F#.

10. The output of a lexical analyzer is
a) Machine Code
b) Intermediate Code
c) Stream of Token
d) Parse Tree

View Answer

Answer: c [Reason:] The output given is in form of tokens.

Set 4

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

View Answer

Answer: c [Reason:] A lexical analyzer coverts character sequences to set of tokens.

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

View Answer

Answer: c [Reason:] Hash table is used as a reference for symbol table because it is efficient.

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

View Answer

Answer: a [Reason:] 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.

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

View Answer

Answer: c [Reason:] Since the input is the source language and the output that we get after the analysis is the machine language.

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

View Answer

Answer: a [Reason:] Because the lexer performs its analysis by going from one stage to another.

6. Which concept of grammar is used in the compiler
a) Lexical analysis
b) Parser
c) Code generation
d) Code optimization

View Answer

Answer: b [Reason:] As the lexical analysis of a grammar takes place in phases hence it is synonymous to parser.

7. Which of the following are Lexemes?
a) Identifiers
b) Constants
c) Keywords
d) All of the mentioned

View Answer

Answer: d [Reason:] Different Lexical Classes or Tokens or Lexemes Identifiers, Constants, Keywords, Operators.

Set 5

1. What constitutes the stages of the compilation process?
a) Feasibility study, system, design, and testing
b) Implementation and. documentation
c) Lexical analysis, syntax. Analysis and code generation
d) None of the mentioned

View Answer

Answer: c [Reason:] As defined in the compilation process.

2. The lexical analyzer takes_________as input and produces a stream of_______as output.
a) Source program, tokens
b) Token, source program
c) Either of the two
d) None of the mentioned

View Answer

Answer: a [Reason:] As per the definition of Lexical Analyser which states that lexical analysis is the process of converting a sequence of characters into tokens.

3. Parsing is also known as
a) Lexical Analysis
b) Syntax Analysis
c) Semantic Analysis
d) Code Generation

View Answer

Answer: b [Reason:] Parsing or syntactic analysis is the process of analysing a string of symbols and conforming to the rules of grammar.

4. A compiler program written in a high level language is called
a) Source Program
b) Object Program
c) Machine Language Program
d) None of the mentioned

View Answer

Answer: a [Reason:] The input that we give in high level language is also known as the source language.

5. System program such a compiler are designed so that they are
a) Re-enterable
b) Non-Usable
c) Serially usable
d) None of the mentioned

View Answer

Answer: a [Reason:] For the convince of the user compilers are made re-enterable.

6. Which of the following is not feature of compiler?
a) Scan the entire program first and translate into machine code
b) To remove syntax errors
c) Slow for debugging
d) Execution time is more

View Answer

Answer: d [Reason:] The objective of the compiler is clearly not to increase the execution time of the program.

7. A system program that brings together separately compiled modules of a program into a form language that is suitable for execution
a) Assembler
b) Linking loader
c) Cross compiler
d) None of the mentioned

View Answer

Answer: b [Reason:] A loader which brings together the functions of a relocating loader with the ability to combine a number of program segments that have been independently compiled into an executable program.

8. A programmer, by mistakes writes a program to multiply two numbers instead of dividing them, how can this error be detected
a) Compiler
b) Interpreter
c) Compiler or interpreter
d) None of the mentioned

View Answer

Answer: d [Reason:] This is a logical error can’t be detected by any compiler or interpreter.