I generate 2 random numbers and just print it to the screen
php code:
<div id="content">
<h1>Verify Your Account</h1>
<cite>Welcome <?=$strUsername;?></cite>
<?
$n1 = @rand(1, 10);
$n2 = @rand(1, 10);
$_SESSION['answer'] = $n1+$n2;
?>
<p><? if ($error == true) echo "An incorrect answer was provided. Please try again.<br />"; ?>
Please verify your account by answering the following question.</p>
<form id="verify" action="<?=$url;?>verify/<?=$_GET['v'];?>/" method="post">
<div>
<label for="answer"><?=($n1).'+'.($n2).'=';?></label>
<input type="text" name="answer" id="answer" />
</div>
<div>
<input type="submit" name="submit" id="submit" value="Submit" />
</div>
</form>
</div>
But this is also done after the user registers, gets an email verification link then they are prompted with this.