Q:

Is there something omitted after だか in this sentence?

The following paragraph is from page 20 of 涼宮ハルヒの憂鬱:

　ところで今教室に涼宮ハルヒはいない。いたらこんな話も出来ないだろうが、たとえいたとしてもまったく気にしないような気もする。その涼宮ハルヒだが、四時間目が終わるとすぐ教室を出て行って五時間目が始まる直前にならないと戻ってこないのが常だ。弁当を持ってきた様子はないから食堂を利用しているんだろう。しかし昼飯に一時間もかけないだろうし、そういや授業の合間の休み時間にも必ずと言っていいほど教室にはいない奴で、いったいどこをうろついているんだか。 

My question is about the end of the last sentence, which I've put in bold.  It ends with だか, but as I understand it, the sentence-final particle か is ungrammatical after だ in standard Japanese.  Therefore, I was thinking that one of two possibilities must be true:

It is grammatical, but only in non-standard Japanese;
It's grammatical because it's not a sentence-final use of か; it's a different use of か.

For example, I know that だか appears in 何だか, and that's not ungrammatical because it's not a sentence-final use of か.  So, I thought perhaps the same thing might apply here.
But in order for it to be a non-sentence-final use of か, the sentence would have to continue, and so, I would have to conclude that the rest of the sentence here is omitted.  That's exactly what @Matt talks about in this comment:

There are utterances like どうだか ("I wonder!" -- expressing doubt) but I suppose they are better viewed as fragments of an implied larger whole (e.g. どうだか知らないけど) where か is functioning slightly differently.

Is that how I should interpret this sentence, as well?  I'm not sure what would follow, exactly, but perhaps I could use something like the ending Matt suggests:

いったいどこをうろついているんだか知らない。

Am I interpreting the sentence correctly?

A:

Yes, you're interpreting the sentence correctly. My understanding is that this is possible because there is the "question word" of どこ in there, which makes the か（知らない） reading possible.

