Q:

Non linear device with two frequencies

I got this on an interview question and I still don't know the answer.

What output will have a nonlinear device if we will give two random frequencies \$f_1\$ and \$f_2\$?

I answered that it will have two carriers but I really unsure about my answer.

A:

The correct answer is that you don't know without more information about this non-linear device.  Non-linear only rules out linear, but can otherwise mean anything else, including putting out a fixed signal regardless of the inputs.
To show that you understand the concept, you should explain that a linear device can produce at most only the frequencies put into it.  It can change the amplitude and phase angle of the input frequencies, but it can't create new ones.  It could, for example, attenuate either or both frequencies well past the noise floor, so even for a linear device, the answer is none, one, or both of the input frequencies.
What they were probably after with this question is for you to say that the non-linear device can produce additional frequencies beyond those you put in.  If the non-linear device happens to include a product term, as Leon is apparently assuming, then you will get the sum and difference of the two frequencies included in the output.

A:

In general, you will get:

the two original frequencies f1,f2
The sum and difference of the two frequencies f1 + f2, f1 - f2 (aka intermodulation products)
The harmonics of each of the two frequencies (f1*2, f1*3, f1*n, f2*2, f2*3, f2*n, ...)
Harmonics of the intermodulation products
Intermodulation products between any of the above and any other component

TL/DR : a mess.
In practice while you can get all of these, the amplitudes of many of them may be negligibly low or actually zero, depending on the form of the nonlinearity.
One special case is a perfect multiplier or balanced mixer with one carrier on each input. This produces the sum and difference on the output, and nothing else. 
Another special case is a device with a square law or quadratic transfer function (vacuum tube triodes and some FET amplifiers can approximate this) - you will get the original frequencies, the sum and difference, and almost purely second harmonics only. Makes for a good guitar amp or an overpriced "audiophile" hi-fi system...
And so on.

A:

Do you understand what happens when you put a single frequency into a nonlinear device?
In general, putting any single frequency into a nonlinear device will produce harmonic distortion, which means that you'll see additional frequency components at the output that are integer multiplies of the input frequency.
If you put two frequencies into the nonlinear device, you'll not only get harmonic distortion on each of those frequencies, but you will also get intermodulation distortion, which means you'll also see energy at frequencies that are the sums and differences between all of the possible combinations of the two original frequencies and their harmonics.
In RF circuits, the latter effect is sometimes used deliberately (in conjuction with bandpass filters) to translate signals from one frequency band to another.

