In a 777, what would happen if the auto-pilot and the altitude hold failed at the same time?
Regardless of whether it's a 777 or any other airplane where the altitude is being held by the autopilot and the altitude hold function stops, whether because of general autopilot failure, just altitude hold failure, or the altitude hold function is inadvertently or purposely switched off; the airplane will seek whatever pitch attitude it is trimmed for.

For example, using the 747-100 and -200 autopilot setup, let's say you are in cruise at 35,000 ft, the autopilot is navigating and altitude hold is on. Further, let's say we're beyond 1990, and many operators of those aircraft had disabled autothrottles because they were a maintenance hog. Thus the airplane is maintaining whatever speed has resulted from where you have positioned the power levers. The altitude hold function is maintaining altitude by using the elevator. You can look down at an indicator on the center console between the pilots to see the degree of up or down elevator being used.

As the flight progresses and fuel is burned, the c.g. moves forward and the altitude hold function adds more up elevator to maintain altitude. When a certain amount of up elevator amount is reached, the system automatically retrims so that no up elevator force is required.  You hear and see it happen because the large trim wheel on the right side of the center console rotates.

If you're a good captain or a good flight engineer, you can monitor the amount of up elevator force being held and trim it out manually before it reaches enough to trigger the automatic retrim, and save the company a little fuel money (or if you're JFK to Tel Aviv in a -100, possibly avoid a fuel stop in Athens).

Now let's say that you reach up and disengage the altitude hold sometime between retrimmings. The airplane will nose down, and actually quite abruptly if it's been awhile since it last retrimmed. So abruptly that normal practice was to always have the yoke in hand before disengaging the autopilot.

Let's say that you that you let the condition persist. The nose is down, so the airplane would descend, of course. The speed would oscillate during the descent. If there was a severe nose down trim ... well, you wouldn't want to go there.

For a humorous account (at least meant to be humorous) of the altitude hold function being inadvertently disengaged, go to http://terryliittschwager.com/hajj4contest.php.

Now for the case of total autopilot failure, I defer to the other answer already here when I posted this. Suffice it to say that the pilots would have to take control in short order to avoid an extremely serious condition, very possibly the loss of the aircraft. You can go to http://community.seattletimes.nwsource.com/archive/?date=19911219&amp;slug=1323954 for information on an incident that involves such. The interesting thing is this airplane had started to do this a number of times (including once to me coming out of Hong Kong), but in previous instances the pilots quickly recognized that the autopilot had failed and had taken control before things got serious.

Following the incident described, the airplane was repaired and reentered service, and we called her Christine.