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.

In which way can SAM be stored in an array?(a) char name[]=”SAM”(b) char name[6]={‘S’,’A’,’M’}(c) char name[6]={“S”,”A”,”M”}(d) char name [6]={‘S’,’A’,’M’,’\0’}The question was asked in quiz.This intriguing question comes from Array Reference in portion Syntax Directed Definition and Translations of Compiler

Answer»

The correct answer is (d) char NAME [6]={‘S’,’A’,’M’,’\0’}

BEST explanation: The array consists of the word SAM and also a NULL character.

2.

What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?(a) The compiler would report an error(b) May stop working abruptly if data gets overwritten(c) None of the mentioned(d) The element will be set to 0I have been asked this question during an interview.The doubt is from Array Reference topic in division Syntax Directed Definition and Translations of Compiler

Answer»

The correct choice is (B) May stop working abruptly if data GETS overwritten

To EXPLAIN: It often happens that the PROGRAM crashes.

3.

Which of the following correctly accesses the seventh element stored in tan?(a) tan[6](b) tan[7](c) tan(7)(d) tanThis question was addressed to me in final exam.I want to ask this question from Array Reference in chapter Syntax Directed Definition and Translations of Compiler

Answer»

Correct answer is (a) tan[6]

For explanation I WOULD say: The INDEX no 6.

4.

Coercion _____________(a) Takes place over an assignment operator(b) Operator has operands of various types(c) None of the mentioned(d) Takes place over an assignment operator & Operator has operands of various typesI had been asked this question in my homework.My question is taken from Implementation of Increment and Decrement topic in portion Syntax Directed Definition and Translations of Compiler

Answer»

Correct OPTION is (d) TAKES place over an ASSIGNMENT OPERATOR & Operator has operands of various types

To EXPLAIN I would say: Conversion between compatible types.

5.

What is an example of intermediate language?(a) SNOBOL(b) PASCAL(c) COBOL(d) UNCOLI got this question in exam.I need to ask this question from SDT Schemes to Specify Translation of various Programming Language Construct topic in chapter Syntax Directed Definition and Translations of Compiler

Answer» RIGHT choice is (d) UNCOL

To explain I WOULD say: OTHERS are HLL.
6.

Output file of the Lex is _________ is the input file is Sam.(a) sam(b) sam.yy.c(c) sam.lex(d) sam.objThe question was posed to me during an online interview.This key question is from Three-Address Statements topic in chapter Syntax Directed Definition and Translations of Compiler

Answer»

Correct ANSWER is (b) sam.yy.c

The EXPLANATION is: This Produce the FILE “sam.yy.c”, which we can then compile with G++.

7.

Pick the machine independent phase of the compiler.(a) Syntax analysis(b) Code generation(c) Lexical analysis(d) All of the mentionedThis question was addressed to me in an internship interview.Question is taken from Three-Address Statements in portion Syntax Directed Definition and Translations of Compiler

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

Explanation: MACHINE independent PHASES are Lexical analysis, Syntax analysis, Semantic analysis, INTERMEDIATE CODE generation and sometime code optimization.
8.

A system program that combines the separately compiled modules of a program into a form suitable for execution is?(a) Assembler(b) Linking loader(c) Cross compiler(d) Load and GoThe question was asked in an online quiz.My question is based upon Three-Address Statements in section Syntax Directed Definition and Translations of Compiler

Answer»

Correct choice is (B) Linking loader

To explain: COMBINES the MODULES which have been COMPILED SEPARATELY.

9.

An LALR(1) parser for a grammar can have shift-reduce (S-R) conflicts if and only if ___________(a) The SLR(1) parser for G has S-R conflicts(b) The LR(1) parser for G has S-R conflicts(c) The LR(0) parser for G has S-R conflicts(d) The LALR(1) parser for G has reduce-reduce conflictsThe question was posed to me in homework.My query is from Intermediate Code-Generation topic in chapter Syntax Directed Definition and Translations of Compiler

