“Harry!” Neville burst out, the moment he saw the other two. “I was
trying to find you to warn you, I heard Malfoy saying he was going to
catch you, he said you had a drag ––”
Harry shook his head violently to shut Neville up, but Professor McGonagall had seen. She looked more likely to breathe fire than
Norbert as she towered over the three of them.
“I would never have believed it of any of you. Mr. Filch says you were up in the astronomy tower. It’s one o’clock in the morning.
Explain yourselves.” (Harry Potter and the Sorcerer’s Stone)
What does ‘it’ mean?
Prof. McGonagall supplies specific referents in her next sentences: their being up in the astronomy tower and their being out of bed at one o’clock in the morning.
But really this it refers to the entire situation. What McGonagall finds unexpected is the students’ misconduct.