MOUNTAIN VIEW, Calif. (AP) - For all Sen. John McCain's debate preparation, for all the speeches and chestnuts he has polished in his presidential campaigns, he was not ready for the opening question at the Google Interview.
"How do you determine good ways of sorting 1 million 32-bit integers in two megabytes of RAM?" wondered Google chief executive Eric Schmidt. More than 1,000 geeks in the audience roared. A stumped McCain laughed with them.
It was a quirky start to what is becoming a fixture on the presidential campaign - a grilling by the fresh-faced Googlers who are trying to revolutionize the Internet.
In addition to free buffets and an outdoor volleyball court, Google employees now are getting a political perk: A chance to personally question presidential candidates. Company executives, meanwhile, get precious face time to press cherished issues with the politicians who want the White House.
The Google Interview could become the 21st-century equivalent of the candidate's pilgrimage to the General Motors plant. Sen. Hillary Rodham Clinton was first, in February, followed by McCain on Friday. The company has extended invitations to all the major candidates and expects more campaign appearances in coming weeks.
"I like to think of (seeking) the presidency as a job interview with the American people," Schmidt, who moderates the sessions, told McCain. "And you're also sort of interviewing with Google. It's hard to get a job at Google." The company famously demands college transcripts and high grades; Schmidt's staff whooped at the indirect praise.
"I know I have my work cut out for me," McCain replied.
After apologizing for his mind-bending opening inquiry, Schmidt, a regular Democratic political donor, heaped praise on his GOP interviewee. He asked a series of gentle questions about McCain's Vietnam War combat and POW experiences, a chapter virtually no one in his audience was old enough to recall.
The Googlers listened respectfully, but wanted to talk about the Iraq war, a subject that is weighing down McCain's campaign. McCain has remained steadfastly loyal to President Bush's war policy, including a recent increase in U.S. combat troops and a rejection of timetables for withdrawal.
The candidate delivered a well-worn but impassioned defense of the policy, guaranteeing that "if we have to withdraw on a date-certain, there will be chaos, genocide and other nations in the region will be drawn in."
Schmidt did not challenge this view, but one of his subordinates did.
Why discount the possibility that no one will win the war, the worker asked.
"Any rational observer would say that if the war's lost, then someone won the war," McCain responded. "Al-Qaida will win that war."
Over an hour and two minutes, the questions from the audience were sometimes offbeat, sometimes pointed. One questioner expressed surprise that a Republican would venture into this liberal area 35 miles south of San Francisco; a second said he had campaigned in 2000 for McCain.
Someone else offered him a choice of topics he would like to be questioned on: genocide, campaign finance reform or "the flag." McCain chose the Darfur genocide in Sudan, allowing that the federal government has not done enough, but stopping short of pledging U.S. troops to end it.
One Google worker asked whether McCain could recall his college GPA. The senator did not offer a number, but reminded his listeners that he graduated fifth from the bottom of his class at the U.S. Naval Academy.
For the candidates, the Google Interview is likely to be especially appealing because California has moved its primary up to February 2008, a step the state hopes will force the campaigns to spend more time here.
It is also a chance for the company to tell potential presidents what matters to them.
"It's extremely valuable," said Adam Kovacevich, a Google spokesman. "We think it's important that America's next president understand the importance of the high-tech economy and keeping America competitive."
Among those issues, he said, are "net neutrality," the idea that all Web sites should have equal access to any Internet user; education; and immigration changes that would allow more skilled workers into the country.
The candidate visits also include a private tour and a talk with company executives. Kovacevich said lobbying on issues important to the company is not part of those discussions.
With what is expected to be the most expensive presidential campaign in history under way, there is big money at stake, too. Google and other search-engine companies stand to make heaps of it by selling "keyword ads" to the candidates, putting sponsored links to campaign Web sites atop the Google results page.
But most candidates have not bought those terms up, said Erick Obeck, an analyst at SendTec Inc., a search engine marketing ad agency.
As the campaign intensifies, companies like Google could take in millions of dollars each month from the campaigns, he said.
Kovacevich said such salesmanship is not part of the agenda during the private meetings, either.
The salesmanship came from McCain on Friday.
He heaped praise on the Googlers, calling them "the future of this nation."
He pledged that if elected, he would veto wasteful spending and expose "pork-barreling" lawmakers.