Answer»

Correct OPTION is (B) The LR(1) parser for G has S-R conflicts

The best explanation: LALR parser is reduced form of CLR or LR(1) parser, LALR parser uses the LR(1) items of CLR parser & of any shift REDUCE conflicts are there then it is due to LR(1) parser.

10.

Which of the following describes a handle (as applicable to LR-parsing) appropriately?(a) It is the position in a sentential form where the next shift or reduce operation will occur(b) It is a non-terminal whose production will be used for reduction in the next step(c) It is a production that may be used for reduction in a future step along with a position in the sentential form where the next shift or reduce operation will occur.(d) It is the production p that will be used for reduction in the next step along with a position in the sentential form where the right hand side of the production may be foundI had been asked this question during an interview for a job.My query is from Intermediate Code-Generation topic in division Syntax Directed Definition and Translations of Compiler

Answer»

The CORRECT option is (d) It is the production p that will be used for reduction in the next STEP along with a position in the sentential form where the right hand SIDE of the production may be found

The explanation: Handles are the PART of sentential form, & they are identified as the right side of any given production which will be used for reduction in the next step.

11.

The grammar A ->AA |( A)| ε is not suitable for predictive-parsing because the grammar is ___________(a) Ambiguous(b) Left-recursive(c) Right-recursive(d) An operator-grammarThis question was addressed to me by my college professor while I was bunking the class.My doubt stems from L-Attributed Definition in portion Syntax Directed Definition and Translations of Compiler

Answer»

The correct CHOICE is (a) AMBIGUOUS

The BEST explanation: The grammar is ambiguous.

12.

Software that measures, monitors, and controls events are ___________(a) System S/w(b) Real Time software(c) Scientific software(d) Business SoftwareThis question was addressed to me in homework.This is a very interesting question from Syntax-Directed Definitions and Translations in section Syntax Directed Definition and Translations of Compiler

Answer» RIGHT option is (b) Real Time software

Easy EXPLANATION: In computer SCIENCE, real-time computing (RTC), or reactive computing describes hardware and software systems SUBJECT to a “real-time constraint”, for example operational deadlines from event to SYSTEM response.
13.

A ‘while’ loop may always be converted to an equivalent ‘for’ loop.(a) True(b) FalseI got this question during an internship interview.This intriguing question originated from Switch Case topic in chapter Syntax Directed Definition and Translations of Compiler

Answer» RIGHT OPTION is (a) True

Easy EXPLANATION: Can be CONVERTED to for LOOP.
14.

Which of the following is not true?(a) UGL doesn’t support high level seven interaction(b) Many DBMS support 4GLs(c) All of the mentioned(d) None of the mentionedThis question was addressed to me in an international level competition.Enquiry is from SDT Schemes to Specify Translation of various Programming Language Construct topic in portion Syntax Directed Definition and Translations of Compiler

Answer»

The correct ANSWER is (a) UGL doesn’t SUPPORT HIGH level seven interaction

For explanation I WOULD SAY: It supports HLL.

15.

Scissoring enables ______________(a) A part of data to be displayed(b) Entire data to be displayed(c) Full data display on full screen(d) No data to be displayedThis question was posed to me in an interview for internship.My enquiry is from Implementation of the Translation Specified by Syntax-Directed Definitions in division Syntax Directed Definition and Translations of Compiler

Answer»

The CORRECT answer is (a) A PART of DATA to be displayed

The best explanation: It displays a part of the data.

16.

What is the function of the storage assignment?(a) Assign storage to all variables referenced in the source program(b) Assign storage to all temporary locations that are necessary for intermediate results(c) Assign storage to literals, and to ensure that the storage is allocated and appropriate locations are initialized(d) All of the mentionedThe question was posed to me in homework.The origin of the question is Implementation of the Translation Specified by Syntax-Directed Definitions topic in portion Syntax Directed Definition and Translations of Compiler

