PHP Functions MCQs

This section focuses on "Functions" in PHP. These Multiple Choice Questions (mcq) should be practiced to improve the PHP skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. How many types of functions are available in php?

A. 5
B. 4
C. 3
D. 2

View Answer

2. Which of the following is not a built-in function in php ?

A. print_r()
B. fopen()
C. fclosed()
D. gettype()

View Answer

3. Why should we use functions?

A. Reusability
B. Easier error detection
C. Easily maintained
D. All of the above

View Answer

4. A function name always begins with the keyword _________.

A. fun
B. def
C. function
D. None of the above

View Answer

5. A function name cannot start with a ____

A. alphabet
B. underscore
C. number
D. Both C and B

View Answer

6. A function name is not case-sensitive?

A. True
B. False
C. Only user-defined function is case-sensitive
D. None of the above

View Answer

7. A function name is not case-sensitive?

function funclfc()  
    echo "This is letsfindcourse"; 
// Calling the function 

A. This is lfc
B. This is letsfindcourse
C. No Output
D. Error

View Answer

8. A function name is not case-sensitive?


function prolfc($num1, $num2, $num3)  
    $mul = $num1 * $num2 * $num3; 
    echo "The product is $mul"; 

prolfc(1, 2, 3, 4); 

A. 24
B. 8
C. 6
D. Error: to many argument.

View Answer

9. Type Hinting was introduced in which version of PHP?

A. PHP 5.1
B. PHP 5
C. PHP 5.3
D. PHP 5.4

View Answer

10. A function in PHP which starts with double underscore is known as __________.

A. Magic Function
B. Inbuilt Function
C. Default Function
D. User Defined Function

View Answer

Also check :


* You must be logged in to add comment.