As the truck move to the right, so the bob will move to the left due to inertia of rest with acceleration a. Thus, the given situation can be drawn as 
From the above diagram (b) as the string moves by an angle of θ with the vertical then the tangent angle is tanθ=mgma⇒θ=tan−1(ga)