ことか details
Examples
how very X!; what a lot of X! — a rhetorical exclamation, usually paired with なんと/どれだけ/何度 to intensify a degree or frequency already felt strongly
もう、何回注意したことか、いい加減にしてよ。
mou, nankai chuui shita koto ka, ii kagen ni shite yo.
Honestly, how many times have I warned you — quit it already! casual
何度同じことを言ったことか。
nando onaji koto o itta koto ka.
How many times have I said the same thing! neutral
一人であの山を登るのが、どんなに恐ろしかったことか。
hitori de ano yama o noboru no ga, donna ni osoroshikatta koto ka.
Climbing that mountain alone — how terrifying it was! neutral
若き日の苦労が、後にどれほど役に立ったことか。
wakaki hi no kurou ga, nochi ni dorehodo yaku ni tatta koto ka.
How much the hardships of my youth would go on to help me in later life! formal
Formation
plain clause + ことかattaches to plain clause
Related patterns
Similar
Both can turn a witnessed fact into an exclamation, but ものだ's exclamatory reading most often takes a retrospective よく+た shape read as admiration for a deed (よくやったものだ) — though it also covers plain exasperation with no よく at all (困ったものだ) — while ことか takes any clause, usually with なんと/どれだけ/何度, and swings freely between joy, exasperation, and sorrow.
Lookalikes
Same こと, unrelated jobs — ことか closes a sentence as a rhetorical exclamation on the clause just stated (どれだけ嬉しかったことか), while ことに opens a sentence, fronting a feeling word to comment on the clause that follows (嬉しいことに、合格した) — one wraps a sentence up, the other winds one up.
Same こと + terminal particle, opposite jobs — ことだ hands down blunt advice ("the thing to do is X"), while ことか closes a rhetorical exclamation with no advisory force at all — 早く行くことだ tells you what to do, どんなに早く行きたかったことか only exclaims how much.