Register|Login

Have a question? Click here to ask the community.

Quiz 19 – Functions

| In: PHP Quizzes | 23,826 views

*You are currently not logged in and your quiz score will not be recorded. Please login or register if you would like to submit your quiz score.

Directions: Answer all questions. Any questions skipped will be scored as wrong answers. Good Luck! :)

1. What will be displayed in a browser when the following PHP code is executed:

<?php
   function greeting() {
       echo "Welcome To ThePHPBasics";
   }
   echo "Robert, ";
   greeting(); 
?>

Welcome To ThePHPBasics
Robert, Welcome To ThePHPBasics
Robert Welcome To ThePHPBasics
Robert,

2. What will be displayed in a browser when the following PHP code is executed:

<?php
   function greeting($name) {
       echo "$name, Welcome To ThePHPBasics";
   }
   greeting("Robert"); 
?>

Welcome To ThePHPBasics
Robert, Welcome To ThePHPBasics
Robert Welcome To ThePHPBasics
Robert,

3. What will be displayed in a browser when the following PHP code is executed:

<?php
   function hobbies($hobby1, $hobby2, $hobby3) {
       echo "Julia likes, $hobby2, $hobby1, and $hobby3.";
   }
   hobbies("Shopping", "Eatting", "Movies"); 
?>

Julia likes, Shopping, Movies, and Eatting.
Julia likes, Shopping, Eatting, and Movies.
Julia likes, Movies, Shopping, and Eatting.
Julia likes, Eatting, Shopping, and Movies.

4. What will be displayed in a browser when the following PHP code is executed:
Note: This may be a tough one for new PHP programmers but just think about it.

<?php
   function changeValue($y) {
       $y = $y + 5;
   }
   $myNumber = 8;
   changeValue($myNumber); 
   echo $myNumber; 
?>

13
12
8
None of the above

5. What will be displayed in a browser when the following PHP code is executed:
Note: This may be a tough one for new PHP programmers but just think about it.

<?php
   function changeValue(&$y) {
       $y = $y + 5;
   }
   $myNumber = 8;
   changeValue($myNumber); 
   echo $myNumber; 
?>

13
12
8
None of the above

Comment Form

You must be logged in to post a comment.

Users Online

Users Online: 2 Users

Most Users Ever Online: 91

Quiz Scores

Advertisments