Theory Of Computation And Compiler Design Set 4

On This Page

This set of Theory of Computation and Compiler Design Multiple Choice Questions & Answers (MCQs) focuses on Theory Of Computation And Compiler Design Set 4

Q1 | Which of the following grammar rules violate the requirements of an operator grammar ? P, Q, R are nonterminals, and r, s, t are terminals.1. P ? Q R2. P ? Q s R3. P ? ?4. P ? Q t R r
Q2 | Consider the grammar with the following translation rules and E as the start symbol.E ? E1 # T { E.value = E1.value * T.value } | T{ E.value = T.value }T ? T1 & F { T.value = T1.value + F.value } | F{ T.value = F.value }F ? num { F.value = num.value }Compute E.value for the root of the parse tree for the expression: 2 # 3 & 5 # 6 & 4.
Q3 | Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states. The relationship between n1 and n2 is:
Q4 | Consider the grammar shown below S ? i E t S S' | a S' ? e S | ? E ? b In the predictive parse table. M, of this grammar, the entries M[S', e] and M[S', $] respectively are
Q5 | Consider the translation scheme shown belowS ? T RR ? + T {print ('+');} R | ?T ? num {print (num.val);}Here num is a token that represents an integer and num.val represents thecorresponding integer value. For an input string '9 + 5 + 2', this translation scheme willprint
Q6 | Which of the following is essential for converting an infix expression to the postfix from efficiently?
Q7 | The grammar whose productions are ? if id then ? if id then else ? id := idis ambiguous becausea) the sentence if a then if b then c:= d has two parse treesb) the left most and right most derivations of the sentence if a then if b then c:= d give rise to different parse treesc) the sentence if a then if b then c:= d else c:= f has more than two parse treesd) the sentence if a then if b then c:= d else c:= f has two parse trees
Q8 | Consider the following grammars(S1) :A --> aBCDB --> bc|cC --> d|?D -> b(S2) :A --> aBCDB --> bc|?C --> d|cD -> b(S3) :A --> aBCDB --> bc|?C --> d|?D -> b(S4) :A --> aBCDB --> bc|cC --> d|cD -> bWhich of the following grammar has same follow set for variable B?
Q9 | Which is True about SR and RR-conflict:
Q10 | Which of the following statement(s) regarding a linker software is/are true ? I A function of a linker is to combine several object modules into a single load module. II A function of a linker is to replace absolute references in an object module by symbolic references to locations in other modules.
Q11 | Shift-Reduce parsers perform the following:
Q12 | Incremental-Compiler is a compiler
Q13 | Which one of the following is FALSE?
Q14 | Consider the following C code segment.for (i = 0, i
Q15 | Consider the intermediate code given below:1. i = 12. j = 13. t1 = 5 * i4. t2 = t1 + j5. t3 = 4 * t26. t4 = t37. a[t4] = –18. j = j + 19. if j <= 5 goto(3)10. i = i + 111. if i < 5 goto(2)The number of nodes and edges in the control-flow-graph constructed for the abovecode, respectively, are
Q16 | Consider the following code segment.x = u - t;y = x * v;x = y + w;y = t - z;y = x * y;The minimum number of total variables required to convert the above code segment tostatic single assignment form is Note : This question was asked as Numerical AnswerType.
Q17 | A linker reads four modules whose lengths are 200, 800, 600 and 500 words respectively. If they are loaded in that order, what are the relocation constants?
Q18 | A language L allows declaration of arrays whose sizes are not known during compilation. It is required to make efficient use of memory. Which of the following is true?
Q19 | The expression (a*b)* c op........ where 'op' is one of '+', '*' and '?' (exponentiation) can be evaluated on a CPU with a single register without storing the value of (a * b) if
Q20 | Which of the following macros can put a micro assembler into an infinite loop?(i).MACRO M1 X.IF EQ, X ;if X=0 thenM1 X + 1.ENDC.IF NE X ;IF X?0 then.WORD X ;address (X) is storedhere.ENDC.ENDM(ii).MACRO M2 X.IF EQ XM2 X.ENDC.IF NE, X.WORD X+1.ENDC.ENDM
Q21 | Consider the following expressionu*v+a-b*cWhich one of the following corresponds to a static single assignment from the above expressions
Q22 | In multi-programmed systems, it is advantageous if some programs such as editors and compilers can be shared by several users. Which of the following must be true of multi-programmed systems in order that a single copy of a program can be shared by several users?I. The program is a macroII. The program is recursiveIII.The program is reentrant