The Ten Commandments

Pharaoh Rameses I of Egypt has ordered the death of all the firstborn Hebrew male infants after hearing the prophecy of the Deliverer, but a Hebrew mother named Yoshebel saves her own infant son by setting him adrift in a basket on the Nile. Bithiah, the Pharaoh's daughter, who had recently lost both her husband and the hope of ever having children of her own, finds the basket and decides to adopt the boy even though her servant, Memnet, recognizes the child is Hebrew and protests. Because she drew the infant out of the water, Bithiah decides to name the baby Moses.
Many years later, Prince Moses grows up to become a successful general, winning a war with Ethiopia and then entering Egypt into an alliance with them. Moses loves Nefretiri, who is the throne princess and must be betrothed to the next Pharaoh. She reciprocates his love. While working on the building of a city for Pharaoh Sethi's jubilee, Moses meets the stonecutter Joshua, who tells him of the Hebrew God. An incident occurs when an elderly woman is almost crushed to death when her sash gets caught under the slab of stone, prompting Moses to scold overseer Baka. Moses frees the elderly woman, not realizing that she is his natural mother, Yoshebel.
Moses institutes numerous reforms concerning the treatment of the slaves on the project, and eventually Prince Rameses, Moses's "brother", charges him with planning an insurrection, pointing out that the slaves are calling him the "Deliverer". Moses defends himself against the charges, arguing that he is simply making his workers more productive by making them stronger and happier and proves his point with the impressive progress he is making. Rameses had earlier been charged by Sethi with finding out whether there really is a Hebrew fitting the description of the Deliverer.
Nefretiri learns from Memnet that Moses is the son of Hebrew slaves. Nefretiri kills Memnet but reveals the story to Moses only after he finds the piece of Levite cloth he was wrapped in as a baby, which Memnet had kept. Moses goes to Bithiah to learn the truth. Bithiah evades his questions, but Moses follows her to the home of Yoshebel and thus learns the truth, while also meeting his true brother, Aaron, and sister, Miriam.
Although Moses feels no real change from this revelation, he spends time working amongst the slaves to learn more of their lives. Nefretiri urges him to return to the palace so he may help his people when he becomes pharaoh, to which he agrees after he completes a final task. The master builder Baka steals Lilia, who is engaged to the stonecutter Joshua. Joshua rescues Lilia by causing a commotion in Baka's stables. Joshua strikes Baka in the process and gets captured; he is then whipped by Baka for this insult. Moses strangles Baka and frees Joshua, confessing to Joshua that he too is Hebrew. The confession is witnessed by the ambitious Hebrew chief overseer Dathan. In exchange for his freedom, riches and Lilia, Dathan tells about this to Rameses, who then arrests Moses. Brought in chains before Sethi, Moses explains that he is not the Deliverer, but would free the slaves if he could. Bithiah tells her brother Sethi the truth about Moses, and Sethi reluctantly orders his name stricken from all records and monuments, and Rameses is declared the next Pharaoh. Rameses, well aware of his father's (and Nefretiri's ) devotion to Moses, decides not to execute him and make a martyr out of him. Instead he banishes Moses to the desert, where Nefretiri will never know if he survives, or perhaps finds another love. He also tells Moses that Yoshebel had died after delivering a robe of Levite cloth for Moses.
Moses makes his way across the desert, nearly dying of hunger and thirst before he comes to a well in the land of Midian. At the well, he defends seven sisters from Amalekites who try to push them away from the water. Moses finds a home in Midian with the girls' father Jethro, a Bedouin sheik, who reveals that he is a follower of "He who has no name", whom Moses recognizes as the God of Abraham. Moses impresses Jethro and the other sheiks with his wise and just trading, and marries Jethro's eldest daughter Sephora.
While herding sheep in the desert Moses finds Joshua, who has escaped from the copper mines of Ezion-Geber that he was sent to after the death of Baka. Moses sees the burning bush on the summit of Mount Sinai and hears the voice of God. God charges Moses to return to Egypt and free His chosen people. In the meantime, in Egypt, Sethi dies, his last word being Moses's name. Before he dies, he hands over the reins to his son Ramseses, who becomes Rameses II.
At Pharaoh's court, Moses comes before Rameses to win the slaves' freedom, turning his staff into a cobra. Jannes does the same with his staves, but Moses's snake devours his. Rameses decrees that the Hebrews be given no straw to make their bricks, but to make the same tally as before on pain of death. As the Hebrews prepare to stone Moses in anger, Nefretiri's retinue rescues him. He spurns her when she attempts to renew her relationship with him by saying that he is on a mission and is also married.
As Moses continues to challenge Pharaoh's hold over his people, Egypt is beset by divine plagues. Moses turns the river Nile to blood at a festival of Khnum and brings burning hail down upon Pharaoh's palace. Moses warns him the next plague to fall upon Egypt will be summoned by Pharaoh himself. Enraged at the plagues and Moses' continuous demands, as well as his generals and advisers telling him to give in, Rameses orders all first-born Hebrews to die. Nefretiri warns Sephora to escape with her son Gershom on a passing caravan to Midian, and Moses tells the Queen that it is her own son who will die. In an eerily quiet scene, the Angel of Death creeps into Egyptian streets in a glowing green mist, killing all the firstborn of Egypt, including the adult son of Pharaoh's top general, and Pharaoh's own child. The Hebrews who have marked their doorposts and lintels with lamb's blood are eating a hasty meal and preparing to depart. Bithiah reunites with Moses and decides to go with him and his people when they leave. Broken and despondent, Pharaoh orders Moses to leave with the Hebrews. In the following day, the Hebrews, now homeless and uprooted, begin their exodus from Egypt with Dathan, reluctantly, also among them.
Rameses spends the next three days begging Seker to call life back into the body of his son. Nefretiri goads him into such a rage that he arms himself and gathers the elite Egyptian forces and pursues the former slaves to the shore of the Red Sea. When the people see the Egyptian troops heading for them, they beg Moses to save them. With God's help, he puts out a pillar of fire. Held back by this pillar, the Egyptian forces helplessly watch as Moses parts the waters. As the Hebrews race over the seabed, the pillar of fire then dies down and the army follows them in pursuit. The Hebrews make it to the far shore as the waters close on the Egyptian army, drowning every man and horse, except Rameses, who looks on in despair. All he can do is return to Nefretiri, confessing to her, "His god is God".
The former slaves camp at the foot of Sinai and wait as Moses again ascends the mountain with Joshua. During his absence, the Hebrews lose faith. Urged by Dathan, they build a golden calf as an idol to take back to Egypt, hoping to win Rameses' forgiveness. They force Aaron to help fashion the gold plating. The people indulge their most wanton desires in an orgy of sinfulness, except for a few still loyal to Moses, including Lilia, Joshua, Sephora and Bithiah.
High atop the mountain, Moses witnesses God's creation of the stone tablets containing the Ten Commandments. When Moses finally climbs down and meets Joshua, they both behold their people's iniquity. Moses hurls the tablets at the idol in a rage. The idol explodes, and Dathan and his followers are killed. After God forces them to endure forty years' exile in the desert to kill off the rebellious generation, the Hebrews are about to arrive in the land of Canaan. An elderly Moses, who is not allowed to enter the promised land, because of his disobedience to God at the waters of Strife, appoints Joshua to succeed him as leader, says a final good bye to Sephora, and goes forth to his destiny.

Question: How long is the Hebrews' exile?
Answer: 40 years