Research by the Massachusetts Institute of Technology, published in the journal Nature, found that respondents were most likely to want an autonomous car heading for an inevitable crash to prioritise humans over pets, larger groups of people, and young people.

In the exercise, dubbed a “serious game” by researchers, users were shown unavoidable accident simulations and asked to choose the morally preferable outcome by deciding whether the vehicle should swerve or stay on course.

It found that the strongest trends were in favour of sparing “humans over animals, sparing more lives, and sparing young lives”.

“Accordingly, these three preferences may be considered essential building blocks for machine ethics, or at least essential topics to be considered by policymakers,” the paper said.

Programming driverless cars with a preference for women or younger people would against ethical rules drawn up last year by the German ethics commission on automated driving, which concluded that “any distinction between individuals based on personal features (age, gender, physical or mental constitution) is impermissible”.

The research warns that manufacturers who do not programme cars to save children over other, older people should prepare themselves for the “strong backlash that will inevitably occur the day an autonomous vehicle sacrifices children in a dilemma situation”.

A pushchair was the character most likely to be spared, with a girl the second most likely, followed by a boy.

The characters least likely to be saved were a cat, followed by a criminal, with a dog the third least likely to be spared.

Other groups more likely to be protected in the scenarios posed by researchers included pregnant women, and doctors and athletes of either gender.

It also found geographical differences in the responses, with respondents from Asian countries such as Japan, Taiwan and Indonesia showing a much smaller preference for sparing younger characters over the old, and Latin American and Francophone countries showing a preference for sparing women.

The research posed a question similar to the well-known philosophical dilemma known as the “trolley problem”, which asks whether it is ethically permissible to change the trajectory of an out-of-control tram to save people on its current track, but harm others on its alternate route.

Manufacturers of self-driving cars have faced a similar dilemma. Some companies have suggested that the vehicles would take any action required to save vulnerable pedestrians and cyclists, but there is potential for a backlash from owners who want their car to prioritise their life over all others.

Fully self-driving cars are still in development and are not yet available to own. Companies including Google, Uber, and Tesla have all begun testing the technology.

For more of the latest technology news from the Telegraph you can visit their  website – here