In the Supreme Court’s case relied upon by both the Advocates it has been held as under :–
“The adversary system of trial being what it is there is an unfortunate tendency for a Judge presiding over a trial to assume the role of a referee or an umpire and to all the trial to develop into a contest between the prosecution and the defence with the inevitable distortions flowing from combative and competitive elements entering the trial procedure.
“We may go further than Lord Denning and say that it is the duty of a Judge to discover the truth and for that purpose he may “ask any question, in any form, at any time, of any witness, or of the parties, about any fact, relevant or irrelevant” (section 165, Evidence Act). But this he must do, without unduly trespassing upon the functions of the public prosecutor and the defence Counsel, without any hint of partisanship and without appearing to frighten or bully witnesses. He must take the prosecution and the defence with him. The Court, the prosecution and the defence must work as a team whose goal is justice, a team whose caption is the Judge. The Judge, like the conductor of a choir, must, by force of personality, induce his team to work in harmony: subdue the raucous, encourage the timid, conspire with the young, fatter the old.”
“The questions put by the learned Sessions Judge, particularly the threats held out to the witnesses that if they changed their statements they would involve themselves in prosecutions for perjury were certainly intimidating, coming as they did from the presiding Judge. The learned Sessions Judge appeared to have become irate that the witnesses were not sticking to the statements made by them under sections 161 and 164 and were probably giving false evidence before him.In an effort to compel them to speak what he thought must be the truth, the learned Sessions Judge, very wrongly, in our opinion firmly rebuked them and virtually threatened them with prosecutions for perjury. He left his seat and entered the ring, we may say. The principle of fair trial was abandoned. We find it impossible to justify the attitude adopted by the Sessions Judge and we also find it impossible to accept any portion of the evidence of P.Ws. 8 and 9, the two alleged eye witnesses.”

It is true that u/s 165 of the Evidence Act ample powers have been given to the Court to have effective and proper control over the trial and Court can ask any question, in any form, at any time. This is an absolute power given to the Court. However, the power has to be used sparingly and only when the circumstances justify its use.
From the manner in which the witness is examined by the Court it does not appear that it was necessary for the Court to put so many questions to the witnesses particularly when cross examination was in progress.[Para No.9]
Bombay High Court
Ahmed Khan AliKhan Deshmukh
Vs.
State of Maharashtra
(1999) 1 MhLJ 401
(1999) 5 BCR 158