edited by
30,268 views

2 Answers

Best answer
5 votes
5 votes

3 address code

t1 = a + b

t= c + d

t= t* t2

t4= a + b

t= t+ c

t= t- t5

Quadruples 

  Operation op1 op2 Result
1 + a b t1
2 + c d t2
3 * t1 t2 t3
4 + a b t4
5 + t4 c t5
6 - t3 t5 t6

Triple

  Operation op1 op2
1 + a b
2 + c d
3 * (2) (3)
4 + a b
5 + (4) c
6 - (3) (5)

Indirect Triple

1.(1)

2.(2)

3.(3)

4.(4)

5.(5)

6.(6)

selected by
0 votes
0 votes
Quadruples:

(a, +, b, t1) (c, +, d, t2) (t1, *, t2, t3) (a, +, b, t4) (t4, +, c, t5) (t3, -, t5, result)

Triples:

(a, +, b, t1) (c, +, d, t2) (t1, *, t2, result)

Indirect Triples:

(a, +, b, t1) (c, +, d, t2) (t1, *, t2, t3) (a, +, b, t1) (t1, +, c, t5) (t3, -, t5, result)

In Quadruples, we have a left and right operand and operation and a temporary variable to store the value. In Triples, we have the same but without temporary variable, the result is stored in the same place as one of the operand. Indirect Triples are similar to Triples but with an extra line of code where we use the temporary variable of Quadruples as one of the operand in the expression.

Related questions

0 votes
0 votes
0 answers
1
1 votes
1 votes
0 answers
3
TusharKumar asked Dec 23, 2022
577 views
The correct answer given is 3.