The 747 is the only aircraft with an upper deck over the front section only.
Only one version of the 747 has winglets (the -400 series, produced from 1989 to 2008) while all A340s have them.
The 747 was available from the factory in a freighter version as well as passenger-to-freighter conversions while the A340 was not. A 747 freighter will have 3 windows on the upper deck for the crew rest seats. There are no windows on the main deck of a factory-built 747 freighter while the converted ones will still have outlines where the windows were and they were plugged.
There are some differences that can distinguish a current version, the 747-8, from the older 747-400. The 747-8 is 19 feet longer and it does not have winglets but rather a curved wingtip similar to the Boeing 787. In addition, the 747-8’s engine housings have sawtooth shapes called chevrons on the trailing edge; they’re the same engines found on the 787. The 747-8 can be seen in both freighter and passenger configurations.
There are 4 versions of the A340 and the only difference visually is length. All A340s will have 4 exit doors per side but the A340-600 adds an emergency exit over the wing on each side. The A340-600 (shown here) was the longest airliner in production until the 747-8 was introduced.