PHP MCQ Question and Answer

PHP MCQ Question and Answer
101. what is the return value of this substr function?

<?php

$rest = substr("abcdef", -1);

$rest = substr("abcdef", 0, -1);

?>
  • f,abcde
  • a,fedcb
  • b,abcdef
  • a,abcde
Show Answer
102. Assume that your php file 'index.php' in location c:/apache/htdocs/phptutor/index.php. If you used basename($_SERVER['PHP_SELF']) function in your page, then what is the return value of this function ?
  • phptutor
  • phptutor/index.php
  • index.php
  • /index.php
Show Answer
103. $x="display";
${$x.'_result'} ();
?>
Above program will call the function display_result()
  • False
  • True
  • Parser Error
  • None of the above
Show Answer
104. All variables in PHP start with which symbol?
  • !
  • $
  • &
  • %
Show Answer
105. Father of PHP?
  • Larry Wall
  • Rasmus Lerdorf
  • James Gosling
  • Guido Van Rossum
Show Answer
106. In PHP the error control operator is _______
  • .
  • *
  • @
  • &
Show Answer
107. $str="3dollars";
$a=20;
$a+=$str;
print($a);
?>
Output ?
  • 23dollars
  • 203dollars
  • 320dollars
  • 23
Show Answer
108. <?php
function zz(& $x)
{
$x=$x+5;
}
?>
$x=10;
zz($x);
echo $x;
  • 5
  • 0
  • 15
  • 10
Show Answer
109. <?php
echo $_SERVER['REMOTE_ADDR'];
?>
  • shows the IP address of the local system
  • shows the IP address of the visitor
  • shows the IP address of the webserver
  • None of the above
Show Answer
110. <?php
$x=dir(".");
while($y=$x->read())
{
echo $y."
"
}
$y->close();
?>
What is the following output?
  • display all folder names
  • display a folder content
  • display content of the all drives
  • Parse error
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test