The asking of questions from a witness or accused or any other person in a trial, whether in civil court or criminal court, is governed by the Indian Evidence Act 1872. Chapter IX (sections 118 to 134) and Chapter X (sections 135 to 166) of this Act deals with the witnesses, their examination, cross examination etc.
Under Section 149, any question, which is not relevant to the case and which affect the credit of the witness by injuring his character, can not be asked from a witness unless the basis of allegation is well founded. Under Section 151, the court can prohibit asking of indecent and scandalous questions. Under Section 152, the court is bound to prohibit the advocate from asking any question which is intended to insult or annoy the witness or which is needlessly offensive.