Gov. Dannel P. Malloy and Republican business executive Tom Foley clashed Tuesday night on the economy, jobs, and education in their second major televised debate.

In a last-minute, lightning-round question that Foley said caught him off guard, both candidates said that they had smoked marijuana in the past.

Malloy and Foley have been engaged in an increasingly bitter campaign that has been marked by a series of negative television commercials on a wide variety of channels. This year marks a rematch of the 2010 contest that Malloy won by less than 1 percentage point in the closest gubernatorial election in Connecticut in more than 50 years. Foley won 128 of the state's 169 cities and towns, but Malloy captured enough votes in the 41 other municipalities - particularly New Haven and Bridgeport - to gain the statewide victory.

This year, the candidates have clashed over taxes, spending, education, transportation, and gun control, among other issues.

The candidates debated in front of a live audience that included students, faculty, and political supporters at the University of Saint Joseph in West Hartford.

Foley said that the state's overall economy has grown by only 1 percent since Malloy has been governor - not 1 percent per year. The reason, Foley said, was that Malloy had signed the state's largest tax increase in history that slowed the economy.

"That's why some people believe there's more opportunity in other states,'' Foley said in answer to the first question.

Malloy quipped, "After last winter, I wanted to move out of the state.''

He added that the state has created 60,000 private-sector jobs since he came into office - a number that Foley has questioned.

"Connecticut is a leading - a leading - state in driving down unemployment,'' Malloy said. "I know they're happy with the investments we've made in the University of Connecticut.''

But Foley responded that 25,000 jobs after the recession were actually created under Republican Gov. M. Jodi Rell in her last year in office that ended in January 2011. He added that state spending has gone up by 16 percent under Malloy's watch.

Malloy responded that spending was slower under his administration than during the previous two Republican administrations - under Rell and Gov. John G. Rowland.

"We are investing in the future,'' Malloy said.

In the second question, moderator Dennis House said that the legislature's nonpartisan fiscal office is projecting deficits into the future. Malloy, though, said that the deficits would not reach the level of the projections because he would not increase spending at the same rate as projected by the nonpartisan office.

"I certainly agree with the governor that we have a long way to go,'' Foley said. "Governor, where has all the money gone? ... I'm hearing more and more Malloy Math tonight.''

In order to kick start the economy, Foley said that he would cut the sales tax by one half of one percent and then cut the car tax in the cities, which generally have higher mill rates than many of the suburbs.

When the moderator asked the question again, Malloy questioned the assertion that there will be a budget deficit in the future.

"I know we can balance it just like we have done in the past,'' Malloy said, adding that he expects to add money to the state's rainy day fund for fiscal emergencies.

Foley said that since Malloy increased taxes sharply in 2011, the voters should expect more tax increases in the same way as the past.

Regarding the potential legalization of marijuana, both Malloy and Foley said they would not push for it.

“We decriminalized marijuana,’’ Malloy said, adding that some young people would no longer get a criminal record that would follow them through their lives. “I think that was a smart move.’’

Foley said that marijuana is “a gateway drug’’ that “can seriously damage and harm people’s lives.’’

In a lightning round of quick questions at the end of the debate, House caught Foley off guard. When asked if he had ever smoked marijuana, Foley responded, ‘’Whoa! I didn’t know I was going to get that question. Yes, I have.’’