How does the coil rotate? I came across this question in one of my tests. But I was unable to understand which way does the coil actually rotate ?

Any visualizations would be quite helpful. As per the given question I thought it rotates in an out of the plane of the screen about the upper side of the frame. But I am not so sure ?
 A: Since all calculations did by hft actually is right, we only proposed picture for this question how coil looks like from three different point.

A: You don't need to think of the whole loop all at once. Each of the four legs of the "loop" can be considered one at a time.
Also, the problem is in a sense two-dimensional, since the way it is specified the loop is fixed such that only torque about the x-axis matters. So if it is easier, you can just draw two-dimensional diagrams only showing y and z axis and just sort of forget about the x axis.
For each leg you have a magnetic force contribution to the torque and a gravitational contribution to the torque.
The leg running parallel to the x-axis with the current running in the negative x direction is fixed in place (it is the axis of rotation as specified in the problem). So take the origin at some (any) point on this leg. This leg thus does not contribute to the torque.
So now you only have to consider the other three legs (one running parallel to the x-axis with current in the positive x direction and and two not parallel to the x-axis).
The two legs that are not running parallel to the x-axis do not contribute any torque due to the magnetic force. This is because $\vec \tau = \vec r \times L(\vec I\times\vec B)$, but for these two legs $\vec I$ changes sign in the torque calculation, but $\vec r$ does not.
However, these two legs both contribute equally to the torque due to the gravitation force (gravity is in the $-\hat k$ direction for both--you should not have trouble calculating this torque).
Now there is just one last leg to consider: the leg running parallel to the x axis, with the current running parallel to the x axis. The torque due to gravity is again in the same direction as the last two legs (but of a different magnitude--you should not have trouble calculating it). I think the total torque due to gravity (all three legs) should come out to something like
$$
-\sqrt{2}Lmg\;,
$$
where the negative sign in my convention means it is causing it to fall back towards the ground.
The torque due to the magnetic field for the final leg we are considering is non-zero, but can be calculated straightforwardly (since effectively in the 2d world the $\vec r$ is constant--in the 3d world $\vec r$ isn't constant as you integrate along the leg, but this doesn't matter because the variable part doesn't contribute torque along x). I think it comes out to:
$$
+\frac{4IL^2}{\sqrt(2)}\;.
$$
In equilibrium these two contributions sum to zero, which allows you to solve for $I$ as:
$$
I = \frac{mg}{2L}\;.
$$
The units might look a little weird, but that is because B as specified in the problem is unitless.
I'm not positive that I worked out all the details correctly, but this is probably at least good enough to get you started and you can check the details as you solve the problem on your own.
A: torque = force*(cross)distance
since the ring is in equilibrium,
the tm(magnetic torque)=tg(gravitational torque).
tm=IA*(cross)B
=IABsin(u)
the angle u is the angle between the vector perpendicular to the ring and the magnetic field.
the vector A has an angle of value 90-45 with the verticle.
a unit vector parallel to it is (0,1/(2^0.5),1/(2^0.5))
and the unit vector from the magnetic field is (3/5,4/5,0)
getting the angle (u) between them by cos^-1(the dot product)=55.5 degrees
tg=mg0.5lsin(135)(since the center of gravity is at the center of the ring, the angle is 90+45 which is the angle between the end of the ring and gravity)
IABsin(u)=0.5lmgsin(135)
I=(lmgsin(135))/(2AB*sin(55.5)=1.68A
