Php programming language MCQ : Function and String : Link3

Php programming language MCQ : Function and String : Link3

Function and String MCQ

       Are you worried about the answers to PHP programming-Function and String-Default parameters, Variable function, Anonymous function, Types of strings in PHP, Encoding and escaping, Comparing strings questions? We have arranged the Show Answer button under the each question. Candidates can click on it to know the right option among the given alternatives. Furthermore, the applicants can check our web portal @ www.totalmcq.com to take part in more MCQ on various subject. Wish, the given information about the Function and String MCQ will helpful to the advance and can learn the various types of questions and answers.


Q.1. In PHP valid function name starts with a ------ followed by any number of letters, numbers, or underscores.
i. numbers
ii. letters
iii. underscores

A. i and ii only                                                              B. ii and iii only
C. i and iii only                                                        D. All i, ii and iii

Q.2. State whether the following statements about PHP functions are true.
i) All the functions in PHP have a global scope.
ii) PHP supports function overloading.
iii) It is not possible to undefine or redefine previously declared functions.

A. i-True, ii-False, iii-False                                             B. i-True, ii-True, iii-True
C. i-True, ii-False, iii-True                                           D. i-True, ii-True, iii-False

Q.3. What will be the output of the following code?

A. 0
B. 1
C. inf
D. None

Q.4. Writing 2**3; will return the following result in PHP.

A. 5
B. 6
C. 8
D. None of the above

Q.5. Which of the following is/are the mathematical functions used in PHP.
i. exp
ii. pow
iii. log
iv. log5()

A. i, ii and iii only
B.ii, iii and iv only
C. i, iii and iv only
D. All i, ii, iii and iv

Q.6. By default, function arguments are passed by -------

A. reference
B. Both A and C
C. argument value
D. value

Q.7. While passing function arguments by reference, we will prepend ------- to the argument name.

A. dollor($)                                                                           B. ampersand(&)
C. hash(#)                                                                       D. dot(.)

Q.8. To return a reference from a function, we will use the reference operator (&) in -------
i) function declaration
ii) assigning the returned values

A. i only
B. ii only
C. Both i and ii
D. None of the above

Q.9. What will be the output of the following code.

 <?php \\
     function \:\:sum(\$a,\:\$b):float \\
     \{ \\
         return\:\:\$a + \$b; \\
                 \} \\
                     var\_dump(sum(1,2)); \\
?>








A. 3                                                  B. float(3)
C. null                                                  D. Generates Error

Q.10. A call to --------will show which extensions are loaded into PHP.
i) phpinfo()
ii) get_loaded_extensions()
iii) loaded_extensions()

A. i and ii                                                                                B. i and iii
C. ii and iii                                                                             D. All i, ii and iii