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.

If A, B and C are any three sets, then A × (B ∪ C) is equal to _____________(a) (A × B) ∪ (A × C)(b) (A × B) ∩ (A × C)(c) (A ∪ B) × (A ∪ C)(d) None of the mentionedI had been asked this question by my school teacher while I was bunking the class.Asked question is from Relations topic in section Compiler Introduction of Compiler

Answer»

Correct option is (a) (A × B) ∪ (A × C)

The explanation: It is distributive LAW.

2.

If A, B and C are any three sets, then A – (B ∪ C) is equal to _____________(a) (A – B) ∪ (A – C)(b) (A – B) ∪ C(c) (A – B) ∩ (A – C)(d) (A – B) ∩ CI have been asked this question in semester exam.The above asked question is from Relations in chapter Compiler Introduction of Compiler

Answer»

The correct choice is (c) (A – B) ∩ (A – C)

For EXPLANATION I would say: it is DEMORGAN law.

3.

If A ∩ B = B, then?(a) A ⊂ B(b) A = ø(c) B ⊂ A(d) B = øThe question was posed to me in examination.I would like to ask this question from Relations in section Compiler Introduction of Compiler

Answer» CORRECT choice is (C) B ⊂ A

The EXPLANATION: Since A ∩ B = B, hence B ⊂ A.
4.

If every aRb and bRc implies aRc, then the relation is transitive.(a) True(b) FalseI had been asked this question in an online interview.My question is from Relations in section Compiler Introduction of Compiler

Answer»

Correct CHOICE is (a) True

The best explanation: a is RELATED to b by R, and b is related to C by R, and similarly for a and c.

5.

The RE in which any number of 0′s is followed by any number of 1′s followed by any number of 2′s is?(a) (0+1+2)*(b) 0*1*2*(c) 0* + 1 + 2(d) (0+1)*2*This question was addressed to me by my college professor while I was bunking the class.The above asked question is from Regular Expression in portion Compiler Introduction of Compiler

Answer» RIGHT answer is (b) 0*1*2*

The best explanation: The order for the desired STRING is 012 and for any number of 0s we write 0* for any number of 1S we DENOTE it by 1* and similarly for 2*.THUS 0*1*2*.
6.

The regular expressions denote zero or more instances of an x or y is?(a) (x+y)(b) (x+y)*(c) (x* + y)(d) (xy)*I had been asked this question in a job interview.The origin of the question is Finite Automata and Regular Expressions topic in division Compiler Introduction of Compiler

Answer»

The CORRECT choice is (B) (x+y)*

To explain I WOULD say: For instances of x or y the exp is x+y and both can zero or more TIMES than (x+y)*.

7.

The regular expression denotes a language comprising all possible strings of even length over the alphabet (0, 1).(a) 1 + 0(1+0)*(b) (0+1) (1+0)*(c) (1+0)(d) (00+0111+10)*I have been asked this question at a job interview.Origin of the question is Regular Expression in chapter Compiler Introduction of Compiler

Answer»

The correct answer is (d) (00+0111+10)*

To elaborate: Option 1 + 0(1+0)* → It does not consider even length criteria for the question.

Option (0+1) (1+0)* → It can so HAPPEN here that from the former BRACKET it takes 0 or 1 and takes NULL from the latter then it FORMS a string of odd length

Option (1+0) → It GIVES either 1 or 0.

Hence Option (00+0111+10)* is the answer.

8.

Parsing is also known as ________(a) Lexical Analysis(b) Syntax Analysis(c) Semantic Analysis(d) Code GenerationThe question was posed to me during an interview.I need to ask this question from Lexical Analysis in section Compiler Introduction of Compiler

Answer»

The correct choice is (B) Syntax Analysis

To elaborate: PARSING or SYNTACTIC analysis is the process of analysing a string of SYMBOLS and conforming to the RULES of grammar.

9.

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 mentionedThis question was addressed to me in homework.The query is from Lexical Analysis topic in division Compiler Introduction of Compiler

Answer»

The CORRECT answer is (a) SOURCE program, tokens

The best I can explain: As per the definition of Lexical Analyser which states that lexical ANALYSIS is the process of converting a sequence of characters into tokens.

10.

