What should be the block's acceleration 'a' such that the rod present inside, inclined at at the angle 'theta' and mass 'm' will be obstructed from sliding down. From car's frame of reference, a pseudoforce 'ma' must indeed act opposite to the direction of acceleration to stop it from sliding, but my calculations are not bringing the actual answer according to my book(a=gcot(theta)). The given picture is about what I tried with all the forces acting.
You've basically drawn the diagram right; for a steady-state the net force must be 0 and hence $|\vec N_2| = m~g$ and $|\vec N_1| = m~|\vec a|.$ The remaining relation is a torque balance, because it's also in a steady-state rotationally. Let's take the torques around the point that $\theta$ is being measured around; then $\vec N_2$ and $m \vec a$ provide no torque and it's all about $\vec N_1$ contributing a torque $|\vec N_1| \sin\theta$ and the gravitational force contributing a torque $-m g \cos\theta$.