It's a tune with an odd history to it, and its background isn't very clear (various people seem to have been identified with it over the years, either as composer or performer), but it seems to have been popularized - if not actually written by - a man named Sol Bloom (he later became a U.S. Senator) in 1893. He claimed to have written it, or rather improvised it at the piano, to publicize "Little Egypt", a section of the Chicago "World's Columbian Exposition".
However, the distincitve opening notes (which is what we hear in the cartoon) apparently are the same as an earlier French song
Echos du Temps Passé, which itself may be be based on an Algerian folk tune, so perhaps Mr Bloom had heard either of those tunes, and then forgotten about it?
Possibly the best known name for it, as hummed by Sarcophagus, is
The Streets of Cairo, in a version by James Thornton.
Read about the music's strange and interesting history more fully (actually it's about as complete as can be, and is an obvious labour of love)
here at Shira.net, which is where most of the above is sourced (I knew the name was something to do with Egypt and Cairo, but had to track down the details).
Anyway, while I am sure it is the theme of Egypt which is being evoked, because he never gets very far into the tune, it could be the earlier versions which the Professor is humming...
It's often used as a short-hand musical message in a piece to evoke Egypt, especially in comedy or light-hearted situations in TV and film, etc.
In the U.K. it has an association with a music-hall/ variety/ vaudeville act named Wilson, Keppel and Betty, who (although actually from America) were huge stars in Britain for nearly five decades, and who performed a novelty soft-shoe dance routine called
Cleopatra's Nightmare, but often refered to as
The Egyptian Sand-Dance (or even more simply as just
The Sand-Dance).
The music they danced to was in a large part
Ballet Égyptien, by composer Alexandre Clément Léon Joseph Luigini, but as arranged for the act often also incorporated the opening to a piece called
In a Persian Market by Albert William Ketelbey (1875-1959), and the refrain of
The Streets of Cairo - basically anything to sound exotic and Middle Eastern.
One of the features of the routine was that the dancing was largely done by the men (Wilson and Keppel) while the lady Betty looked on.
They made a great show of strewing dry sand on the stage from an urn, and then dancing a soft-shoe shuffle on it, while adopting outrageous postures based on Egyptian wall art, all the while keeping completely straight expressionless faces. The sand made a very distinctive sound beneath their dancing feet.
The men, who were both tall and very thin, wore identical costumes - usually something outlandish, like a version of an Ancient Egyptian
shendyt (a sort of loin-cloth), with an inappropriate Arabian head-dress, or an Egyptian tunic and Turkish fez, combined with Western shoes and spats or black socks - and made up their face to look the same including large moustaches; they then danced in an eccentric style, often doing identical movements - and never revealing in their expressions that they thought any of this peculiar - all in all very much like I imagine Thompson and Thomson would behave...