StreakPeaked· Practice

ExamsGATETechnical

Consider the following function double f(double x) { if( abs(x*x - 3) < 0.01) return x; else return f(x/2 + 1.5/x); } Give a value q (to 2 decimals) such that f(q) will return q.

  1. 1.73
  2. 1.74
  3. 1.75
  4. 1.76

Correct answer: 1.73

Solution

The function is designed to find a value of x such that the square of x is approximately equal to 3, which corresponds to the square root of 3. The value 1.73 is the closest approximation to the square root of 3 (approximately 1.732), making it the correct choice.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →