Definite: الْقَاضِي (nom.), الْقَاضِيَ (acc.), الْقَاضِي (gen.).
Indefinite: قَاضٍ (nom.), قَاضِيًا (acc.), قَاضٍ (gen.).
Source distinction: The definite forms are the book’s examples; the indefinite forms are added teaching material. Grammatical position determines the case in each sentence.