Heroes and scoundrels: What do you know about New York mayors? Take our quiz.

On Nov. 5, New Yorkers will elect the city’s 109th mayor. Often called “the second toughest job in America,” the office has been held by locomotive drivers, jazz composers, and one of the world’s richest men. Some have been scoundrels, some heroes, and some a mix of both. But all have been men, and all but one white.

From 1665 to 1777, New York mayors were appointed by the provincial governor. A state or city council appointed mayors until 1834, and since then mayors have been elected by direct popular vote.

Our quiz focuses mostly on the 18 men elected mayor since the consolidation of 1898, when New York expanded from Manhattan to include the four outer boroughs. How much do you know about the cast of colorful characters who have led the sprawling metropolis some have called the “capital of the world?”