PHP MCQ Questions and Answers

Practice Mode
Showing 10 of 130 questions
Q101
what is the return value of this substr function? <?php $rest = substr("abcdef", -1); $rest = substr("abcdef", 0, -1); ?>
  • A f,abcde
  • B a,fedcb
  • C b,abcdef
  • D a,abcde
Answer: Option A
Q102
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 ?
  • A phptutor
  • B phptutor/index.php
  • C index.php
  • D /index.php
Answer: Option C
Q103
$x="display"; ${$x.'_result'} (); ?> Above program will call the function display_result()
  • A False
  • B True
  • C Parser Error
  • D None of the above
Answer: Option B
Q104
All variables in PHP start with which symbol?
  • A !
  • B $
  • C &
  • D %
Answer: Option B
Q105
Father of PHP?
  • A Larry Wall
  • B Rasmus Lerdorf
  • C James Gosling
  • D Guido Van Rossum
Answer: Option B
Q106
In PHP the error control operator is _______
  • A .
  • B *
  • C @
  • D &
Answer: Option C
Q107
$str="3dollars"; $a=20; $a+=$str; print($a); ?> Output ?
  • A 23dollars
  • B 203dollars
  • C 320dollars
  • D 23
Answer: Option D
Q108
<?php function zz(& $x) { $x=$x+5; } ?> $x=10; zz($x); echo $x;
  • A 5
  • B 0
  • C 15
  • D 10
Answer: Option C
Q109
<?php echo $_SERVER['REMOTE_ADDR']; ?>
  • A shows the IP address of the local system
  • B shows the IP address of the visitor
  • C shows the IP address of the webserver
  • D None of the above
Answer: Option B
Q110
<?php $x=dir("."); while($y=$x->read()) { echo $y." " } $y->close(); ?> What is the following output?
  • A display all folder names
  • B display a folder content
  • C display content of the all drives
  • D Parse error
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test