Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

A system program that combines separately compiled modules of a program into a form suitable for execution is?(a) Assembler(b) Linking Loader(c) Cross Compiler(d) None of the mentionedI had been asked this question in an online interview.The origin of the question is Data Structure for Representing Parsing Table topic in chapter Bottom Up Parsing of Compiler

Answer»

Correct CHOICE is (b) Linking Loader

For EXPLANATION I WOULD say: A loader which combines 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.

2.

( Z,* ) be a structure, and* is defined by n * m =maximum (n, m) Which of the following statements is true for ( Z, * )?(a) ( Z,* ) is a monoid(b) ( Z,* ) is an algebraic group(c) ( Z,* ) is a group(d) None of the mentionedI had been asked this question in an internship interview.This intriguing question originated from Data Structure for Representing Parsing Table in section Bottom Up Parsing of Compiler

Answer»

The correct ANSWER is (d) None of the mentioned

For EXPLANATION I WOULD say: It is neither a monoid nor a SIMPLE group nor algebraic group

3.

Which is the most powerful parser?(a) SLR(b) LALR(c) Canonical LR(d) Operator PrecedenceI have been asked this question during an interview.Asked question is from Data Structure for Representing Parsing Table in portion Bottom Up Parsing of Compiler

Answer»

The correct OPTION is (C) Canonical LR

Easiest EXPLANATION: The most powerful PARSER is Canonical LR

4.

A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar S—-> xxW ( PRINT “1”) S—-> y { print ” 2 ” } S—-> Sz { print ” 3 ” ) What is the translation of xxxxyzz using the syntax directed translation scheme described by the above rules?(a) 23131(b) 11233(c) 11231(d) 33211This question was posed to me in unit test.My query is from Data Structure for Representing Parsing Table in division Bottom Up Parsing of Compiler

Answer» RIGHT answer is (a) 23131

To explain I would SAY: Initially 2 is PRINTED then 3 then 1 3 1.
5.

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) LinkerThis question was addressed to me during an interview.My question is taken from LR Parser in portion Bottom Up Parsing of Compiler

Answer» CORRECT option is (b) LOAD and go assembler

The best I can EXPLAIN: A load and go assembler generates absolute machine CODE and LOADS it to physical memory.
6.

In operator precedence parsing whose precedence relations are defined _________(a) For all pair of non-terminals(b) For all pair of terminals(c) To delimit the handle(d) None of the mentionedThe question was asked by my college professor while I was bunking the class.This interesting question is from Data Structure for Representing Parsing Table in portion Bottom Up Parsing of Compiler

Answer»

Right OPTION is (a) For all pair of non-terminals

The explanation is: 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 no terminals.

7.

A system program that set-up an executable program in the main memory ready for execution is?(a) Assembler(b) Linker(c) Loader(d) Text editorThis question was posed to me during an online exam.The query is from Data Structure for Representing Parsing Table in division Bottom Up Parsing of Compiler

Answer»

Right ANSWER is (c) Loader

The BEST explanation: A loader is the PART of an operating system that is responsible for loading programs and libraries. It is important that with the starting of a PROGRAM, as it PLACES programs into memory and executes it.

8.

In which way a macro processor for assembly language can be implemented?(a) Independent two-pass processor(b) Independent one-pass processor(c) Processor put into pass 1 of a standard two pass assembler(d) All of the mentionedThis question was addressed to me during an interview.Asked question is from Data Structure for Representing Parsing Table in section Bottom Up Parsing of Compiler

Answer»

The CORRECT CHOICE is (d) All of the mentioned

Easiest EXPLANATION: A general-purpose macro processor or general purpose preprocessor is a macro designed for string MANIPULATION, macro DEFINITION.

9.

A compiler is a program that ___________(a) Program is put into memory and executes it(b) Translation of assembly language into machine language(c) Acceptance of a program written in a high level language and produces an object program(d) None of the mentionedThis question was posed to me during an interview for a job.This intriguing question originated from Data Structure for Representing Parsing Table topic in portion Bottom Up Parsing of Compiler

Answer»

Correct choice is (c) ACCEPTANCE of a program written in a high level language and produces an OBJECT program

Explanation: A compiler is a computer program (or set of PROGRAMS) that transforms SOURCE code written in a programming language (the source language) into another computer language (the target language, often having a BINARY form known as object code).

10.

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 formI have been asked this question during an interview.My question is based upon LR Parser in section Bottom Up Parsing of Compiler

