TENSIONS are running high at United States borders at the moment.

David Thornton, a software engineer from Sydney, expected to be questioned thoroughly when he arrived in New York — but his experience was downright weird.

The 24-year-old studied computer science and law at the University of New South Wales, and he stopped in the US on the way home from finishing a course in Europe.

It all started at the immigration queue at Newark airport.

The man in front of him was pulled into an interrogation room as a CNN broadcast blared in the background with the latest news about Donald Trump’s travel ban.

“He was asked: ‘Have you ever been denied entry into the United States?’ and he said: ‘Yes’. Everyone’s ears pricked up,” Thornton said.

“It was taking longer than usual, but I expected that. When I rocked up and it was my turn to talk to the Customs and Border Protection officer he asked all the regular questions. It was nothing out of the ordinary.”

However, it wasn’t long before the interview took a very strange turn.

“Have you been here before?”

“Yes.”

“How long are you here?”

“10 days.”

“What will you be doing?”

“Vacationing.”

Thornton told news.com.au he got the sense he was about to be allowed in, so he picked up his bags as the officer asked one last question.

“What do you do for a living?”

“I told him I’m a software engineer. He asked if I knew Python code, and I said yes. It’s a programming language, like C or Java, and it’s pretty standard," Thornton said.

The follow-up question was something he’d ever been asked before.

“‘I’ve got a problem, I’m trying to write a computer program, can you help me?’”

Thornton said he was so surprised he didn’t know what to think.

“I was a little bit taken aback, because I thought I was going to get straight in.

“He started to read off his computer, and I got the feeling he was trying to trick me. I just wanted to get into the US, so I said: ‘Of course’.”

He said the officer appeared to be mid to senior level, and there’s no chance the conversation would have been overheard by anyone else in line.

For the next few minutes, he was forced to prove his worth — even given a pen and paper to record his answers.

“He administered a literal computer science test. It wasn’t a savant-level one like you hear of at Google, but it was definitely a test.

“The vibe I got was weird. He asked me a question, then asked me a follow-up question to prove I wasn’t lying.

“Do they not allow bad software engineers into the United States?” Thornton joked.

He clearly passed, because he was allowed into the country a short time later, and spent a few days exploring New York before visiting family friends in Texas.

Even his American mates were surprised by the odd line of questioning.

Seth Porges, a science and technology journalist who frequently appears on the Discovery Channel and National Geographic, went so far as to tweet about it.

“Australian guy I know was just stopped at [the airport]. CBP asked what he does. “Computer programmer.’ Then had him solve a CS problem. #NotKidding.”

Reflecting on the incident, Thornton said it was strange considering he didn’t think of his job as being particularly contentious.

“Do I think this will put people off? For sure,” he told news.com.au.

“What would I say about my experience? Just make sure you study up before you enter the United States!”