when should I use ka as question marker and when should I use no ka?
In conversation especially this is important and really depends on who one is speaking to and how formal your speech is.
For example if asking someone where they went...
Asking someone of authority (using keigo) どこにいきになりましたか？one would use か at the end.
Asking someone you are mildly acquainted with どこにいきましたか? か would still be present
Asking your best friend you've known all your life どこにいった/どこにいったの？you don't have to use か here or you could also end with の.
When writing sentences, as not to cause confusion, please use か to make it obvious to the reader that a question has been asked, unless it has been made blatantly clear that casual speech is being used.