A response variable $Y$ in terms of two predictors $X$ and $Z$. There are $n$ observations. Let $X$ be a matrix formed by a constant term of $1$, and the vectors $x$ and $z$. Consider the cross-product matrix $X^TX$ given below:
$$\begin{bmatrix}30 & 0 & 0\\\ ?&10&7 \\\ ? & ? &15\end{bmatrix}$$
What are the missing values denoted by “?”, determine the value of $n$ and calculate the linear correlation coefficient between $X$ and $Z$.
The question isn't written 100% clearly, so I'm going to assume for now that the matrix $X$ is an $n \times 3$ matrix that looks like this
\begin{bmatrix} 1 & x_1 & z_1 \\ \vdots & \vdots & \vdots \\ 1 & x_n & z_n \end{bmatrix}
Then \begin{align} X'X &= \begin{bmatrix} 1 & \dots & 1 \\ x_1 & \dots & x_n \\ z_1 & \dots & z_n \end{bmatrix} \begin{bmatrix} 1 & x_1 & z_1 \\ \vdots & \vdots & \vdots \\ 1 & x_n & z_n \end{bmatrix} \\ &= \begin{bmatrix} \sum_{i=1}^n 1 & \sum_{i = 1}^n x_i & \sum_{i = 1}^n z_i \\ \sum_{i = 1}^n x_i & \sum_{i = 1}^n x_i^2 & \sum_{i = 1}^n x_iz_i \\ \sum_{i = 1}^n z_i & \sum_{i = 1}^n x_iz_i & \sum_{i = 1}^n z_i^2 \end{bmatrix} \end{align}
So we know $n$ from the $[1,1]$ entry of the matrix, which allows us to calculate $\bar{x}$ and $\bar{z}$. We can then use the other entries in the matrix to calculate the correlation coefficient (https://en.wikipedia.org/wiki/Correlation_and_dependence)
Little linear algebra trick, $X^TX$ is symmetric, so even without doing any math you can figure out what all the "?" are