In a table consisting of $n$ by $n$ small squares some squares are coloured black and the other squares are coloured white. For each pair of columns and each pair of rows the four squares on the intersections of these rows and columns must not all be of the same colour.
What is the largest possible value of $n$?
1. **Initial Observation**: We need to find the largest possible value of \( n \) such that in an \( n \times n \) grid, for each pair of columns and each pair of rows, the four squares at the intersections of these rows and columns are not all of the same color.

2. **Construction for \( n = 4 \)**: 
   - Consider a \( 4 \times 4 \) grid. We can construct a valid coloring where no four squares at the intersections of any two rows and any two columns are all the same color. One possible construction is:
     \[
     \begin{array}{|c|c|c|c|}
     \hline
     W & B & W & B \\
     \hline
     B & W & B & W \\
     \hline
     W & B & W & B \\
     \hline
     B & W & B & W \\
     \hline
     \end{array}
     \]
   - In this construction, for any pair of rows and any pair of columns, the four intersections will always contain two white and two black squares.

3. **Proof that \( n = 5 \) does not work**:
   - Assume \( n = 5 \). We need to show that it is impossible to color a \( 5 \times 5 \) grid such that no four intersections of any two rows and any two columns are all the same color.
   - Consider the first row. By the pigeonhole principle, at least three of the cells in the first row must be the same color. Without loss of generality, assume these three cells are white.
   - Now, consider the remaining four rows. To avoid forming a rectangle with the three white cells in the first row, each of these rows can have at most one white cell in the columns corresponding to the three white cells in the first row.
   - Therefore, each of the remaining four rows must have at least two black cells in the columns corresponding to the three white cells in the first row.
   - If any of these four rows has no white cells in the columns corresponding to the three white cells in the first row, it will have only black cells, and the other rows will be forced to form rectangles with this row or the first row.
   - Thus, each of the remaining four rows must have exactly one white cell in the columns corresponding to the three white cells in the first row.
   - By the pigeonhole principle, there must be at least one column among the three columns with white cells in the first row that contains at least two white cells from the remaining four rows.
   - These two white cells, along with the white cell in the first row, will form a rectangle with the black cells in the other two rows, violating the condition.
   - Therefore, it is impossible to color a \( 5 \times 5 \) grid to satisfy the given condition.

\(\blacksquare\)

The final answer is \( \boxed{ n = 4 } \)