C# MCQ With Questions and Answer
Under which circumstances is the $_SESSION super-global available? (Choose 2)
A.If session_start() was called.B.If session.auto_start INI setting is enabled.C.Always available in PHP 5.D.If a valid session id is passed via GET, POST or COOKIE.E. If register_globals are enabled.
The following form is loaded in a browser and submitted, with the checkbox activated:
<form method="post">
<input type="checkbox" name="accept">
<form>
In the server-side PHP code to deal with the form data, what is the value of $_POST['accept']?
A.acceptB.okC.trueD.on
What is the output of the following code?
$a = 1;
++$a;
$a*=$a;
echo $a--;
A.4B.3C.5D.0E.1
What is the purpose of the open_basedir directive?
A.Provide a list of directories where PHP should search for files.B.Provide a list of directories from which PHP can open files.C.Provide a list of directories from which PHP cannot open files.D.Directory where the PHP extensions can be found.
What is the output of the following script?
<?php
function fibonacci ($x1, $x2)
{
return $x1 + $x2;
}
$x1 = 0;
$x2 = 1;
for ($i = 0; $i < 10; $i++) {
echo fibonacci($x1, $x2) ',';
}
?>
A.1,2,3,4,5,6,7,8,9B.1,2,3,4,5,6,7,8,9,10,C.1,2,3,5,8,13,21,34,55,89,D.1,1,1,1,1,1,1,1,1,1,