You can make one of the task’s arguments an output:
task my_task(output array_type q);
...
q = {1,0,1,1};
...
endtask
The will copy the array upon existing the task.
If the task is going to update the queue before some delay, and another process needs to see the queue before the task returns, then you can use a ref argument.
task my_task(ref array_type q);
...
q = {1,0,1,1};
...
endtask