Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE CS 1997 | Question 34

  • Last Updated : 12 Oct, 2020

The expression (a*b)* c op……..

where ‘op’ is one of ‘+‘, ‘*‘ and ‘‘ (exponentiation) can be evaluated on a CPU with a single register without storing the value of (a * b) if
(A) ‘op’ is ‘+’ or ‘*’
(B) ‘op’ is ‘↑’ or ‘*’
(C) ‘op’ is ‘↑’ or ‘+’
(D) not possible to evaluate without storing


Answer: (A)

Explanation: Given expression is :-

(a*b)* c op  

Here op is one of the ‘+’, ‘*’ and ‘↑’ (exponentiation).

(a* b)* having high precedence so it will evaluate first in CPU register. But we have given one single register as we cannot store any value from reg to memory.

Now ( a * b ) is evaluated in register R and precedence order is ( ↑ , * or / , + or – ).



If we put op as (a*b)* c op ‘ ↑ ‘ then expression becomes as (a*b)* c ↑ d here c ↑ d will evaluate first. But we have not extra register to evaluate ( a * b ).
Therefore we cannot put any operator having precedence greater than ” * ”.

Hence, Operator is either ” + ” or “- ” .

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :