Amazon Best Products with minimum price

Monday, 23 October 2017

PHP Quiz (Question and Answer) - Function

This is set of multiple choice question PHP function. Please write your answer in comment section.

A) Type Hinting was introduce in which vesion of PHP ?

  1. PHP 5
  2. PHP 5.4
  3. PHP 4
  4. PHP 7

B) What will be the output of the follwing code.

  1. <?php
  2.     function calculation($price, $GST="")
  3.     {
  4.         $total = $price + ($price * $GST);
  5.         echo "$total"; 
  6.     }
  7.     calculation(42); 
  8.     ?>

  1. Error
  2. 0
  3. 42
  4. 21


C) What will be the output of following PHP Code. 

    1. <?php
    2.     function abc()  
    3.     {
    4.         function bcd()
    5.         {
    6.             echo 'I am bcd';
    7.   }
    8.         echo 'I am abc';
    9.     }
    10.     bcd();
    11.     abc();
    12.     ?>

  1. I am bcd
  2. I am abc
  3. Error
  4. I am bcd I am abc
  5. I am abc I am bcd


Please Friends Write your answer in comment section.

Thank You

No comments:

Post a Comment