Sapient Company Programming

What will be the output of the following code?

public void onSensorChanged(SensorEvent event){
final float alpha = 0.8;
}

gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];
linear_acceleration[0] = event.values[0] - gravity[0];
linear_acceleration[1] = event.values[1] - gravity[1];
line

1) Runs successfully
2) Compile time error
3) Runtime error
4) None of the above

Read Solution (Total 0)

Sapient Other Question

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,0,locationListener)
In this line of code, what is the use of the second and third parameter?

1) These are used to control the frequency at which the listener receives updates.
2) These are used to specify the number of location providers.
3) Both of the above
4) None of the above
What will be the output of the following code?
category android:name = "android.intent.category.DEFAULT"/>

1) compile time error
2) runtime error
3) runs successfully
4) none of the above