S is the starting variable. Two conditions to be checked:
i. A,B,C and D all 4 are rechable from start variable
ii But, A,B, and C only can generate terminal(s)
Hence D is useless, though it's rechable from S but can't generate any terminal, furthermore, it doesn't have any production in given grammar.