Technically, you can't even compare the two because fruit is a biological category and vegetable is a culinary one. Tomatoes are fruit AND vegetable at the same time. To put it simply, a fruit is the thing a plant produces out of its flowers to spread its seeds, like apples, pears, all the berries, and also tomatoes and peppers and the like. A carrot on the other hand is the root of its plant. Other vegetables might be the leaves of the plant, like spinach and other salads, or the bulb, like onion or garlic, etc. The culinary categories differentiate more by what things go together, for example by sugar content. This is why a banana is not a vegetable, for example, but the lines between categories aren't as clear as in biology.