Answer»

The correct OPTION is (d) All of the mentioned

The explanation is: The STORAGE ASSIGNMENT PERFORMS the above mentioned tasks.

17.

The table created by lexical analysis to describe all literals used in the source program is?(a) Terminal table(b) Literal table(c) Identifier table(d) ReductionsThis question was posed to me during an online interview.I want to ask this question from Syntax-Directed Definitions and Translations in division Syntax Directed Definition and Translations of Compiler

Answer»

The correct OPTION is (b) Literal table

Easy EXPLANATION: In COMPUTER science, and specifically in compiler and assembler design, literal pool is a lookup table USED to hold LITERALS during assembly and execution.

18.

Assembly code data base is associated with ___________(a) Code is converted into assembly(b) Table of rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure(c) All of the mentioned(d) None of the mentionedThe question was asked in an internship interview.This question is from Syntax-Directed Definitions and Translations in division Syntax Directed Definition and Translations of Compiler

Answer»

Right choice is (a) Code is converted into ASSEMBLY

The BEST I can explain: An assembly 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.

19.

Which of the following gives the memory address of the first element in array tan?(a) tan[0](b) tan(c) &tan(d) tan [1]This question was posed to me in exam.This key question is from Array Reference topic in section Syntax Directed Definition and Translations of Compiler

Answer» RIGHT option is (b) tan

Explanation: The base ADDRESS of the ARRAY is GIVEN by its NAME.
20.

Which of the following is not a type of assembler?(a) One pass(b) Two pass(c) Three pass(d) Load and goThe question was posed to me at a job interview.I'm obligated to ask this question of SDT Schemes to Specify Translation of various Programming Language Construct in chapter Syntax Directed Definition and Translations of Compiler

Answer»

Correct answer is (c) THREE pass

The explanation: No 3 pass assembler CREATED as yet.

21.

When a computer is rebooted, a special type of loader is executed called?(a) Compile and GO ” loader(b) Boot loader(c) Bootstrap Loader(d) Relating LoaderThe question was posed to me in an internship interview.I want to ask this question from Implementation of the Translation Specified by Syntax-Directed Definitions in chapter Syntax Directed Definition and Translations of Compiler

Answer»

Correct answer is (c) BOOTSTRAP Loader

Easiest explanation: A BOOT loader, is a small program that PLACES the OPERATING system (OS) of a computer into memory.

22.

In which of the following no information hiding is done?(a) Compile prig 1, prig 2(b) Run test, prog(c) Load R1, A(d) 001001000010101I got this question in an interview for internship.This question is from Implementation of the Translation Specified by Syntax-Directed Definitions topic in portion Syntax Directed Definition and Translations of Compiler

Answer»

Correct CHOICE is (d) 001001000010101

To explain: The entire BINARY symbol gives INFORMATION.

23.

The advantage of ‘switch’ statement over ‘if’ is that it leads to more structured program.(a) True(b) FalseThe question was posed to me during an interview.The doubt is from Switch Case topic in chapter Syntax Directed Definition and Translations of Compiler

Answer»

Correct answer is (a) True

For explanation I would SAY: Switch is more convenient to use as it avoids confusion in CASE of more NESTED STRUCTURE.

24.

Pick the operators that associate from left to right.(a) &&(b) ?:(c) ,(d) All of the mentionedThe question was posed to me in an online interview.This interesting question is from Implementation of Increment and Decrement topic in portion Syntax Directed Definition and Translations of Compiler

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

Easiest explanation: They LEFT to RIGHT ASSOCIATIVE.
25.

A Lex compiler generates ___________(a) Lex object code(b) Transition tables(c) Tokens(d) None of the mentionedI have been asked this question by my college director while I was bunking the class.I would like to ask this question from SDT Schemes to Specify Translation of various Programming Language Construct in division Syntax Directed Definition and Translations of Compiler

