It is the opening inventory that appears on the trial balance as a debit balance, for reasons that are explained in my free lectures.
When preparing an extended trial balance we then put in the closing inventory for both the SOFP and the SOPL, and I am guessing that this is what the question you refer to is doing. However the extended trial balance is not examinable in Paper FA – it was removed from the syllabus many years ago.