Home / Study library / Compiler Design / Quiz 2 · May 2026 Compiler Design · Quiz 2 · May 2026
Compiler Design · Quiz 2 · May 2026
← Course papers · Start practice / exam
Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
0 / 17 published solutions
Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18
Question 2 MSQ · 2.0 marks Consider the regular language
over the alphabet
Which of the following strings belong to
? (Select all that apply.)
6406537123268. 6406537123269. 6406537123270. 6406537123271. 6406537123272. A published solution is not available for this question yet.
Report a correction for Q2
Question 3 MCQ · 3.0 marks A lexical analyzer uses the following rules.
The keyword rule has **higher priority** than the identifier rule.
Input
Which of the following gives the correct number of **Keyword**, **Identifier**, and **Number** tokens?
A published solution is not available for this question yet.
Report a correction for Q3
Question 4 MCQ · 3.0 marks Convert the following infix expression to postfix notation:
Which one of the following is the correct postfix expression?
6406537123287. 6406537123288. 6406537123289. 6406537123290. A published solution is not available for this question yet.
Report a correction for Q4
Question 5 MCQ · 3.0 marks A parser generator performs the following steps:
1. Construct the canonical LR(1) collection of item sets.
2. Merge all states having the same LR(0) core.
3. Construct the ACTION and GOTO tables from the merged automaton.
Which parsing technique is obtained after these steps?
6406537123296. Canonical LR(1)
A published solution is not available for this question yet.
Report a correction for Q5
Question 6 MCQ · 3.0 marks Consider the grammar
The initial state is
Which of the following is GOTO(I0, b) ?
6406537123299. 6406537123300. 6406537123301. 6406537123302. A published solution is not available for this question yet.
Report a correction for Q6
Question 7 MCQ · 3.0 marks Consider the grammar:
A shift-reduce parser is parsing the input:
The parser has already performed the following actions:
What should be the **next action**?
6406537123303. Shift
6406537123304. Reduce
6406537123305. Reduce
A published solution is not available for this question yet.
Report a correction for Q7
Question 8 MCQ · 3.0 marks Consider the production
The semantic rules are
Which of the following is the **minimum valid attribute evaluation sequence**?
6406537123320. 6406537123321. 6406537123322. 6406537123323. A published solution is not available for this question yet.
Report a correction for Q8
Question 9 MCQ · 3.0 marks Consider the following overloaded functions.
The compiler evaluates the following function calls.
Which **one** of the following function calls requires **integer promotion** before overload resolution
selects the best match?
6406537123324. 6406537123325. 6406537123326. 6406537123327. A published solution is not available for this question yet.
Report a correction for Q9
Question 10 MCQ · 3.0 marks An embedded SDT contains the production
To convert it into an equivalent postfix SDT while preserving the execution point of the action
, which of the following transformations is correct?
6406537123328. 6406537123329. 6406537123330. 6406537123331. A published solution is not available for this question yet.
Report a correction for Q10
Question 11 NAT · 3.0 marks Consider the alphabet
A published solution is not available for this question yet.
Report a correction for Q11
Question 12 NAT · 3.0 marks Consider the following operator grammar:
An operator-precedence parser is used to parse the expression
using the following precedence and associativity rules:
•
has higher precedence than
.
• Both operators are left associative .
Ignoring the end marker
, how many reduce operations are performed by the parser while
parsing the expression?
A published solution is not available for this question yet.
Report a correction for Q12
Question 13 MSQ · 4.0 marks Consider the grammar
and the following recursive descent parser.
Assume that:
• Parsing starts by calling
.
•
consumes the current input symbol only if it matches the expected symbol.
• Any call that reports an error (i.e., executes
) immediately causes the parse to
fail, even if the final lookahead is
.
• After
returns, the input is accepted only if no error has been reported and the current
lookahead is
.
Which of the following input strings is/are accepted?
6406537123278. 6406537123279. 6406537123280. 6406537123281. A published solution is not available for this question yet.
Report a correction for Q13
Question 14 MCQ · 2.0 marks A context-free grammar contains the productions
Which language is generated?
6406537123282. 6406537123283. 6406537123284. All strings over
6406537123285. A published solution is not available for this question yet.
Report a correction for Q14
Question 15 MCQ · 2.0 marks Consider the following statements about SLR(1), Canonical LR(1), and LALR(1) parsers.
1. Every SLR(1) grammar is also an LALR(1) grammar.
2. Every LALR(1) grammar is also an LR(1) grammar.
3. Every LR(1) grammar is also an LALR(1) grammar.
Which of the following is correct?
6406537123307. Only 1 and 2
6406537123308. Only 2 and 3
6406537123309. Only 1 and 3
A published solution is not available for this question yet.
Report a correction for Q15
Question 16 MCQ · 4.0 marks Consider the grammar.
Which of the following correctly gives **FIRST(S)** and **FOLLOW(X)**?
6406537123291. FIRST(S) = {p, q, r, s}
FOLLOW(X) = {r, s, $}
6406537123292. FIRST(S) = {p, q, r, s, ε}
FOLLOW(X) = {r, s}
6406537123293. FIRST(S) = {p, q, s}
FOLLOW(X) = {$}
6406537123294. FIRST(S) = {p, q, r, s}
FOLLOW(X) = {r, s}
A published solution is not available for this question yet.
Report a correction for Q16
Question 17 MSQ · 3.0 marks A student wants the exponentiation operator (
) to have higher precedence than multiplication.
They write the following Bison declarations.
For the expression
which of the following statements are correct? (Select all that apply.)
6406537123311. The expression is parsed as
.
6406537123312. The expression is parsed as
.
6406537123313. The
declaration makes
right-associative.
6406537123314. The value of the expression is
.
A published solution is not available for this question yet.
Report a correction for Q17
Question 18 MSQ · 3.0 marks Consider the SDD.
Which of the following statements are correct?
6406537123315. is a synthesized attribute.
6406537123316. is typically provided by the lexical analyzer.
6406537123317. This SDD requires inherited attributes for expression evaluation.
6406537123318. is inherited because it depends on
.
6406537123319. The attribute evaluation naturally proceeds from the leaves toward the root.
A published solution is not available for this question yet.
Report a correction for Q18