Answer»

The correct answer is (b) TRANSITION tables

The EXPLANATION: The OUTPUT of Lex is a STRING of tokens.

26.

Yacc is available as a command on the ____________(a) MINIX(b) UNIX(c) DOS(d) None of the mentionedThe question was posed to me in my homework.The question is from Three-Address Statements in section Syntax Directed Definition and Translations of Compiler

Answer» CORRECT OPTION is (B) UNIX

The best I can explain: Unix provides with a YACC command.
27.

Which of the following is NOT an advantage of using shared, dynamically linked libraries as compared tostatically linked libraries?(a) Smaller sizes of executable(b) Lesser overall page fault rate in the system(c) Faster program start-up(d) Existing programs need not be re-linked to take advantage of newer versions of librariesThis question was addressed to me in an interview.The origin of the question is L-Attributed Definition in section Syntax Directed Definition and Translations of Compiler

Answer»

The correct choice is (C) FASTER program start-up

The explanation is: No need for re-linking if NEWER versions of LIBRARIES are there.

28.

A self-relocating program is one which?(a) Cannot execute in any area of storage other than the one designated(b) Consists of a program andinformation for its relocation(c) None of the mentioned(d) All of the mentionedThe question was asked at a job interview.My question is taken from Implementation of the Translation Specified by Syntax-Directed Definitions in portion Syntax Directed Definition and Translations of Compiler

Answer»

The CORRECT answer is (C) None of the mentioned

The explanation is: A self-relocating PROGRAM is a program which can PERFORM the relocation itself

• A table of information about address sensitive instruction in the program.

• Relocating logic that can perform the relocation of the address sensitive INSTRUCTIONS.

29.

Which of the following is not possible statically in C?(a) Jagged Array(b) Rectangular Array(c) Cuboidal Array(d) Multidimensional ArrayThe question was asked in unit test.This interesting question is from Array Reference topic in section Syntax Directed Definition and Translations of Compiler

Answer»

The correct choice is (a) JAGGED ARRAY

For explanation: Jagged array is not POSSIBLE.

30.

In a two pass assembler, adding literals to literal table and address resolution of local symbols are done using?(a) First pass and second respectively(b) Both second pass(c) Second pass and first respectively(d) Both first passI have been asked this question in examination.My query is from Three-Address Statements in chapter Syntax Directed Definition and Translations of Compiler

Answer» RIGHT choice is (d) Both first pass

To EXPLAIN: A two pass assembler does two PASSES over the source file (the second pass can be over a file GENERATED in the first pass).
31.

What is the disadvantage of ” Compile and GO ” loading scheme?(a) Memory is wasted because the case occupied by the assembler is unavailable to the object program(b) Necessary to translate the users program(c) It is very difficult to handle multiple segments, even when the source programs are in different languages and to produce orderly modular programs(d) All of the mentionedThe question was asked during an internship interview.The above asked question is from Implementation of the Translation Specified by Syntax-Directed Definitions in section Syntax Directed Definition and Translations of Compiler

Answer»

Right answer is (d) All of the mentioned

The explanation is: In computer programming, a compile and GO system, compile, load, and go system, ASSEMBLE and go system, or load and go system[1][2][3] is a programming language PROCESSOR in which the compilation, assembly, or link steps are not separated from PROGRAM execution.

32.

A programming language is to be designed to run on a machine that does not have a big memory.(a) Prefer a 2 pass compiler(b) Prefer an interpreter(c) Not support recursion(d) All of the mentionedThe question was posed to me by my college director while I was bunking the class.Asked question is from SDT Schemes to Specify Translation of various Programming Language Construct topic in section Syntax Directed Definition and Translations of Compiler

Answer»

Right option is (d) All of the mentioned

The BEST I can explain: If a LANGUAGE designed to run on a machine then recursion should not be followed it should prefer 2 pass ASSEMBLER and prefer an interpreter to a COMPILER.

