"How does the height of an object affect the amount of mechanical energy it contains?"
The height of an object is crucial to the amount of energy something has because the higher up it is the most potential energy it has and kinetic energy it could have.
For example, if the height of a basketball was just a couple inches off the ground, it would not have a large amount of potential energy because because there is not much of a fall between the ball and the ground. However, if the ball was higher, there would be more potential energy because there is more room to fall.
---
"What is the test variable?"
The test variable, or independent variable in this case would be the height, as the scientist is changing the height in order to get different results in the total mechanical energy, which would be the dependent variable.