Section 25. When such child is taken into custody upon said precept and brought before said court, the court may then hear said petition, or said petition may be continued to a time fixed for hearing, and the court may allow the child to be placed in the care of some suitable person or licensed agency providing foster care for children or the child may be committed to the custody of the department, pending a hearing on said petition.
If the court commits a child to the custody of the department, the court shall consider the provisions of section 29C and shall make the written certification and determinations required by said section 29C.