PHP Functions MCQs

11. PHP has over ____________ built-in functions that can be called directly.

A. 10
B. 100
C. 1000
D. 10000

View Answer


12. Function names are case-sensitive.

A. True
B. False
C. Only Built-In function
D. Only User-defined function

View Answer


13. how to declare strict requirement in php 7?

A. select(strict_types=1);
B. declare(strict_types=0);
C. declare(strict_types=1);
D. select(strict_types=0);

View Answer


14. where in code we declare strict requirement in php 7?

A. the very first line of the PHP file
B. the very last line of the PHP file
C. After declaring variable
D. Anywhere in the code.

View Answer


15. What will be the output of the following code?

<?php declare(strict_types=1); // strict requirement

function addNumbers(int $a, int $b) {
    return $a + $b;
}
echo addNumbers(5, "5 days"); 
?>

A. 5+5days
B. 55days
C. No Output
D. Error

View Answer


16. What will be the output of the following code?

<?php declare(strict_types=1); // strict requirement ?>


<?php
function setHeight(int $minheight = 50) {
    echo "The height is : $minheight <br>";
}

setHeight(350);

?>

A. The height is : 350
B. The height is : 50
C. No Output
D. Error

View Answer


17. Which one of the following functions displays PHP interpreter settings bound to web server?

A. infophp()
B. phpinfo()
C. php_info()
D. info_php()

View Answer


18. Which of the following functions help in navigating to another php page?

A. header()
B. location()
C. redirect()
D. None of the above

View Answer


19. In which of the following cases would function empty() return FALSE?

A. $x; echo empty($x);
B. $x=FALSE; echo empty($x);
C. $x=TRUE; echo empty($x);
D. $x=NULL; echo empty($x);

View Answer


20. What will be the output of the following code?

<?php

function WRITEMSG() {
    echo "Hello world!";
}

writemsg();
?>

A. Hello world!
B. Null
C. No Output
D. None of the above

View Answer





Discussion


* You must be logged in to add comment.