Regular Expressions can be used with XML checkpoints.(a) True(b) FalseThe question was asked in quiz.Question is from Finite Automata and Regular Expressions in section Compiler Introduction of Compiler

Answer» CORRECT ANSWER is (a) True

For explanation: XML checkpoints EMPLOY RE.
11.

Which of the following are not regular?(a) String of )’s which has length that is a perfect square(b) Palindromes Consisting of 0’s 1’s(c) String of 0’s whose length is a prime number(d) All of the mentionedI had been asked this question in a job interview.Query is from Finite Automata and Regular Expressions in division Compiler Introduction of Compiler

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

Easy explanation: STRINGS of ODD number of ZEROES can be generated by the regular expression (00) *0.Pumping lemma can be used to prove the non-regularity of the other OPTIONS.
12.

Which of the following statement is correct?(a) A Context free language can be accepted by a deterministic PDA(b) union of 2 CFLs is context free(c) The intersection of two CFLs is context free(d) The complement of CFLs is context freeThis question was posed to me in examination.My question comes from Finite Automata and Regular Expressions topic in chapter Compiler Introduction of Compiler

Answer»

Correct OPTION is (b) UNION of 2 CFLS is CONTEXT free

For explanation: Context-free languages are closed under the FOLLOWING operations.The Kleene star, the concatenation, the union and the intersection.

13.

Which of the following are Lexemes?(a) Identifiers(b) Constants(c) Keywords(d) All of the mentionedThis question was posed to me by my school principal while I was bunking the class.This question is from Lexical Analysis topic in section Compiler Introduction of Compiler

Answer»

The CORRECT answer is (d) All of the mentioned

Explanation: DIFFERENT Lexical Classes or Tokens or Lexemes Identifiers, Constants, Keywords, OPERATORS.

14.

Is GCC a cross Complier.(a) Yes(b) NoI have been asked this question during an online exam.Asked question is from Cross Compiler topic in chapter Compiler Introduction of Compiler

Answer»

The correct OPTION is (a) Yes

For EXPLANATION: GCC, a free software collection of compilers, also can be used as cross COMPILE. It supports many languages and PLATFORMS.

15.

Which of the following pairs of regular expressions are equivalent?(a) 1(01)* and (10)*1(b) x (xx)* and (xx)*x(c) x^+ and x^+ x^(*+)(d) All of the mentionedThe question was asked in semester exam.Enquiry is from Finite Automata and Regular Expressions in division Compiler Introduction of Compiler

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

For explanation: Rule (pq)*p=p (QP)*

Therefore–(xx*) (x*x**)

(xx*)(x*x*)[USING x**=x]

(xx*)(x*)[Using x*x*=x*]

(xx*)[Using x*xx*=x*)

x+
16.

A = {x: x ≠ x} represents?(a) {0](b) {1}(c) {}(d) {x}I have been asked this question during a job interview.I'd like to ask this question from Relations topic in division Compiler Introduction of Compiler

Answer»

Correct ANSWER is (C) {}

Easy EXPLANATION: That is a FACT.

17.

Which of the following is NOT the set of regular expression R = (ab + abb)* bbab?(a) ababbbbab(b) abbbab(c) ababbabbbab(d) ababababThe question was posed to me in exam.This key question is from Regular Expression topic in section Compiler Introduction of Compiler

Answer»

Correct answer is (d) abababab

The best explanation: abababab doesn’t END with bbab whereas the other 3 options SATISFY the GIVEN regular EXPRESSION.

18.

The __________ is a technique for building cross compilers for other machines.(a) Brazilian Cross(b) Canadian Cross(c) Mexican Cross(d) X-crossThe question was posed to me in an interview for job.This interesting question is from Cross Compiler topic in chapter Compiler Introduction of Compiler

Answer»

Right answer is (b) Canadian Cross

For explanation I would say: The Canadian Cross is a technique for BUILDING cross compilers for other machines. Given three machines X, Y, and Z, one uses MACHINE X (e.g. running Windows XP on an IA-32 PROCESSOR) to build a cross COMPILER that runs on machine Y (e.g. running Mac OS X on an x86-64 processor) to create executables for machine Z.

19.

A compiler for a high-level language that runs on one machine and produces code for a different machine is called ___________(a) Optimizing compiler(b) One pass compiler(c) Cross compiler(d) Multipass compilerI had been asked this question in an international level competition.My enquiry is from Cross Compiler topic in division Compiler Introduction of Compiler

