Question Paper: Systems Programming : Question Paper May 2015 - Information Technology Engineering (Semester 6) | Pune University (PU)
0

## Systems Programming - May 2015

### Information Technology Engineering (Semester 6)

TOTAL MARKS: 100
TOTAL TIME: 3 HOURS
(1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks.

### Answer any one question from Q1 and Q2

1 (a) For the 'C' code given below, give the different tables that would be generated as output of lexical analysis.
main ( )
{
int i, sum, n;
float avg;
n=10;
sum=c;
for(i= 1; i<=10 ;i++)
sum =sum + i;
avg = sum / (float)n ;
}
(8 marks)
1 (b) Define macroprocessor and assembler and give examples for each.(2 marks) 10 (a) For the following statement, Generate intermediate code in the format:
i) Postfix notation
iii) Parse tree
iv) Triple
S = (a+b) / (c-d)
(8 marks)
10 (b) Explain concept of type checking.(4 marks) 10 (c) Generate three address code for
while (i<10)
{
x=0;
i=i+1;
}
(4 marks)
2 (a) Give the various data structures in the design of pass-1 of a Two-pass direct linking loader.(4 marks) 2 (b) What are the assembler directives? Explain how assembler directives LTORG, ORIGIN and EQU are processed in first pass.(6 marks)

### Answer any one question from Q3 and Q4

3 (a) For the following piece of assembly language code, show the contents of symbol table, literal table and pool-tab. Assume size of instruction equal to one.
START 202
MOVER AREG, ='5
MOVEM AREG, A
LOOP MOVER AREG, A
MOVER CREG, B
MOVEM CREG, B
SUB CREG, A
BC ANY, NEXT
LTORG
BC LE LOOP
NEXT SUB AREG, = '1'
BC LT, BACK
STOP
ORIGIN 219
MULT CREG, B
A DS 1
BACK EQU LOOP
B DS 1
END
(5 marks)
3 (b) Define loader and enlist the basic functions of loader.(5 marks) 4 (a) Explain the first three phases of compiler w.r.t. the following statement:
r = a^10 / (c*d^e)
Note: ^ is exponentiation operator
(6 marks)
4 (b) Explain different parameter passing mechanisms in macro-processor.(4 marks)

### Answer any one question from Q5 and Q6

5 (a) Consider the grammar
E→E-E
E→E*E
E→id
Perform shift Reduce parsing of i/p string 'id-id * id'
(4 marks)
5 (b) Define table driven predictive parser. For the following grammar.
S→AaBb
A→ ϵ
B→ϵ
Construct table-driven predictive parser and parse the string 'ab'.
(10 marks)
5 (c) Compare bottom up and top down parser.(4 marks) 6 (a) Consider the following grammar:
S→L|a
L→L, s|s
Construct SLR parser and parse for the string (a, (a,a)).
(10 marks)
6 (b) Explain YACC file structure.(4 marks) 6 (c) Explain problem of left factoring in top down parser.(4 marks)

### Answer any one question from Q7 and Q8

7 (a) Optimize the following code.
a = x^2
b = 3
c = x
d = cc
e=b+2
f = a+d
g = e
f
(8 marks)
7 (b) Write short note on activation record.(4 marks) 7 (c) Explain in brief run time storage allocation.(4 marks) 8 (a) Explain any one technique of machine dependent code optimization.(6 marks) 8 (b) Comparison between static, stack & heap allocation.(6 marks) 8 (c) Explain machine dependent optimization issues.(4 marks)

### Answer any one question from Q9 and Q10

9 (a) Design dependency graph for the following grammar.
S → T List
T → int
T → float
T → char
T → double
List → List 1/id.
(4 marks)
9 (b) Translate the following C fragment into the three address code.
int i;
int a[10][10];
i = 0;
while (i< 10)
{
a[i][i]=1;
i++;
}
(6 marks)
9 (c) Write quadruple and triple for the expression.
-(a*b)+(c+d)-(a+b+c+d)
(6 marks)