On Wednesday a pilot of a Qatar Airways Airbus died on route from the Philippines to Doha, according to QNA, the Qatar news agency. The Airbus was immediately rerouted to Kuala Lumpur in Malaysia, where it landed around 11.35 local time.
Qatar Airways was quick to underline that in no circumstances was the safety of the flight or the passengers ever in any danger. "Qatar Airways' priority has always been the comfort and safety of its passengers and crew", read a statement shortly after the incident.
The first officer took over the control of the aircraft, after the pilot died, allegedly due to a heart attack, although this is yet to be confirmed. The first officer sits on the right of the cockpit (facing the front), while the Captain sits on the left. In many airline companies, they take it in turns to be the pilot flying and pilot not flying, so in the event that the first officer is the pilot flying, the Captain takes a supervisory role.
The pilot flying concentrates on the controls, basically during take-off and landing and the pilot not flying concentrates on the procedures and instrument readings.
In most airlines, both pilots face very stringent tests on a regular basis, in which simulators throw all the problems that could possibly occur at them. Failure to pass this test means grounding for six months until the next, in many cases.
In conclusion, there are always two pilots in the cockpit, both very well prepared to fly the aircraft (after take-off and until landing, everything is automatic).