The rank of a matrix is equal to the number of non-zero rows in it's reduced row echelon form (RREF). The nullity is the number of rows of zeros in the RREF. So, for problem 1, the RREF is
[1 0][0,1]. So we see that the rank=2 and the nullity=0.
For problem 2, the RREF is
[1 2 -1][0 0 0]. So the rank is 1 and the nullity is 1 also.