In the everyday vernacular, an apple is a fruit and a cucumber is a vegetable. Fruits are perceived as sweet and juicy and usually grown on trees. Vegetables are savory, served alongside meat and potatoes, and grown on plants on a farm or in a garden. These definitions are oriented to the culinary uses of such foods but have little to do with the botanical or scientific definitions of fruit and vegetable.
A fruit is the fleshy part of a plant that contains a seed or seeds. It is the result of fertilization and is, usually, edible. A cucumber has seeds that are surrounded by flesh. The cucumber, then, is a fruit. Sweet peppers are fruit as the pepper, when sliced open, reveals its cache of seeds.
A vegetable is the edible part of a plant such as the stalk or stem, leaves and root. Lettuce and potatoes are vegetables, as are turnips, beets and cauliflower.
Many fruits, such as cucumbers, squash and eggplant, are savory. Many fruits require cooking or other form of transformative preparation to make them pleasing to the palate. Numerous vegetables are also savory, such as broccoli or carrots. This common characteristic has led to certain fruits being classified, in a culinary sense, as vegetables.
Another factor evident in the confusion over defining fruit and vegetable is the government's need to classify these two food groups. In 1883 the United States government declared the tomato a vegetable for purposes of levying tariffs on imports of the fruit. The law was challenged in 1893 in Nix vs Hedden, a Supreme Court case. In the decision it was declared that though such foods as cucumbers, squashes and peas were fruit by botanical standards, people perceived them to be vegetables and so they would continue to be treated as such by the law.
The tomato is actually a berry. Corn is a vegetable and a grain, but because the leaves of an ear of corn envelope the kernels, corn is also a fruit. Corn may be identified as a vegetable because if the edible part of a plant is its seed, it is a vegetable. It is a grain because that definition includes any cereal grass that produces harvestable seed. Corn is a grass and its kernels are seeds.
That the fruits of certain plants are incorrectly identified as vegetables is only pertinent in botanical terms and perhaps legal terms. In culinary terms, flavor outranks the scientific, and so the pepper and squash will continue to be brethren to the potato and cauliflower, and the tomato will remain the disenfranchised berry.