For your second example, it would be possible to do that using a multi-part (sometimes referred to as a "compound") problem. This is an advanced technique that will not be covered in detail in this workshop. The tools for doing this are still actively being developed.
One option that doesn't require multi-part problems would be to allow the student to enter the array in a single large rectangle either using the MathObject matrix notation (brackets around comma-separated entries for the rows, with rows separated by commas and enclosed in brackets), or as an array of numbers separated by spaces and newlines that you turn into an array by hand within a custom answer checker. The latter would require a little extra work, but is probably preferable.
Here's one version that might do what you need:
loadMacros("contextArbitraryString.pl"); Context("ArbitraryString"); $A = Matrix([1,2,3],[4,5,6]); Context()->texStrings; BEGIN_TEXT \($A\) = \(\Bigg[\) \{ans_box(4,12)\} \(\Biggr]\) END_TEXT Context()->normalStrings; ANS(Compute("1 2 3~~n4 5 6")->cmp(checker => sub { my ($correct,$student,$ans) = @_; my $M = $student->value; $M =~ s/ +/ /g; # remove multiple spaces $M =~ s/(~~n|^) /~~1/g; $M =~ s/ (~~n|$)/~~1/g; # remove leading and trailing spaces $M =~ s/~~n~~n+/~~n/g; # remove blank lines $M =~ s/^~~n+//; $M =~ s/~~n+$//; # remove leading and trailing blank lines my @M = map {[split(/ /,$_)]} split(/~~n/,$M); # break into an array of arrays $M = Matrix(@M); # form MathObject matrix $ans->{preview_latex_string} = $M->TeX; # format the answer preview $ans->{correct_ans_latex_string} = $A->TeX; # format the correct answer return $A == $M; # check the answers }));You can paste this into the Interactive Problem Lab to see how it works (or insert it into a problem file ad add the problem to a set). The main idea is that you get the student's answer as a string and then manipulate that string to form a MathObject Matrix. That will already perform some error checking (like that the rows are the same length and that the entries are numbers).
In any case, this is a starting point for that type of answer.