Both are sections under The Code Of Criminal Procedure, 1973. This law was made to govern the examination of criminals or accused one before presenting them before the court. The investigating officers and magistrate police conduct an examination and questioning procedure to collect facts and information about the case on which they are brought in.
161. Examination of witnesses by police.
(1) Any police officer making an investigation under this Chapter, or any police officer not below such rank as the State Government may, by general or special order, prescribe in this behalf, acting on the requisition of such officer, may examine orally any person supposed to be acquainted with the facts and circumstances of the case.
(2) Such person shall be bound to answer honestly all questions relating to such case put to him by such officer, other than questions the answers to which would have a tendency to expose him to a criminal charge or a penalty or forfeiture.
(3) The police officer may reduce into writing any statement made to him in the course of an examination under this section, and if he does so, he shall make a separate and true record of the statement of each such person whose statement he records.
164. Examination of witnesses by Magistrate.
(1) Any Metropolitan Magistrate or Judicial Magistrate may, whether or not he has jurisdiction in the case, record any confession or statement made to him in the course of an investigation under this Chapter or under any other law for the time being in force, or at any time afterward before the commencement of the inquiry or trial: Provided that no confession shall be recorded by a police officer on whom any power of a Magistrate has been conferred under any law for the time being in force.
(2) The Magistrate shall, before recording any such confession, explain to the person making it that he is not bound to confess and that, if he does so, it may be used as evidence against him. The Magistrate shall not record any such confession unless, upon questioning the person making it, he has reason to believe that it is being made voluntarily.
(3) If at any time before the confession is recorded, the person appearing before the Magistrate states that he is not willing to make the confession, the Magistrate shall not authorize the detention of such person in police custody.