Andhra University 2006 B.E Information Technology COMPUTER SCIENCE
Wednesday, 01 May 2013 08:05Web
Page 11 of 15
E ® b
In the predictive parse table. M, of this grammar, the entries M[S', eJ and M[S ’, $] respectively are
(a) {S' ® e S} and {S' ® e } (b) {S' ® e S} and {}
(c) {S' ® e } and {S' ® e } (d) {S' ® e S, S' ® e } and {S' ® e }
57. Consider the grammar shown beneath.
S ® CC
C ® cC | d
The grammar is
LL (1)
SLR (1) but not LL (1)
LALR (1) but not SLR (1)
LR (1) but not LALR (1)
58. Consider the translation scheme shown beneath
S ® TR
R ® + T {print ('+');} R | e
T ® num {print (num.val);}
Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string '9 + five + 2’, this translation scheme will print
9 + five + two
9 five + two +
9 five two + +
+ + nine five two
59. Consider the syntax directed definition shown beneath.
S ® id : = E {gen (id.place = E.place;);}
E ®E one + E two {t = newtemp ( );
gen (t = E 1. place + E 2.place;);
E.place = t}
E ® id {E.place = id.place;}
Here, gen is a function that generates the output code, and newtemp is a function that returns the name of a new temporary variable on every call. presume that t i's are the temporary variable names generated by newtemp.
For the statement 'X: = Y + Z', the 3-address code sequence generated by this definition is
(a) X = Y + Z
(b) t one = Y + Z; X t one
(c) t one = Y; t two = t one + Z; X = t2
(d) t one = Y; t two = Z; t three = t one + t 2; X = t three
60. A program consists of 2 modules executed sequentially. Let f 1(t) and f 2(t) respectively denote the probability density functions of time taken to execute the 2 modules. The probability density function of the overall time taken to execute the program is provided by
f one (t) + f 2(t)
max {f 1(t), f 2(t)}
THE subsequent info PERTAINS TO Q. 61-62
In a permutation a 1…a n of n distinct integers, an inversion is a pair (a i, a j) such that i
61. If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of 1...n ?
Earning: Approval pending. |