in DS edited by
1,933 views
0 votes
0 votes

The expression $5-2-3*5 – 2$ will evaluate to $18$, if :

  1. $‘ – ‘$ is left associative and $‘*‘$ has precedence over $‘ – ‘$
  2. $‘ – ‘$ is  right  associative and $‘*‘$ has precedence over $‘ – ‘$
  3. $‘ – ‘$ is  right  associative and $‘ – ‘$ has precedence over $‘*‘$
  4. $‘ – ‘$ is  left  associative and $‘ – ‘$ has precedence over $‘*‘$
in DS edited by
by
1.9k views

10 Comments

The expression 5 -2 - 3 * 5 - 2 will evaluate to 18, if

A.

- is left associative and * has precedence over -

B.

- is rightt associative and * has precedence over -

C.

- is right associative and - has precedence over *

D.

- is left associative and - has precedence over *

error in question this is actual question

1
1
Then answer is C ?
1
1

@MiNiPanda   yes 

1
1
Someone write the expression with braces pls
0
0
As claimed by Sumit, the question is misprinted..according to the image shared by him..For C ..
(5-(2-3))*(5-2) =18
3
3
it's clearly C.
2
2
if - is right associative and - has precedence over * our expression will be evaluated as

5-2-3*5-2= 5-2-3*(5-2) = 5-2-3*3 = 5-(-1)*3 = 6*3=18. so i think C is correct option.
0
0
thx
0
0
0
0

https://gateoverflow.in/253202/explain

 

 

 

correct answer is C

0
0

2 Answers

0 votes
0 votes
Option A is correct.

1 comment

Need step by step solution to that.
0
0
0 votes
0 votes

.                             Answer is c

reshown by
Answer:

Related questions