Answer»

Correct answer is (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

Easy explanation: Each pass SCANS the program, the FIRST pass generates the symbol table and the second pass generates the machine CODE.

11.

A programmer by mistake writes multiplication instead of division, such error can be detected by?(a) Compiler(b) Interpreter(c) Compiler or interpreter test(d) None of the mentionedThis question was addressed to me in semester exam.The doubt is from Data Structure for Representing Parsing Table topic in division Bottom Up Parsing of Compiler

Answer» CORRECT OPTION is (d) NONE of the mentioned

Explanation: No Logical errors can be detected.
12.

Resolution of externally defined symbols is performed by ___________(a) Linker(b) Loader(c) Compiler(d) InterpreterThis question was addressed to me in an interview for internship.My doubt is from Data Structure for Representing Parsing Table topic in section Bottom Up Parsing of Compiler

Answer» CORRECT choice is (a) LINKER

For explanation I would say: A linker or link editor is a computer program that takes one or more object files generated by a COMPILER and COMBINES them into a single executable file, library file, or another object file.
13.

An intermediate code form is ___________(a) Postfix Notation(b) Syntax Trees(c) Three address code(d) All of the mentionedThis question was addressed to me in examination.This is a very interesting question from Data Structure for Representing Parsing Table topic in division Bottom Up Parsing of Compiler

Answer» RIGHT option is (d) All of the mentioned

For explanation I would say: Intermediate CODE GENERATOR takes input from its predecessor phase, semantic analyzer, in the FORM of an annotated syntax TREE.
14.

The computer language generally translated to pseudocode is ___________(a) Assembly(b) Machine(c) Pascal(d) FORTRANThe question was posed to me in an international level competition.My question is from Data Structure for Representing Parsing Table topic in division Bottom Up Parsing of Compiler

Answer»

Right option is (a) ASSEMBLY

Easiest explanation: An assembly language (or assembler language) is a low-level programming language for a COMPUTER, or other programmable DEVICE, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture’s machine CODE instructions.

15.

A simple two-pass assembler does which of the following in the first pass?(a) It allocates space for the literals(b) Calculates total length of the program(c) Symbol table is built for the symbols and their value(d) All of the mentionedThe question was asked in an interview for internship.This key question is from Data Structure for Representing Parsing Table topic in portion Bottom Up Parsing of Compiler

Answer»

The CORRECT option is (d) All of the mentioned

To elaborate: A two-pass assembler. Each pass scans the PROGRAM, the first pass generates the SYMBOL table and the SECOND pass generates the machine CODE.

16.

The address code involves _____________(a) Exactly 3 address(b) At most Three address(c) No unary operators(d) None of the mentionedI got this question during an online exam.My doubt is from Data Structure for Representing Parsing Table topic in division Bottom Up Parsing of Compiler

Answer» RIGHT OPTION is (d) None of the mentioned

To ELABORATE: In COMPUTER science, three-address is an intermediate code used by optimizing compilers to aid in the implementation of code-improving transformations.
17.

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 mentionedI have been asked this question by my college professor while I was bunking the class.My question comes from LR Parser topic in section Bottom Up Parsing of Compiler

Answer»

The correct option is (b) Translates the assembly language into machine language

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

18.

Compiler can diagnose __________(a) Grammatical errors only(b) Logical errors only(c) Grammatical and logical errors(d) None of the mentionedThe question was asked in my homework.I want to ask this question from Data Structure for Representing Parsing Table in chapter Bottom Up Parsing of Compiler

Answer» CORRECT choice is (a) Grammatical errors only

Easy explanation: Only SYNTACTICAL errors can be DETECTED by the compiler.
19.

LR parsers are attractive because _________(a) It can be constructed to recognize CFG corresponding to almost all programming constructs(b) It does not backtrack(c) It can be constructed to recognize CFG corresponding to almost all programming constructs & It does not backtrack(d) None of the mentionedThis question was posed to me in an internship interview.I'd like to ask this question from Data Structure for Representing Parsing Table in division Bottom Up Parsing of Compiler

Answer»

The correct option is (c) It can be constructed to recognize CFG corresponding to almost all PROGRAMMING constructs & It does not backtrack

Explanation: These above mentioned are the REASONS why LR PARSER is considered to be attractive

20.

A system program that setup an executable program in main memory ready for execution is?(a) Assembler(b) Linker(c) Loader(d) Load and goI got this question in an interview for job.I would like to ask this question from LR Parser topic in section Bottom Up Parsing of Compiler

Answer»

Right answer is (c) LOADER

Best explanation: 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.

21.

When ß is empty (A -> ß.,a), the reduction by A-> a is done by _________(a) If next symbol is a terminal(b) Only If the next input symbol is a(c) Only If the next input symbol is A(d) Only if the next input symbol is aThe question was posed to me in examination.The question is from LR Parser topic in chapter Bottom Up Parsing of Compiler

Answer»

Correct answer is (d) Only if the next INPUT SYMBOL is a

Explanation: The next token is considered in this CASE it’s a.

22.

When there is a reduce/reduce conflict?(a) If a state does not know whether it will make a shift operation using the production rule i or j for a terminal(b) If a state does not know whether it will make a shift or reduction operation using the production rule i or j for a terminal(c) If a state does not know whether it will make a reduction operation using the production rule i or j for a terminal(d) None of the mentionedI have been asked this question during an internship interview.This is a very interesting question from LR Parser in portion Bottom Up Parsing of Compiler

Answer»

Correct choice is (C) If a state does not know whether it will MAKE a reduction operation using the PRODUCTION rule i or J for a terminal

To elaborate: It occurs when If a state does not know whether it will make a reduction operation using the production rule i or j for a terminal.

23.

What is the output of lexical analyzer?(a) A set of regular expression(b) Syntax tress(c) Set of Token(d) String of CharactersThis question was addressed to me during an internship interview.This interesting question is from Handle of Right sentinel Grammar topic in section Bottom Up Parsing of Compiler

Answer» CORRECT ANSWER is (c) Set of Token

Best explanation: Lexical ANALYSIS is the process of CONVERTING a sequence of characters into a sequence of tokens.
24.

Inherited attribute is a natural choice in __________(a) Trackingdeclaration of a variable(b) Correct use of L and R values(c) All of the mentioned(d) None of the mentionedThis question was addressed to me by my school principal while I was bunking the class.This question is from Handle of Right sentinel Grammar in portion Bottom Up Parsing of Compiler

Answer»

Correct option is (a) TRACKINGDECLARATION of a VARIABLE

To EXPLAIN I WOULD say: These attribute keep a check on variable DECLARATION.

25.

Which of these is also known as look-head LR parser?(a) SLR(b) LR(c) LLR(d) None of the mentionedI had been asked this question during an internship interview.This interesting question is from LR Parser in section Bottom Up Parsing of Compiler

Answer»

The correct answer is (c) LLR

For EXPLANATION I would SAY: LLR is the look ahead parser.

26.

Which of the following symbols table implementation is based on the property of locality of reference?(a) Hash Table(b) Search tree(c) Self organizing list(d) Linear listI had been asked this question by my school principal while I was bunking the class.The question is from Handle of Right sentinel Grammar in chapter Bottom Up Parsing of Compiler

Answer» RIGHT ANSWER is (c) Self organizing list

Explanation: Self Organizing list is based on LOCALITY of REFERENCE.
27.

_____________ is a graph representation of a derivation.(a) The parse tree(b) Oct tree(c) Binary tree(d) None of the mentionedI had been asked this question during a job interview.Asked question is from Handle of Right sentinel Grammar in division Bottom Up Parsing of Compiler

Answer» RIGHT CHOICE is (a) The PARSE tree

Easy explanation: Parse tree is a representation of the derivation.
28.

DAG representation of a basic block allows __________(a) Automatic detection of local common sub expressions(b) Detection of induction variables(c) Automatic detection of loop variant(d) None of the mentionedI had been asked this question in an international level competition.My question is taken from Handle of Right sentinel Grammar in chapter Bottom Up Parsing of Compiler

Answer»

The correct OPTION is (a) Automatic DETECTION of local COMMON sub expressions

For explanation I would SAY: It DETECTS local sub expression.

29.

The optimization which avoids test at every iteration is?(a) Loop unrolling(b) Loop jamming(c) Constant folding(d) None of the mentionedThe question was posed to me in final exam.This intriguing question comes from Bottom-Up Parsing-2 topic in chapter Bottom Up Parsing of Compiler

Answer» RIGHT ANSWER is (a) Loop unrolling

To EXPLAIN: EXECUTION speed is enhanced by sacrificing bits.
30.

A top down parser generates __________(a) Rightmost Derivation(b) Right most derivation in reverse(c) Left most derivation(d) Left most derivation in reverseThis question was posed to me in quiz.Question is taken from Bottom-Up Parsing-1 topic in section Bottom Up Parsing of Compiler

Answer»

Right answer is (c) Left most derivation

The best I can explain: Top-down parsing is a parsing strategy where one first looks at the HIGHEST level of the PARSE tree and works down the parse tree by using the REWRITING RULES of a formal grammar.

31.

What is the similarity between LR, LALR and SLR?(a) Use same algorithm, but different parsing table(b) Same parsing table, but different algorithm(c) Their Parsing tables and algorithm are similar but uses top down approach(d) Both Parsing tables and algorithm are differentThe question was posed to me in an online interview.My question is based upon LR Parser in chapter Bottom Up Parsing of Compiler

Answer»

Right choice is (a) Use same algorithm, but different parsing table

To EXPLAIN I would say: The COMMON grounds of these 3 PARSER is the algorithm but parsing table is different.

32.

Pee Hole optimization __________(a) Loop Optimization(b) Local Optimization(c) Constant folding(d) Data Flow analysisThis question was posed to me in exam.The query is from Bottom-Up Parsing-2 topic in section Bottom Up Parsing of Compiler

Answer» RIGHT option is (c) CONSTANT folding

Easy explanation: More LOOPS are added.
33.

Which of these is true about LR parsing?(a) Is most general non-backtracking shift-reduce parsing(b) It is still efficient(c) Is most general non-backtracking shift-reduce parsing & It is still efficient(d) None of the mentionedI got this question in class test.This intriguing question originated from LR Parser in section Bottom Up Parsing of Compiler

Answer» RIGHT answer is (C) Is most general non-backtracking shift-reduce parsing & It is still efficient

Easy explanation: LR parsers are a TYPE of bottom-up parsers that efficiently handle deterministic context-free LANGUAGES in guaranteed linear time.
34.

A bottom up parser generates __________(a) Right most derivation(b) Rightmost derivation in reverse(c) Leftmost derivation(d) Leftmost derivation in reverseThis question was posed to me during an internship interview.Query is from Bottom-Up Parsing-2 topic in section Bottom Up Parsing of Compiler

Answer»

Right option is (b) RIGHTMOST DERIVATION in reverse

Explanation: This corresponds to starting at the LEAVES of the parse tree also KNOWN as shift-reduce parsing.

35.

If a state does not know whether it will make a shift operation or reduction for a terminal is called _________(a) Shift/reduce conflict(b) Reduce /shift conflict(c) Shift conflict(d) Reduce conflictThe question was asked at a job interview.I'm obligated to ask this question of LR Parser in section Bottom Up Parsing of Compiler

Answer»

Correct OPTION is (a) Shift/REDUCE CONFLICT

For explanation: As the name SUGGESTS that the conflict is between shift and reduce HENCE it is called shift reduce conflict.

36.

_________ or scanning is the process where the stream of characters making up the source program is read from left to right and grouped into tokens.(a) Lexical Analysis(b) Diversion(c) Modelling(d) None of the mentionedThe question was asked in quiz.I would like to ask this question from Handle of Right sentinel Grammar in portion Bottom Up Parsing of Compiler

Answer»

The correct option is (a) Lexical Analysis

Explanation: Lexical analysis is the process of converting a SEQUENCE of CHARACTERS into a sequence of TOKENS.

37.

What is the binary equivalent of the decimal number 368?(a) 10111000(b) 110110000(c) 111010000(d) 111100000I have been asked this question by my college professor while I was bunking the class.My question is from Bottom-Up Parsing-1 in portion Bottom Up Parsing of Compiler

Answer»

Correct choice is (b) 110110000

The BEST I can EXPLAIN: 368 binary EQUIVALENTS is

8=1000

6=0110

3=0011

So 1101101000.

38.

YACC builds up __________(a) SLR parsing table(b) Canonical LR parsing table(c) LALR parsing table(d) None of the mentionedThis question was posed to me in my homework.My question is based upon Bottom-Up Parsing-1 in division Bottom Up Parsing of Compiler

Answer»

The correct answer is (c) LALR parsing table

The BEST I can explain: It is a PARSER GENERATOR.

39.

What is garbage?(a) Unallocated storage(b) Allocated storage whose access paths are destroyed?(c) Allocated storage(d) Uninitialized storageThe question was asked in a national level competition.Query is from Handle of Right sentinel Grammar topic in division Bottom Up Parsing of Compiler

Answer» CORRECT option is (b) ALLOCATED STORAGE whose access paths are destroyed?

For explanation I would say: These are more like MEMORY loacations with values whose POINTERS have been revoked.
40.

A series of statements explaining how the data is to be processed is called _________(a) Assembly(b) Machine(c) COBOL(d) ProgramThe question was posed to me in examination.My doubt is from LR Parser topic in division Bottom Up Parsing of Compiler

Answer» RIGHT answer is (d) PROGRAM

Explanation: 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.
41.

Relocating bits used by relocating loader are specified by __________(a) Relocating loader itself(b) Linker(c) Assembler(d) Macro ProcessorI got this question in a national level competition.This interesting question is from Bottom-Up Parsing-1 in section Bottom Up Parsing of Compiler

Answer» RIGHT OPTION is (b) Linker

Easiest explanation: Takes an object files and COMBINES them into a single executable FILE, library file, or ANOTHER object file.
42.

Which of the following is used for grouping of characters into tokens?(a) Parser(b) Code optimization(c) Code generator(d) Lexical analyserThis question was posed to me during an internship interview.I'm obligated to ask this question of Handle of Right sentinel Grammar in division Bottom Up Parsing of Compiler

Answer»

Right answer is (d) Lexical analyser

The best EXPLANATION: Lexical ANALYSIS is the PROCESS of converting a SEQUENCE of characters into a sequence of tokens.

43.

A parser with the valid prefix property is advantageous because it __________(a) Detects errors(b) None of the mentioned(c) Errors are passed to the text phase(d) All of the mentionedThe question was asked at a job interview.The doubt is from Bottom-Up Parsing-1 topic in division Bottom Up Parsing of Compiler

Answer»

Right option is (C) Errors are passed to the TEXT phase

For EXPLANATION: ADVANTAGE for a valid prefix PROPERTY.

44.

The graph that shows basic blocks and their successor relationship is called __________(a) DAG(b) Flow Chart(c) Control Graph(d) Hamilton graphThis question was posed to me by my school principal while I was bunking the class.My question is taken from Handle of Right sentinel Grammar topic in section Bottom Up Parsing of Compiler

Answer»

The CORRECT ANSWER is (B) Flow Chart

The explanation is: Explanation: Flow chart SHOWS basic BLOCKS.

45.

Which of the following is the fastest logic?(a) TTL(b) ECL(c) CMOS(d) LSIThe question was asked in quiz.This intriguing question comes from Bottom-Up Parsing-2 in section Bottom Up Parsing of Compiler

Answer»

Right option is (b) ECL

The explanation is: In electronics, emitter-coupled LOGIC (ECL) is a high-speed INTEGRATED circuit.

46.

Inherited attribute is a natural choice in ___________(a) Variable declarations record is maintained(b) L values and R values(c) All of the mentioned(d) None of the mentionedThe question was posed to me in exam.This is a very interesting question from Bottom-Up Parsing-1 topic in division Bottom Up Parsing of Compiler

Answer»

The CORRECT option is (a) Variable declarations record is maintained

For EXPLANATION I WOULD say: It KEEPS track of variable.

47.

AB+(A+B)’ is equivalent to __________(a) A?B(b) A+B(c) (A+B)A(d) (A+B)BI have been asked this question in final exam.The query is from Bottom-Up Parsing-1 in section Bottom Up Parsing of Compiler

Answer»

Right CHOICE is (a) A?B

The BEST EXPLANATION: It is EQUIVALENT to A? B.

48.

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 mentionedThe question was posed to me in examination.The question is from LR Parser in section Bottom Up Parsing of Compiler

Answer»

The correct option is (a) Program that places functions into MEMORY and prepares them for execution

Best explanation: 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.

49.

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 mentionedThe question was asked in unit test.Enquiry is from LR Parser in portion Bottom Up Parsing of Compiler

Answer»

The CORRECT answer is (c) Lexical Analysis & Code Generation

The best I can explain: Lexical analysis and code generation is a phase of compilation PROCESS.

50.

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 mentionedI had been asked this question in my homework.My question is based upon LR Parser topic in section Bottom Up Parsing of Compiler

Answer»

The correct ANSWER is (d) All of the mentioned

For explanation I WOULD say: A general-PURPOSE macro processor or general purpose pre-processor is a macro designed primarily for string MANIPULATION, macro DEFINITION.