In most places, there has to be a factual basis for a guilty plea for a judge to accept it. The judge must confirm that there’s enough evidence to suggest that the defendant isn’t pleading guilty to something he or she didn’t actually do. But the law varies a bit more when it comes to no-contest (or nolo contendere) pleas.
In some jurisdictions, including federal court, a judge can accept a no-contest plea without looking into whether the defendant is actually guilty. In others, judges must find factual bases for no-contest pleas much in the way—if not in the exact same way—that they must for guilty pleas.