GkSeries.com

Lexical Analysis Quiz | Lexical Analysis Multiple Choice Questions and Answers

(1) Which concept of grammar is used in the compiler
[A] Parser
[B] Code optimization
[C] Lexical analysis
[D] Code generation
Answer: Parser
(2) Object program is a
[A] Translation of high-level language into machine language
[B] Program to be translated into machine language
[C] Program written in machine language
[D] None of the mentioned
Answer: Translation of high-level language into machine language

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

(3) The symbol table implementation is based on the property of locality of reference is
[A] Hash Table
[B] Self Organisation
[C] Linear list
[D] None of the above
Answer: Hash Table
(4) What goes over the characters of the lexeme to produce a value?
[A] Scanner
[B] Lexical generator
[C] Parser
[D] Evaluator
Answer: Scanner
(5) Two Important lexical categories are
[A] White Space & Comments
[B] White Space
[C] Comments
[D] None of the mentioned
Answer: White Space & Comments
(6) Which grammar defines Lexical Syntax
[A] Lexical Grammar
[B] Context free Grammar
[C] Regular Grammar
[D] None of the above
Answer: Lexical Grammar
(7) When expression sum=3+2 is tokenized then what is the token category of 3
[A] Integer Literal
[B] Addition Operator
[C] Identifier
[D] None of the above
Answer: Integer Literal
(8) 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] Syntactic Analyser
[B] Parser
[C] Scanner
[D] All of the mentioned
Answer: Scanner
(9) A programmer, by mistake, writes an instruction to divide, instead of a multiply, such error can be detected by a/an
[A] compiler
[B] interpreter
[C] compiler or interpreter test
[D] None of these
Answer: None of these
(10) A system program that set-up an executable program in main memory ready for execution is
[A] loader
[B] linker
[C] assembler
[D] None of the above
Answer: loader
(11) A compiler is a program that
[A] places programs into memory and prepares them for execution.
[B] automates the translation of assembly language into machine language.
[C] accepts a program written in a high level language and produces an object program.
[D] None of the above
Answer: accepts a program written in a high level language and produces an object program.
(12) The process of forming tokens from an input stream of characters is called_____
[A] Tokenization
[B] Liberalisation
[C] Characterisation
[D] None of the mentioned
Answer: Tokenization
(13) In an aboslute loading scheme, which loader function is accomplished by programmer?
[A] Allocation
[B] LInking
[C] Reallocation
[D] both (A) and (B)
Answer: both (A) and (B)
(14) Advantage of using assembly language rather than machine language is that
[A] introduction of data to program is easier
[B] it is mneomonic and easy to read
[C] addresses any symbolic not absolute
[D] All of these
Answer: All of these
(15) Language which have many types, but the type of every name and expression must be calculated at compile time are
[A] strongly-type languages
[B] weakly typed languages
[C] loosely typed languages
[D] none of these
Answer: strongly-type languages
(16) Advantage of incorporating the macro-processor into pass 1 is that
[A] functions are combined and it is not necessary to create intermediate files as output from the macro-processor and input to the assembler.
[B] more flexibility is available to the programmer in that he may use all the features of the assembler in conjunction with macros.
[C] many functions have to be implemented twice
[D] all of these
Answer: all of these
(17) Which of the following is a phase of a compilation process ?
[A] Lexical analysis
[B] Code generation
[C] Both (a) and (b)
[D] None of these
Answer: Both (a) and (b)
(18) A simple two-pass assembler does which of the following in the first pass ?
[A] It computes the total length of the program
[B] It builds the symbol table for the symbols and their values.
[C] It allocates space for the literals
[D] All of these
Answer: All of these
(19) Compiler can diagnose
[A] grammatical errors only
[B] logical errors only
[C] grammatical as well as logical errors
[D] None of these
Answer: grammatical errors only
(20) Assembler is a program that
[A] places programs into memory and prepares them for execution
[B] automates the translation of assembly language into machine language
[C] accepts a program written in a high level language and produces an object program.
[D] None of these
Answer: automates the translation of assembly language into machine language

Please share this page

Click Here to Read more questions

Teacher Eligibility Test