quiz PHP Programming MCQ Practice

corporate_fare Computing and Information Technology
school B.Sc. Computer Science
30 Questions
0 Completed
0 Correct
0 of 30 completed
visibility You're studying as a guest — progress isn't saved. Sign in to track progress
help Question 1
radio_button_unchecked

What is PHP?

help Question 2
radio_button_unchecked

Who is the father of PHP?

help Question 3
radio_button_unchecked

What does PHP stand for?

help Question 4
radio_button_unchecked

Which of the following is the correct syntax to write a PHP code?

help Question 5
radio_button_unchecked

Which of the following is the correct way to add a comment in PHP code?

help Question 6
radio_button_unchecked

Which of the following is the default file extension of PHP files?

help Question 7
radio_button_unchecked

How to define a function in PHP?

help Question 8
radio_button_unchecked

What will be the output of the following PHP code? <?php $x = 10; $y = 20; if &#40;$x > $y && 1||1&#41; print &quot;1000 PHP MCQ&quot; ; else print &quot;Welcome to Sanfoundry&quot;; ?>

help Question 9
radio_button_unchecked

Which is the right way of declaring a variable in PHP?

help Question 10
radio_button_unchecked

What will be the output of the following PHP program? <?php $fruits = array &#40;&quot;apple&quot;, &quot;orange&quot;, array &#40;&quot;pear&quot;, &quot;mango&quot;&#41;,&quot;banana&quot;&#41;; echo &#40;count&#40;$fruits, 1&#41;&#41;; ?>

help Question 11
radio_button_unchecked

What will be the output of the following PHP program? <?php function multi&#40;$num&#41; &#123; if &#40;$num == 3&#41; echo &quot;I Wonder&quot;; if &#40;$num == 7&#41; echo &quot;Which One&quot;; if &#40;$num == 8&#41; echo &quot;Is The&quot;; if &#40;$num == 19&#41; echo &quot;Correct Answer&quot;; &#125; $can = stripos&#40;&quot;I love php, I love php too!&quot;,&quot;PHP&quot;&#41;; multi&#40;$can&#41;; ?>

help Question 12
radio_button_unchecked

Which of the following PHP functions can be used for generating unique ids?

help Question 13
radio_button_unchecked

What will be the output of the following PHP code? <?php define&#40;&quot;GREETING&quot;, &quot;PHP is a scripting language&quot;&#41;; echo $GREETING; ?>

help Question 14
radio_button_unchecked

A function in PHP which starts with __ (double underscore) is known as __________

help Question 15
radio_button_unchecked

How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.

help Question 16
radio_button_unchecked

Which of the following web servers are required to run the PHP script?

help Question 17
radio_button_unchecked

What will be the output of the following PHP code snippet? <?php $url = &quot;[email&#160;protected]&quot;; echo ltrim&#40;strstr&#40;$url, &quot;@&quot;&#41;,&quot;@&quot;&#41;; ?>

help Question 18
radio_button_unchecked

Which of the following PHP functions can be used to get the current memory usage?

help Question 19
radio_button_unchecked

Which one of the following PHP function is used to determine a file&#8217;s last access time?

help Question 20
radio_button_unchecked

What will be the output of the following PHP code? <?php $x = 5; $y = 10; function fun&#40;&#41; &#123; $y = $GLOBALS&#91;'x'&#93; + $GLOBALS&#91;'y'&#93;; &#125; fun&#40;&#41;; echo $y; ?>

help Question 21
radio_button_unchecked

PHP recognizes constructors by the name _________

help Question 22
radio_button_unchecked

The developers of PHP deprecated the safe mode feature as of which PHP version?

help Question 23
radio_button_unchecked

What will be the value of the variable $input in the following PHP program? <?php $input = &quot;PHP<td>stands for</td>Hypertext<i>Preprocessor</i>!&quot;; $input = strip_tags&#40;$input,&quot;<i></i>&quot;&#41;; echo $input; ?>

help Question 24
radio_button_unchecked

Which of the following variables does PHP use to authenticate a user? i&#41; $_SERVER&#91;'PHP_AUTH_USER'&#93;. ii&#41; $_SERVER&#91;'PHP_AUTH_USERS'&#93;. iii&#41; $_SERVER&#91;'PHP_AUTH_PU'&#93;. iv&#41; $_SERVER&#91;'PHP_AUTH_PW'&#93;.

help Question 25
radio_button_unchecked

What does PDO stand for?

help Question 26
radio_button_unchecked

What will be the output of the following PHP program? <?php $a = 100; if &#40;$a > 10&#41; printf&#40;&quot;PHP Quiz&quot;&#41;; else if &#40;$a > 20&#41; printf&#40;&quot;PHP MCQ&quot;&#41;; else if&#40;$a > 30&#41; printf&#40;&quot;PHP Program&quot;&#41;; ?>

help Question 27
radio_button_unchecked

Which of the looping statements is/are supported by PHP? i) for loop ii) while loop iii) do-while loop iv) foreach loop

help Question 28
radio_button_unchecked

Which PHP statement will give output as $x on the screen?

help Question 29
radio_button_unchecked

Which version of PHP introduced the advanced concepts of OOP?

help Question 30
radio_button_unchecked

What will be the output of the following PHP code? <?php $x = 4; $y = 3 $z = 1; $z = $z + $x + $y; echo &quot;$z&quot;; ?>