Private Public IP Questions


[insert_php]
function GeneratePublicIP() {
$c = mt_rand(1, 4);
if ($c == 1) { //generate class A
$a = mt_rand(0, 127);

while($a == 10) {
$a = mt_rand(0, 127);
}
$a = $a & “.” & mt_rand(0, 255) & “.” & mt_rand(0, 255) & “.” & mt_rand(0, 255)) & ” /8″;
}
else if ($c == 2) { //Generate class B public address
$a = mt_rand(128, 191);
If ($a == 172) {
$b = mt_rand(0, 255);
while ( $b <= 16 ){ $b = mt_rand(0, 255); } } $a = $a & "." & $b & "." & mt_rand(0, 255) & "." & mt_rand(0, 255) & " /16" ; } else if ($c == 3) { //Generate class C public address $a = mt_rand(192, 223); If ($a == 192) { $b = mt_rand(0, 255); while ($b = 168){ $b = mt_rand(0, 255); } } $a = $a & "." & $b & "." & mt_rand(0, 255) & "." & mt_rand(0, 255) & " /24" ;//Generates 16 to 31 } echo "$a"; } $b = mt_rand(1, 3); if ($b == 1) { GeneratePublicIP(); } elseif ($b == 2) { GeneratePublicIP(); } elseif ($b == 3) { GeneratePublicIP(); } echo $b; [/insert_php]

Which of the following is a private IP address?
[insert_php]echo mt_rand(5, 15);[/insert_php]
[insert_php]echo mt_rand(5, 15);[/insert_php]
[insert_php]echo mt_rand(5, 15);[/insert_php]
[insert_php]echo mt_rand(5, 15);[/insert_php]


1. What is the answer to this question?








Show me the answers!

Question 1: The correct answer is the Answer 1.

[insert_php]
echo “Which of the following is a private IP address?”
[/insert_php]