Q15
Among simple LR (SLR), canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful, in that order?
Show answer without attempting
Answer: C
GATE CS · 10 questions
10 Compiler Design questions from GATE CS papers (2015), each with the official answer key. Answer any question right here and it is marked straight away, or practise them one at a time.
Answer: C
sumcal(int maxint, int value)
{
int result=0, i=0;
if (value < 0)
{
value = -value;
}
while((i<value) AND (result <= maxint))
{
i=i+1;
result = result + 1;
}
if (result <= maxint)
{
printf(result);
}
else
{
printf("large");
}
printf("end of program");
}
Answer: A
Answer: D
Answer: C
while (first <= last)
{
if (array[middle] < search)
first = middle + 1;
else if (array[middle] == search)
found = TRUE;
else last = middle - 1;
middle = (first + last)/2;
}
if (first > last) notPresent = TRUE;Answer: 5

Answer: C
Answer: 8
Answer: C
Answer: C
(1) i = 1
(2) j = 1
(3) t1 = 5 * i
(4) t2 = t1 + j
(5) 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)Answer: B
0/100 correct0 marks