For Facebook, Tuesday is being seen as a kind of dreaded final exam.

That’s when Mark Zuckerberg, the company’s chief executive, will swap his trademark gray T-shirts for a suit and tie, and embark on a two-day marathon of testimony on Capitol Hill. His goal? To apologize for Facebook’s missteps, reassure Congress that Facebook intends to stop foreign powers from using its service to meddle in U.S. elections and detail the company’s plans to better protect its users’ privacy.

In preparation for Zuckerberg’s testimony, his first such appearance, Facebook has spent the last couple of weeks trying to transform its public image from a defiant, secretive behemoth into a contrite paragon of openness, announcing a string of new privacy and ­anti-abuse measures and making company executives available for numerous interviews.

It has also hired a team of experts, including a former special assistant to President George W. Bush, to put Zuckerberg, 33, a cerebral coder who is uncomfortable speaking in public, through a crash course in humility and charm. The plan is that when he sits down before the Senate Commerce and Judiciary committees Tuesday, Zuckerberg will have concrete changes to talk about, and no questions he can’t handle.

“For every major CEO, and now for Mark Zuckerberg, this is a rite of passage,” said Reed Hundt, a former chairman of the Federal Communications Commission. “Facebook has become so important — not just to business but to society — it can’t avoid having to run the congressional gantlet.”

Zuckerberg’s testimony represents a pivotal moment for the company’s future. Facebook’s data collection practices, the core of its ad-based business model, have come under broad scrutiny in recent weeks as the company has been forced to raise its estimates of how much user information was leaked and to admit that “most” of its more than 2 billion users may have had their public profile data scraped by outside harvesters. Tim Cook, Apple’s chief executive, has emerged as a prominent critic of Facebook’s approach to making money from user data, calling user privacy a “human right.”

Ahead of Zuckerberg’s trip to Washington, Facebook has hired a team from the law firm WilmerHale as well as outside consultants to coach him on questions lawmakers may ask, and on how to pace his answers and react if interrupted, according to people close to the preparations who spoke anonymously. Facebook also has set up mock hearings involving its communications team and outside advisers who role-play members of Congress.

Internal staff has pushed Zuckerberg to answer lawmakers’ questions directly, and not to appear overly defensive. Their goal is to make Zuckerberg appear as agreeable and forthright as possible, the people close to the preparations said. Reginald Brown, a former special assistant to Bush, is leading the WilmerHale group. A Facebook spokesman declined to comment.

As questions about Facebook’s role in the 2016 election and its privacy problems mounted, Zuckerberg initially tried to avoid the limelight, dodging requests for public testimony by lawmakers in the U.S. and Europe. He instead sent lieutenants, including Sheryl Sandberg, the company’s chief operating officer, and Colin Stretch, Facebook’s general counsel, to answer tough questions from lawmakers and reporters.

But last month, the latest Facebook scandal turned up the heat on Zuckerberg, when it was disclosed that Cambridge Analytica, a political consulting firm connected to President Donald Trump’s 2016 campaign, improperly obtained the personal data of what Facebook now estimates to be up to 87 million of its users.

Facebook is normally tight-lipped about its inner workings, but company officials have sharply shifted tone in the past few weeks. On Wednesday, Zuckerberg held a conference call with reporters, in which he admitted that the company’s failure to anticipate how its tools could be misused was a “huge mistake.” And on Friday, Zuckerberg said in a statement that the company had started requiring advertisers to verify their identities and locations before running political ads on Facebook. He also said the company supported a bill in Congress to require such disclosures.

Facebook has also tightened its data sharing policies and rolled out a simplified system for its users to control their privacy and security settings.

Zuckerberg is set to testify before the Senate committees on Tuesday and the House Energy and Commerce Committee on Wednesday. Democrats are expected to grill him about the privacy scandals, and how the social network is guarding against possible interference in this fall’s midterm elections. Republicans are expected to be more reticent about privacy regulations, and may use the hearings to raise suspicions of political bias on the social network.