wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Consider the following 'C' expression.
x = (a+b)*(a+b+c)*a+b
How many temporary variables (in minimum) are required to generate the equivalent 3-address code for the above expression?

A
4
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
3
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
1
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
2
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D 2
x = (a+b)* (a+b+c)*a+b

3- Address code
t1=a+b
t2=t1+c
t2=t1* t2
t2=t2* a
x=t2 + b
Only 2 temperory variables are needed.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Contributions to Mathematics
HISTORY
Watch in App
Join BYJU'S Learning Program
CrossIcon