The GATE Grind

GATE 2017 CS (CS1) – Question 8

General Aptitude · Quantitative Aptitude: Algebra, Geometry and Mensuration · 2 marks · Multiple choice

The expression $\dfrac{(x + y) - |x - y|}{2}$ is equal to

  1. the maximum of $x$ and $y$
  2. the minimum of $x$ and $y$
  3. 1
  4. none of the above

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) the minimum of $x$ and $y$

Explanation

Separate the two cases that determine the absolute value.

If x≥y, then |x−y|=x−y and the expression becomes $(x+y-x+y)/2=y$. If x<y, then |x−y|=y−x and it becomes $(x+y-y+x)/2=x$.

In each case it returns the smaller input; at x=y it returns their common value. Therefore the expression is **min(x,y), B**, for all real x,y.

More Quantitative Aptitude: Algebra, Geometry and Mensuration questions

All Quantitative Aptitude: Algebra, Geometry and Mensuration questions →