Are there many fewer rational numbers than reals? Today my professor asked me to figure out the probability of getting a rational number from $[0,1]$.
His answer was that the probability is $0$.
Why is this?
 A: Intuitively, think that the rational numbers have a periodic decimal representation. If you draw a number digit by digit, what are your chances to make a periodic drawing compared to a completely random one ?
A: There are only countably many rational numbers in $[0,1]$, while the set of irrational numbers in $[0,1]$ is uncountable.
A: The probability that we choose a rational number should clearly equal the probability of choosing an $x$ such that $x+\sqrt{2}$ is rational - shifting the rationals by a constant certainly shouldn't affect probability. So, if the probability of picking a rational is $p$, then the probability of picking an $x$ such that either $x$ or $x+\sqrt{2}$ is rational must be $2p$, as those two events are disjoint. This means $2p\leq 1$, as every probability is less than $1$. So $p\leq \frac{1}2$.
However, this gives us trouble: the probability that $x+n\sqrt{2}$ is rational (for integer $n$) is also $p$. So, the probability that one of the following:
$$x,x+\sqrt{2},x+2\sqrt{n},\ldots,x+(n-1)\sqrt{2}$$
is rational must be $np$, as no two of those can be rational simultaneously (but, individually, would each be rational with probability $p$). So, we get that $np\leq 1$ any any $n$. Thus $p\leq \frac{1}n$ for all $n$ - which implies that $p$ must be $0$, as this is not true of any positive number.
A: The probability measure in your problem is just a special type of measure. Any concrete single number has probability zero because as a set, it is a set of zero measure. Measure of all rationals in $[0,1]$ is also $0$ (see this question for explanation), and so the probability of getting rational number is $0$.
A: At risk of over-complicating things, if you dig a little deeper you'll find that your professor defines "uniform distribution" to mean that for any subset $S$ of $[0,1]$, the so-called "probability of drawing a number in $S$" is the Lebesgue measure of the set $S$.
If you don't know the real definition, you can think of the Lebesgue measure of $S$ as being the area under the graph of the characteristic function of $S$, that is to say the function that takes value $1$ for elements in $S$ and $0$ elsewhere. It might be that your professor would state his definition in terms of lengths or integrals rather than Lebesgue measure as such, but it will amount to the same thing.
Now, it turns out that that rational numbers are countable, and that the Lebesgue measure of any countable set in the real numbers is $0$. Hence, the probability is $0$ directly from the way he defined his distribution in the first place.
You need a certain amount of mechanism to define Lebesgue measure formally and show that the measure of any countable set is $0$, but the general idea is as follows. Consider a countable sequence of points $a_i$. For any given small number $\epsilon > 0$, we can put an interval of size $\frac{\epsilon}{2}$ around the first point $a_1$, an interval of size $\frac{\epsilon}{4}$ around $a_2$, and in general size $\frac{\epsilon}{2^i}$ around $a_i$. The intervals overlap, but the sum of the lengths of all of them is $\epsilon$, so the measure of their union is no greater than $\epsilon$, which recall can be as small as we like. This means the set $\{a_i: i \in \mathbb{N}\}$ can be contained in as "short" a set of intervals as we like, which (once we make a suitable set of formal definitions) means it has measure $0$ and intuitively it means the set of rationals "has no length" in the reals, and occurs with probability $0$. The complement of the rationals, the set of irrational numbers, cannot be covered in arbitrarily small intervals this way, and doesn't have measure $0$ (in fact it has measure $1$, which is good news for people who want their probabilities to add up!)
There are plenty of probability distributions on $[0,1]$ that aren't continuous, and for which your professor's statement isn't true. I presume he means the continuous uniform distribution because that's always the distribution people mean when they don't bother to state it, but the property does hold for any continuous distribution, so he's not out of order to leave off the details.
A: All of the answers here presume that your [0, 1] denotes a subset of the Real Numbers, but you said,

Well, this lesson is called "Introduction to Computers"

Computers do not use Real Numbers.  If [0, 1] denotes the set of numbers that could be returned by a random number generator (procedure) in a computer program, then the probability of getting a rational result from it is 1.
Every floating-point number is rational.
