PHP MCQ Questions and Answers

Practice Mode
Showing 10 of 130 questions
Q111
<?php $qpt = 'QualityPointTechnologies'; echo preg_match("/^Quality/", $qpt); ?>
  • A 1
  • B 0
  • C Quality
  • D Null
Answer: Option A
Q112
<?php $test="3.5seconds"; settype($test,"double"); settype($test,"integer"); settype($test,"string"); print($test); ?> What is the following output?
  • A 3.5
  • B 3.5seconds
  • C 3
  • D 3seconds
Answer: Option C
Q113
<?php $x=array(2=>"mouse",7=>"keyboard"); $y=array_keys($x); echo $y[1]; ?>
  • A keyboard
  • B mouse
  • C 7
  • D 2
Answer: Option C
Q114
$data="98.8degrees"; (double)$data; (int)$data; (string)$string; echo $data; ?>
  • A 98
  • B 98.8
  • C 98.8degrees
  • D degrees
Answer: Option C
Q115
PHP is
  • A Partially cross-platform
  • B Truly cross-platform
  • C None of above
Answer: Option B
Q116
<?php $x="101.5degrees"; (double)$x; (int)$x; echo (string)$x; ?>
  • A 101.5
  • B degrees
  • C 101
  • D 101.5degrees
Answer: Option D
Q117
Whether One-line comment begin with pound sing(#) in php?
  • A True
  • B False
  • C None of above
Answer: Option A
Q118
In PHP, during error handling include() generates......................
  • A a fatal error, and the script will stop
  • B a warning, but the script will continue execution
  • C None of the above
Answer: Option B
Q119
<?php $qpt = 'Eat to live, but not live to eat'; echo preg_match("/^to/", $qpt); ?>
  • A 0
  • B 1
  • C to
  • D Null
Answer: Option A
Q120
<?php $x=array("aaa","","ccc","ddd",""); $y=array_unique($x); echo count($x) . "," . count($y); ?>
  • A 3,1
  • B 3,3
  • C 5,5
  • D 5,4
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test