Interview question on constraint

In reply to VC_45:

Probably, this should meet the query…
program tb;
class cls;
rand bit [3:0] arr[10], indx1, indx2;
constraint cons{
foreach(arr[i])
foreach(arr[j])

Please use code tags.