Question words normally do not change in German. Two important exceptions are wer ‘who’ and welcher ‘which’, ‘what’ as their endings can vary.
wer requires case endings
The question words wer ‘who’ is used when referring to people. It has different forms relating to the four cases and their grammatical functions:
Nom. wer who
Acc. wen who(m)
Dat. wem who(m)
Gen. wessen whose
Here are some examples:
Wer hat das gemalt?
Who painted that?
Wen triffst du später?
Who(m) are you meeting later on?
Mit wem gehst du in die Oper?
Who are you going to the opera with?
Wessen Auto ist das?
Whose car is that?
Note that in contemporary German, the genitive form wessen is often replaced by a structure using the dative: Wessen Auto ist das? → Wem gehört das Auto?
welcher and its case endings
The question word welcher ‘which’, ‘what’ usually appears directly in front of a noun and must agree with the gender, case and number of that noun. Here are all forms in the nominative, accusative and dative. Note that welcher does not exist in the genitive case.
Welcher Schauspieler gefällt dir? (nom., masc.)
Which actor do you like?
Welchen Saft möchten Sie? (acc., masc.)
Which/what juice would you like?
Bei welchem Friseur warst du? (dat., masc.)
Which hairdresser did you go to?