Answer»

The CORRECT OPTION is (c) Cross COMPILER

The explanation: A compiler for a high-level language that runs on one machine and produces code for a different machine is CALLED cross compiler.

20.

Regular expression x/y denotes which of the following set?(a) {x,y}(b) {xy}(c) {x}(d) {y}I had been asked this question in an online quiz.This intriguing question originated from Finite Automata and Regular Expressions topic in chapter Compiler Introduction of Compiler

Answer» CORRECT CHOICE is (a) {X,y}

Explanation: Because either x or y can be SELECTED.
21.

The number of proper subsets of the set {1, 2, and 3} is?(a) 8(b) 6(c) 7(d) 5I had been asked this question during an online interview.The above asked question is from Relations in section Compiler Introduction of Compiler

Answer»

Right ANSWER is (b) 6

Easiest explanation: Number of PROPER subsets of the SET {1, 2, 3) = 2^3 – 2 = 6.

22.

Which concept of grammar is used in the compiler?(a) Lexical analysis(b) Parser(c) Code generation(d) Code optimizationThe question was posed to me in examination.This question is from Lexical Analysis in division Compiler Introduction of Compiler

Answer»

Right OPTION is (b) PARSER

Best explanation: As the lexical ANALYSIS of a GRAMMAR takes place in phases hence it is synonymous to parser.

23.

Which of the following is integral data type?(a) void(b) char(c) float(d) doubleThe question was posed to me in unit test.My question is based upon Cross Compiler in chapter Compiler Introduction of Compiler

Answer»

Right choice is (B) char

Easy explanation: In C char is INTEGRAL DATA type. It stores the ASCII value.

24.

All __________ are automatically treated as regular expressions.(a) Programmatic description(b) Window(c) Win Object(d) CollectionI got this question in unit test.My question is taken from Finite Automata and Regular Expressions in portion Compiler Introduction of Compiler

Answer» CORRECT OPTION is (a) Programmatic DESCRIPTION

Easy EXPLANATION: It is SEEN that programmatic description are treated as regular expression.
25.

An FSM with __________(a) M can be transformed to Numeral relabeling its states(b) M can be transformed to N, merely relabeling its edges(c) Both of the mentioned(d) None of the mentionedThis question was addressed to me during a job interview.My doubt stems from Finite Automata and Regular Expressions topic in division Compiler Introduction of Compiler

Answer»

Right option is (C) Both of the mentioned

The EXPLANATION is: The Definition of FSM states that M can be transformed to N by RELABELING its states or its edges.

26.

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 mentionedThe question was posed to me in semester exam.This question is from Lexical Analysis in chapter Compiler Introduction of Compiler

Answer»

The CORRECT answer is (d) NONE of the mentioned

The explanation: This is a LOGICAL ERROR that can’t be detected by any compiler or interpreter.

27.

(a,b) what is b?(a) Domain(b) Range(c) Domain & Range(d) None of the mentionedThis question was addressed to me by my school principal while I was bunking the class.I'd like to ask this question from Relations topic in section Compiler Introduction of Compiler

Answer» RIGHT OPTION is (B) RANGE

Explanation: B is CALLED the Range.
28.

Empty set is a _____________(a) Invalid set(b) Infinite set(c) Finite set(d) None of the mentionedThe question was posed to me in quiz.This is a very interesting question from Relations in division Compiler Introduction of Compiler

Answer»

Right OPTION is (C) FINITE set

The best EXPLANATION: Empty set is a finite set.

29.

All ___________ are automatically treated as regular expressions.(a) Programmatic description(b) Window(c) Win Object(d) CollectionI had been asked this question in unit test.My doubt stems from Regular Expression in division Compiler Introduction of Compiler

Answer»

The correct OPTION is (a) PROGRAMMATIC description

To elaborate: The programmatic description is GENUINELY treated as regular expression.

30.

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 mentionedI had been asked this question by my college professor while I was bunking the class.This interesting question is from Lexical Analysis in section Compiler Introduction of Compiler

Answer» RIGHT CHOICE is (c) Lexical analysis, syntax, Analysis and code generation

The BEST I can explain: As DEFINED in the compilation process.
31.

