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.

LR stands for ___________(a) Left to right(b) Left to right reduction(c) Right to left(d) Right most derivation and Left to right and a in reverseI got this question during an online interview.This interesting question is from Error Recovery in LR phase in division Error Handling of Compiler

Answer»

Correct ANSWER is (d) Right most DERIVATION and Left to right and a in reverse

The BEST I can explain: Right most derivation and left to right and in reverse is used for LR.

2.

Which is the most powerful parser?(a) SLR(b) LALR(c) Canonical LR(d) Operator-precedenceThe question was posed to me by my college professor while I was bunking the class.The origin of the question is Error Recovery in LR phase topic in chapter Error Handling of Compiler

Answer» CORRECT ANSWER is (c) CANONICAL LR

The EXPLANATION: Canonical tops all other parsers.
3.

How is the parsing precedence relations defined?(a) None of the mentioned(b) All of the mentioned(c) To delimit the handle(d) Only for a certain pair of terminalsThe question was asked in my homework.My question is based upon Error Recovery in LR phase topic in section Error Handling of Compiler

Answer»

Right option is (B) All of the mentioned

The EXPLANATION: The REASON why the precedence OPERATIONS is PERFORMED.

4.

Recursive descent parsing is an example of ____________(a) Top down parsing(b) Bottom up parsing(c) Predictive parsing(d) None of the mentionedI had been asked this question in exam.This intriguing question comes from Error Recovery in LR phase in chapter Error Handling of Compiler

Answer» CORRECT CHOICE is (a) TOP down parsing

To EXPLAIN: Top down is the ANSWER.
5.

Choose the correct statement.(a) CFG is not LR(b) Ambiguous Grammar can never be LR(c) CFG is not LR & Ambiguous Grammar can never be LR(d) None of the mentionedI got this question in examination.My question is from Error Recovery in LR phase in section Error Handling of Compiler

Answer»

The correct ANSWER is (c) CFG is not LR & Ambiguous GRAMMAR can never be LR

Easy explanation: Mentioned reason is TRUE.

6.

The grammar S → aSa | bS | c is?(a) LL(1) but not LR(1)(b) LR(1) but not LR(1)(c) Both LL(1) but not LR(1) & LR(1) but not LR(1)(d) None of the mentionedI had been asked this question in an interview for job.The query is from Error Recovery in LR phase in section Error Handling of Compiler

Answer»

Correct OPTION is (c) Both LL(1) but not LR(1) & LR(1) but not LR(1)

EXPLANATION: First(aSa) = a

First(BS) = b

First(c) = c

LR parsers are more powerful than LL (1) parsers and LR (1).

7.

When will the relationship between ‘’ be

Answer»

The correct answer is (d) Undefined

For EXPLANATION I would SAY: Undefined. There is no EXISTING relationship between the two.

8.

When will the relationship between ‘+’ and ‘-’ be

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

To explain I WOULD SAY: Both statements are true.