Exam 4: Compilation and Programming Languages

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Consider the intermediate code given below: 1) i = 1 2) j = 1 3) T1 = 5 * i 4) T2 = T1 + j5 ) T3 = 4 * T2 6) t4 = T3 7) a[ t4] = -1 8) j = j + 1 9) if j <= 5 goto(3) 10) i = i + 1 11) if i < 5 goto(2) The number of nodes and edges in the control-flow-graph constructed for the abovecode, respectively, are

Free
(Multiple Choice)
4.8/5
(35)
Correct Answer:
Verified

B

Consider the following C code segment. For (i = 0, i

Free
(Multiple Choice)
4.8/5
(34)
Correct Answer:
Verified

D

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.

Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
Verified

C

Consider the following expressionu *v+a-b*c Which one of the following corresponds to a static single assignment from the above expressions

(Multiple Choice)
4.9/5
(33)

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:

(Multiple Choice)
4.9/5
(37)

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 macro II. The program is recursive III.The program is reentrant

(Multiple Choice)
4.8/5
(31)

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.

(Multiple Choice)
4.9/5
(34)

Incremental-Compiler is a compiler

(Multiple Choice)
4.8/5
(43)

Shift-Reduce parsers perform the following:

(Multiple Choice)
4.8/5
(40)

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?

(Multiple Choice)
4.9/5
(42)

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 R 2) P ? Q s R 3) P ? ? 4) P ? Q t R r

(Multiple Choice)
4.8/5
(40)

Which is True about SR and RR-conflict:

(Multiple Choice)
4.9/5
(49)

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

(Multiple Choice)
4.8/5
(39)

Which of the following macros can put a micro assembler into an infinite loop? (i) )MACRO M1 X )IF EQ, X ;if X=0 then M1 X + 1 )ENDC )IF NE X ;IF X?0 then )WORD X ;address (X) is stored Here )ENDC )ENDM (ii) )MACRO M2X )IF EQ XM2 X. ENDC )IF NE, X )WORD X+1 )ENDC )ENDM

(Multiple Choice)
4.9/5
(43)

The grammar whose productions are ? if id then ? if id then else ? id := id Is ambiguous because A- the sentence if a then if b then c:= d has two parse trees B- the left most and right most derivations of the sentence if a then if b then c:= d give rise to different parse trees C- the sentence if a then if b then c:= d else c:= f has more than two parse trees D- the sentence if a then if b then c:= d else c:= f has two parse trees

(Multiple Choice)
4.8/5
(31)

Which of the following is essential for converting an infix expression to the postfix from efficiently?

(Multiple Choice)
4.9/5
(38)

Consider the following grammars (S1) : A --> aBCD B --> bc|c C --> d|? D -> b(S2) : A --> aBCD B --> bc|? C --> d|c D -> b ( S3) : A --> aBCD B --> bc|? C --> d|? D -> b ( S4) : A --> aBCD B --> bc|c C --> d|c D -> b Which of the following grammar has same follow set for variable B?

(Multiple Choice)
4.7/5
(47)

Consider the translation scheme shown below S ? T R R ? + 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

(Multiple Choice)
4.8/5
(32)

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?

(Multiple Choice)
4.9/5
(30)

Which one of the following is FALSE?

(Multiple Choice)
4.9/5
(45)
Showing 1 - 20 of 22
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)