Which concept of FSA is used in the compiler?(a) Lexical analysis(b) Parser(c) Code generation(d) Code optimizationThe question was asked in a national level competition.I would like to ask this question from Lexical Analysis in section Compiler Introduction of Compiler

Answer»

Correct choice is (a) Lexical analysis

For EXPLANATION: Because the lexer PERFORMS its analysis by going from one STAGE to another.

32.

What is an Object program?(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 mentionedI had been asked this question in an interview.My query is from Lexical Analysis in chapter Compiler Introduction of Compiler

Answer»

The correct CHOICE is (c) Translation of high-level LANGUAGE into MACHINE language

The BEST explanation: Since the input is the source language and the output that we GET after the analysis is the machine language.

33.

Which of the following is true for operator precedence parsing?(a) For all pair of non-terminal(b) For all pair of non-terminals(c) To delimit the handle(d) None of the mentionedI got this question in an online quiz.Query is from Lexical Analysis topic in section Compiler Introduction of Compiler

Answer»

The CORRECT option is (a) For all pair of non-terminal

To explain: 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.

34.

What is the output of lexical analyzer?(a) A set of RE(b) Syntax Tree(c) Set of Tokens(d) String CharacterThis question was posed to me during an online exam.The question is from Lexical Analysis topic in section Compiler Introduction of Compiler

Answer» CORRECT option is (c) SET of TOKENS

The explanation: A lexical analyzer coverts CHARACTER SEQUENCES to set of tokens.
35.

If A and B are any two sets, then A ∪ (A ∩ B) is equal to _____________(a) A(b) B(c) A^C(d) B^CI had been asked this question in a national level competition.Question is from Relations in section Compiler Introduction of Compiler

Answer» RIGHT OPTION is (a) A

Easy EXPLANATION: A ∩ B ⊆ A HENCE A ∪ (A ∩ B) = A.
36.

If we compile the sam.c file with the command “gcc -o sam sam.c”, then the executable file will be?(a) a.out(b) sam(c) sam.out(d) None of the mentionedThe question was posed to me during an internship interview.My question comes from Cross Compiler in section Compiler Introduction of Compiler

Answer» CORRECT option is (b) sam

For EXPLANATION: This is how the GCC is designed to TAKE names of executable FILES.
37.

What is the Regular Expression Matching Zero or More Specific Characters?(a) x(b) #(c) *(d) &The question was posed to me by my school principal while I was bunking the class.I need to ask this question from Finite Automata and Regular Expressions in section Compiler Introduction of Compiler

Answer»

The correct answer is (C) *

To EXPLAIN: ZERO or SPECIFIC Expression matching can be done only by a SINGLE character that is*.

38.

A regular expression enables a quick test to determine objects and text strings with undependable values.(a) True(b) FalseI have been asked this question in examination.This question is from Regular Expression in portion Compiler Introduction of Compiler

Answer»

The correct option is (a) True

Easy EXPLANATION: Because it CHECKS for all the VALUES and DETERMINES whether the output string matches with the GIVEN string.

39.

Given a NFA with N states, the maximum number of states in an equivalent minimized DFA is at least.(a) N^2(b) 2^N(c) 2N(d) N!This question was addressed to me during an online exam.My question is taken from Finite Automata and Regular Expressions topic in division Compiler Introduction of Compiler

Answer»

Right choice is (b) 2^N

To explain: The initial state of the DFA constructed from this NFA is the set of all NFA states that are reachable from state 1 by ε-moves; that is, it is the set {1, 2, and 3}. A transition from states1, 2, and 3 by input symbol 0 must FOLLOW EITHER the arrow from state 1 to 2, or from state 3 to 4. ALSO, NEITHER state 2 nor 4 have OUTGOING ε-moves.

40.

R is said to be reflexive if aRa is true for every a in A.(a) True(b) FalseThe question was asked in exam.This is a very interesting question from Relations topic in section Compiler Introduction of Compiler

Answer» CORRECT choice is (a) True

The best explanation: All the elements of A are related with itself by relation R, HENCE it is a REFLEXIVE relation.
41.

The regular expression with all strings of 0′s and 1′s with at least two consecutive 0′s is?(a) 1 + (10)*(b) (0+1)*00(0+1)*(c) (0+1)*011(d) 0*1*2*The question was posed to me in an online interview.My question is based upon Regular Expression topic in section Compiler Introduction of Compiler

Answer»

The correct option is (b) (0+1)*00(0+1)*

The explanation: The expression (0+1)*00(0+1)* is where EITHER it initially takes 0 or 1 or 00 FOLLOWED by string of COMBINATION of 0 and 1.

42.

Which of the following is not a 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 moreThe question was asked in a national level competition.This intriguing question originated from Lexical Analysis in portion Compiler Introduction of Compiler

Answer» RIGHT CHOICE is (d) EXECUTION TIME is more

Explanation: The objective of the COMPILER is clearly not to increase the execution time of the program.
43.

Regular expressions can be used only for values of type string and number.(a) True(b) FalseThe question was asked during an online interview.This interesting question is from Finite Automata and Regular Expressions in section Compiler Introduction of Compiler

Answer» CORRECT CHOICE is (B) False

The explanation is: RE is used for all types of STRING and numbers.
44.

Regular expression (x/y)(x/y) denotes which of the following set?(a) {xy,xy}(b) {xx,xy,yx,yy}(c) {x,y}(d) {x,y,xy}I have been asked this question in my homework.This intriguing question originated from Finite Automata and Regular Expressions in chapter Compiler Introduction of Compiler

Answer» RIGHT option is (b) {xx,XY,yx,YY}

Easiest explanation: From first part if we take x then from the LATTER part x then it forms xx

From first part if we take x then from the latter part y then it forms xy

From first part if we take y then from the latter part x then it forms yx

From first part if we take y then from the latter part y then it forms yy.
45.

If A, B, C be three sets such that A ∪ B = A ∪ C and A ∩ B = A ∩ C, then?(a) A=B(b) A=C(c) B=C(d) A=B=CThis question was posed to me in my homework.This question is from Relations in chapter Compiler Introduction of Compiler

Answer»

The correct OPTION is (C) B=C

For EXPLANATION: Transition LAW.

46.

If a ‘/’ is used before a character that has no special meaning, ‘/’ is ignored.(a) True(b) FalseThe question was posed to me in unit test.I need to ask this question from Regular Expression topic in portion Compiler Introduction of Compiler

Answer» RIGHT answer is (a) True

To ELABORATE: The BACKSLASH carries no SIGNIFICANCE and it is ignored.
47.

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 mentionedI had been asked this question in final exam.This intriguing question originated from Lexical Analysis in chapter Compiler Introduction of Compiler

Answer» CORRECT choice is (a) SOURCE Program

Best EXPLANATION: The input that we give in high LEVEL language is also known as the source language.
48.

__________ was developed from the beginning as a cross compiler.(a) Free Pascal(b) GCC(c) Pascal(d) None of the mentionedThis question was addressed to me during a job interview.I'm obligated to ask this question of Cross Compiler in portion Compiler Introduction of Compiler

Answer»

Right choice is (a) Free Pascal

Easy explanation: Free Pascal was DEVELOPED from the beginning as a cross compiler. The compiler executable (ppcXXX where XXX is target architecture) is CAPABLE of producing executables for all OS of the same architecture.

49.

If ∑ = {a, b, c, d, e, f} then number of strings in ∑ of length 4 such that no symbol is used more than once in a string is(a) 35(b) 360(c) 49(d) 720The question was asked in my homework.This question is from Finite Automata and Regular Expressions topic in division Compiler Introduction of Compiler

Answer» RIGHT ANSWER is (b) 360

Best explanation: Here string length is 4 so we CREATE string of length 4 by 6 values firstly we arrange any value by 6 methods. Then Remaining numbers are 5 so we can arrange them by 5 methods then remaining numbers are 4 so we arrange them by 4 methods and then 3.Thus 6*5*4*3=360.
50.

Cross-compiler is a compiler __________(a) Which is written in a different language from the source language?(b) That generates object code for the machine it’s running on.(c) Which is written in the same language as the source language?(d) That runs on one machine but produces object code for another machineThe question was posed to me in a national level competition.My doubt stems from Cross Compiler topic in chapter Compiler Introduction of Compiler

Answer»

The correct choice is (a) Which is WRITTEN in a DIFFERENT language from the source language?

For explanation: A COMPILER for a high-level language that runs on ONE machine and PRODUCES code for a different machine is called a cross compiler.