In these cases,
you should just walk through the program, and keep track of what each array element is after each statement. In short, something like this:
Initially, x == 0 and hq = {null, null, null, null, null}
x == 0, loop body is executed; hq[x] is initialized: hq == {0, null, null, null, null}; x is increased to 1
x == 1, loop body is executed; hq[x] is initialized: hq == {0, 1, null, null, null}; x is increased to 2
etc