I was doing some questions on matrix transformations and texture mapping and I came across two questions for which I dont know how to get the answer. The answer is highlighted with red colour.
(These can be implemented in C++ but before I do it I just wanted to familiarize myself with transformations first)
For matrix transformation shouldnt it have -1 (top right of the matrix) for the translation instead of 0

EDIT: STILL NEED AN ANSWER TO THE SECOND QUESTION
My second query is that I am not sure how they got the y coordinate for point D

Answering the first question:
The resultant image is compressed into half along the x-axis and elongated to twice the length across Y-axis.
Scaling Matrix is what will be the answer. Scaling matrix is a diagonal matrix with elements
{X-scaling, Y-scaling, 1}.Now,
is a typical scaling matrix. It scales the x-axis by 0.5 (that is it stretches(compresses) the x-axis into half). This is noticeable in Matrix(1,1).
THe scaling across Y-direction is given in Matrix(2,2). The
2over there implies, the Y-axis is elongated 2 times.NOTE:
In this question there is no translation involved. Notice that simple scaling makes it seem like translation.