Qué and cuál are interrogatory pronouns, and are thus used when asking questions (see relevant question):
¿Qué ha ocurrido? → What has happened?
¿Cuál es tu número de teléfono? → What is your phone number?
Qué can also be an exclamative adjective (if it is used before a noun):
¿Qué hora es? → What time is it?
Qué can also be an exclamative adverb (if it is used before an adjective):
¡Qué guapa es! → How pretty she is!
Qué can also be used in exclamations (not only in questions). So qué (with accent mark) can be used in direct or indirect questions and exclamations:
¿Qué has hecho? → What have you done?(direct question)
No sé qué hacer. → I don't know what to do. (indirect question)
¡Qué guapa es! → How pretty she is! (direct exclamation)
Ya sabe qué dura es la vida. → He already knows how hard life is. (indirect exclamation)
Without accents, they are relative pronouns:
Rebeca es la mujer con la que vas a viajar. → Rebeca is the woman with whom you are going to travel.
Rebeca es la mujer con la cual vas a viajar → Rebeca is the woman with whom you are going to travel.
Que (without the accent) can also be a conjunction:
Quiero que vengas. → I want that you go. / I want you to go.
Llámame antes de que llegues. → Call me before you arrive.