Question 51
Question 52
Question 53
#includeThe output of the program upon execution is _________ .int foo(int x, int y, int q) { if ((x<=0) && (y<=0)) return q; if (x<=0) return foo(x, y-q, q); if (y<=0) return foo(x-q, y, q); return foo(x, y-q, q) + foo(x-q, y, q); } int main( ) { int r = foo(15, 15, 10); printf(“%d”, r); return 0; }
Question 54
Question 55
S′ → S S → S#cS S → SS S → S@ S → <S> S → a S → b S → cLet I0=CLOSURE({S′→∙S}). The number of items in the set GOTO(GOTO(I0 <), <) is ___________ .
Question 56
f(w,0,0,z) = 1 f(1,x,1,z) = x+z f(w,1,y,z) = wz+yThe number of literals in the minimal sum-of-products expression of f is _________ .
Question 57
ADD, MUL, ADD, MUL, ADD, MUL, ADD, MULAssume that every MUL instruction is data-dependent on the ADD instruction just before it and every ADD instruction (except the first ADD) is data-dependent on the MUL instruction just before it. The speedup defined as follows.
Speedup = (Execution time without operand forwarding) / (Execution time with operand forwarding)The Speedup achieved in executing the given instruction sequence on the pipelined processor (rounded to 2 decimal places) is _____________ .
Question 58
Question 59
Consider the following ANSI C code segment:
z=x + 3 + y->f1 + y->f2;
for (i = 0; i < 200; i = i + 2)
{
if (z > i)
{
p = p + x + 3;
q = q + y->f1;
} else
{
p = p + y->f2;
q = q + x + 3;
}
}
Assume that the variable y points to a struct (allocated on the heap) containing two fields f1 and f2, and the local variables x, y, z, p, q, and i are allotted registers. Common sub-expression elimination (CSE) optimization is applied on the code. The number of addition and the dereference operations (of the form y ->f1 or y ->f2) in the optimized code, respectively, are:
Question 60
There are 65 questions to complete.