SP Question Bank
SP Question Bank
SP Question Bank
PART-1
PART-2
PART-3
9 Consider following assembly program. Show (i) Contents of Symbol Table (ii) 07
intermediate codes using Variant I representation (iii) corresponding machine codes
START 100
READ A
READ B
READ C
MOVER AREG, A
ADD AREG, B
ADD AREG, C
MULT AREG, C
MOVEM AREG, RESULT
PRINT RESULT
STOP
A DS 1
B DS 1
C DS 1
RESULT DS 1
END
Instruction opcodes:
READ – 09, MOVER – 04, MOVEM – 05, ADD – 01, MULT – 03, PRINT – 10, STOP
– 00
Assembler-directive codes: START – 01, END - 02
Register code: AREG – 01
PART-4
1 Differentiate passes and phases of complier. Explain in brief syntax analysis phase
2 What is need and importance of intermediate code? Create quadruple and Triple for
following statement.
a= (a+b)*(c-d)
3 Consider the statement a=b+c*10.where a, b, c are of type float. Show the translation of the
given statement by different phases of compiler to produce assembly language statement .
4 What is code optimization? Explain with example various optimizing transformations.
5 Define static pointer. Find Register Requirement (RR) for the below given expression
f + ( x + y ) * ( ( a + b) / (c - d) )
6 Prepare Symbol Table & Quadruple Table using Value Numbers method
Stmt No Statement
5 A = 29.3 * D
17 B=24.5
31 C=A*B +W
49 X=A*B + Y
7 Given following expression = - (a+b) *(c+d) + (a+b+c)
1. Draw a Syntax tree for the expression
2. Write a three-address code for the expression
3. Give triple representation for the three address code of the expression
8 Perform lexical, syntax and semantic analysis on below C statement
a=b+c*d*100+e/f
Where data type of b, c & e are integers and remaining all variables are float
9 Explain operand and register descriptor with example. Also give best evaluation order for
arithmetic expression: a+b*c+d*e^f
PART-5