Use of の vs か in questions


i’ve seen japanese speakers switch between both の and か in the same
conversation or situation. are there certain phrases where it’s better to use
one or the other? for example is の better to use with だ and か better with です?
what are the guidelines for choosing which to use?