33.

Int RollNUm[30[4] is a?(a) 1-d Array(b) 3-D Array(c) 4- D Array(d) 2-D ArrayThis question was addressed to me during an online exam.This key question is from Array Reference topic in portion Syntax Directed Definition and Translations of Compiler

Answer»

Correct answer is (d) 2-D ARRAY

For EXPLANATION: 2 [] BRACKETS MEANS a double dimensional array.

34.

In Two pass assembler the object code generation is done during the ______________(a) Second pass(b) First pass(c) Zeroth pass(d) Not done by assemblerThis question was posed to me in unit test.Asked question is from Three-Address Statements topic in division Syntax Directed Definition and Translations of Compiler

Answer»

Right answer is (a) Second PASS

Best EXPLANATION: On the second pass, the ASSEMBLER:

• source statements into machine code

• error MESSAGES, if error has occurred.

35.

The lexical analyzer takes _________ as input and produces a stream of _______ as output.(a) Source program, tokens(b) Token, source program(c) Either A and B(d) None of the mentionedI had been asked this question in class test.The question is from Three-Address Statements in portion Syntax Directed Definition and Translations of Compiler

Answer»

Correct CHOICE is (a) Source program, tokens

For EXPLANATION: LEXICAL analyser takes source program as input and token as OUTPUT.

36.

Relocation bits used by relocating loader are specified by ____________(a) Relocating loader itself(b) Linker(c) Assembler(d) Macro processorThis question was addressed to me in an internship interview.My question comes from Implementation of the Translation Specified by Syntax-Directed Definitions topic in portion Syntax Directed Definition and Translations of Compiler

Answer»

The correct option is (B) Linker

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

37.

Which of the following can be accessed by the transfer vector approach of linking?(a) External data segments(b) External sub-routines(c) Data located in other procedure(d) All of the mentionedThe question was posed to me in an online quiz.This intriguing question originated from Implementation of the Translation Specified by Syntax-Directed Definitions topic in portion Syntax Directed Definition and Translations of Compiler

Answer»

Right answer is (B) External sub-routines

For explanation I would say: External SUBROUTINES are routines that are CREATED and maintained separately from the PROGRAM that will be CALLING them.

38.

Which loader function is accomplished by loader?(a) Reallocation(b) Allocation(c) Linking(d) LoadingThe question was asked in a national level competition.I want to ask this question from Syntax-Directed Definitions and Translations topic in section Syntax Directed Definition and Translations of Compiler

Answer» RIGHT answer is (d) Loading

The best I can EXPLAIN: FUNCTION of a LOADER.
39.

The expression 5 – 2 – 3 * 5 – 2 will evaluate to 18, if – is left associative and _____________(a) * has precedence over *(b) * has precedence over –(c) – has precedence over *(d) – has precedence over –I got this question in an online quiz.I'd like to ask this question from Implementation of Increment and Decrement topic in division Syntax Directed Definition and Translations of Compiler

Answer»

The CORRECT CHOICE is (c) – has PRECEDENCE over *

The BEST EXPLANATION: if – has precedence over* and if it associates from the right.

40.

Which of the following software tool is parser generator?(a) Lex(b) Yacc(c) Lex & Yacc(d) None of the mentionedThe question was asked in final exam.My query is from SDT Schemes to Specify Translation of various Programming Language Construct in portion Syntax Directed Definition and Translations of Compiler

Answer» RIGHT option is (B) YACC

Easy EXPLANATION: YACC is a LALR parser.
41.

Bottom up parsing involves __________(a) Shift reduce(b) Handle pruning(c) Shift reduce & Handle pruning(d) None of the mentionedThe question was asked by my school teacher while I was bunking the class.This intriguing question originated from SDT Schemes to Specify Translation of various Programming Language Construct topic in division Syntax Directed Definition and Translations of Compiler

Answer» RIGHT option is (c) SHIFT reduce & Handle PRUNING

EXPLANATION: Explanation: The bottom up PARSING involves Shift reduce operation and Handle pruning.
42.

Which languages necessarily need heap allocation in the runtime environment?(a) Those that support recursion(b) Those that use dynamic scoping(c) Allow dynamic data structure(d) Those that use global variablesThe question was asked in unit test.The doubt is from Three-Address Statements in portion Syntax Directed Definition and Translations of Compiler

Answer»

Right choice is (c) Allow DYNAMIC DATA structure

The BEST EXPLANATION: E.g.: Heap.

43.

What data structure in a complier is used for managing information about variables and their attributes?(a) Abstract syntax tree(b) Symbol table(c) Semantic stack(d) Parse tableThis question was addressed to me during an interview.Question is taken from Intermediate Code-Generation in section Syntax Directed Definition and Translations of Compiler

Answer»

Correct choice is (b) SYMBOL table

For explanation I would say: Symbol table is used for STORING the information about VARIABLES and their ATTRIBUTES by compiler.

44.

A linker is given object module for a set of programs that were compiled separately. What is not true about an object module?(a) Object code(b) Relocation bits(c) Names and locations of all external symbols denied in the object module(d) Absolute addresses of internal symbolsThe question was posed to me during an interview for a job.The above asked question is from Syntax-Directed Definitions and Translations in chapter Syntax Directed Definition and Translations of Compiler

Answer»

Right choice is (d) ABSOLUTE addresses of internal symbols

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

45.

If E be a shifting operation applied to a function f, such that E(f) = f (x +β ), then?(a) E (αf+β g) = αE(f) +βE (g)(b) E (αf +β g ) =. ( α+ β ) + E (f + g)(c) E (αf +β g ) = α E (f+gβ)(d) E (αf +β g ) = αβ E (f + g)I got this question in an interview for internship.This question is from Syntax-Directed Definitions and Translations topic in section Syntax Directed Definition and Translations of Compiler

Answer» CORRECT OPTION is (a) E (αf+β g) = αE(f) +βE (g)

Explanation: Shifting OPERATION when performed gives this RESULT.
46.

Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?(a) O(1)(b) O(long)(c) O(n)(d) O(long)I got this question in my homework.This intriguing question comes from Syntax-Directed Definitions and Translations in portion Syntax Directed Definition and Translations of Compiler

Answer»

The correct answer is (c) O(n)

Easiest explanation: For skewed BINARY search tree on n nodes, the upper bound to INSERT a NODE is O (n).

47.

Which of the following correctly declares an array?(a) Int array[ 10](b) int array(c) array{10}(d) array array[ 10]The question was posed to me in unit test.Question is from Array Reference in chapter Syntax Directed Definition and Translations of Compiler

Answer»

The correct CHOICE is (a) INT array[ 10]

For explanation I would SAY: Correct declaration.

48.

Pick the operators that associate from the left.(a) +(b) ,(c)

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

To ELABORATE: They are LEFT ASSOCIATIVE.
49.

Loading process can be divided into two programs. The first is binder the other is ____________(a) Linkage editor(b) Module Loader(c) Relocate(d) None of the mentionedI have been asked this question in an interview for job.The origin of the question is Three-Address Statements topic in section Syntax Directed Definition and Translations of Compiler

Answer»

Correct option is (B) Module Loader

The explanation: A module loader is an ANSWER.

50.

Which of the following functions is performed by loader?(a) Allocate memory for the programs and resolve symbolic references between objects decks(b) Address dependent locations, such as address constants, to correspond to the allocated space(c) Physically place the machine instructions and data into memory(d) All of the mentionedThis question was addressed to me during an online interview.My question is taken from Syntax-Directed Definitions and Translations in division Syntax Directed Definition and Translations of Compiler

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

The EXPLANATION is: A loader is the part of an OPERATING SYSTEM that is responsible for loading programs and libraries.