Undefined behaviour is when a computer program does something that no one expected and it produces an unexpected result. This can happen when a computer program is given instructions that it doesn't know how to handle. For example, if a computer program is told to divide something by zero, it will not know how to handle the instruction, so it might produce a result that no one expected.