Compiler Design questions

Q8

GATE CS 2018 CSParsingMCQ1 mark−1/3 if wrong
Which one of the following statements is FALSE?
Show answer without attempting

Answer: B

Q37

GATE CS 2018 CSLexical AnalysisMCQ2 marks−2/3 if wrong
A lexical analyzer uses the following patterns to recognize three tokens T1,T2T_1, T_2, and T3T_3 over the alphabet {a,b,c}\{a, b, c\}.

T1T_1: a?(b∣c)∗aa? (b|c)^* a
T2T_2: b?(a∣c)∗bb? (a|c)^* b
T3T_3: c?(b∣a)∗cc? (b|a)^* c

Note that 'x?' means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix.

If the string bbaacabcbbaacabc is processed by the analyzer, which one of the following is the sequence of tokens it outputs?
Show answer without attempting

Answer: D

Q38

GATE CS 2018 CSParsingMCQ2 marks−2/3 if wrong
Consider the following parse tree for the expression a#b$c$d#e#fa \# b \$ c \$ d \# e \# f, involving two binary operators $\$ and #\#.

Which one of the following is correct for the given parse tree?
Question figure
Show answer without attempting

Answer: A

0/30 correct0 marks

Related topics in GATE CS