const max_seq_size = 100
const max_itr_size = 10_000
var
s: seq[int]
for i in countup(1,max_itr_size):
s = newSeq[int](max_seq_size)
for j in countup(1, max_seq_size):
s[j-1] = j
s = newSeqUninitialized[int](max_seq_size)
echo s[max_seq_size - 1] # 100 (not initialized with zero, in the specifications)
s = newSeqOfCap[int](max_seq_size)
s.setLen(max_seq_size)
echo s[max_seq_size - 1] # 100 (not initialized with zero)
setLen only changes the length, it does not initialize with zero except in one case, when Nim needs to reallocate the seq because the reserved buffer was too small but AFAIK that's the OS that gives zero-ed out memory pages by default.
That can be seen with
s = newSeqOfCap[int](max_seq_size)
s.setLen(max_seq_size + 100000)
echo s[max_seq_size - 1]