PHP/PHP Mcq ��� Functions Sample Test,Sample questions

Question:
 What will be the output of the following PHP code?

    <?php
    echo chr(52);
    ?>

1.1

2.2

3.3

4.4


Question:
 What will be the output of the following PHP code?

    <?php
    echo lcfirst("welcome to India");
    ?>

1.welcome to India

2.welcome to india

3.Welcome to India

4.Welcome to india


Question:
 What will be the output of the following PHP code?

    <?php
    echo ord ("hi");
    ?>

1.106

2.103

3.104

4.209


Question:
 What will be the output of the following PHP code?

    <?php
    function calc($price, $tax="")
    {
        $total = $price + ($price * $tax);
        echo "$total"; 
    }
    calc(42);	
    ?>

1.Error

2.0

3.42

4.84


Question:
 What will be the output of the following PHP code?

    <?php
    function foo($msg)
    {
        echo "$msg";
    }
    $var1 = "foo";
    $var1("will this wo

1.Error

2.$msg

3.0

4.Will this work


Question:
 Which of the following are valid function names?

i) function()
ii) €()
iii) .function()
iv) $function()

1. Only i)

2.Only ii)

3.i) and ii)

4. iii) and iv)


Question:
 Which of the following PHP functions accepts any number of parameters?

1.func_get_argv()

2. func_get_args()

3.get_argv()

4.get_argc()


Question:
A function in PHP which starts with __ (double underscore) is known as __________

1.Magic Function

2.Inbuilt Function

3. Default Function

4.User Defined Function


Question:
Type Hinting was introduced in which version of PHP?

1.PHP 4

2.PHP 5

3.PHP 5.3

4.6


Question:
What will be the output of the following PHP code?

    <?php
    $op2 = "blabla";
    function foo($op1)
    {
        echo $op1;
        echo $op2;
    }
    foo("hello");
    ?>

1. helloblabla

2.Error

3.hello

4.helloblablablabla


Question:
What will be the output of the following PHP code?

    <?php
    $str = "Hello World";
    echo wordwrap($str,5,"<br>
");    
    ?>

1.Hello World

2.Hello World

3.Hell o wo rld

4.world


Question:
What will be the output of the following PHP code?

    <?php
    echo ucwords("i love my country");
    ?>

1. I love my country

2.i love my Country

3.I love my Country

4.I Love My Country


Question:
What will be the output of the following PHP code?

    <?php
    function a()
    {
        function b()
        {
            echo 'I am b';
 	}
        echo 'I am a';
    }
    a();
    a();
    ?>

1. I am a

2.I am bI am a

3.Error

4.I am a Error


Question:
What will be the output of the following PHP code?

    <?php
    function a()  
    {
        function b()
        {
            echo 'I am b';
 	}
        echo 'I am a';
    }
    b();
    a();
    ?>

1.I am b

2.I am bI am a

3.Error

4. I am a Error


Question:
Which of the following PHP functions can be used for generating unique ids?

1. uniqueid()

2.id()

3.md5()

4.mdid()


Question:
Which one of the following functions can be used to compress a string?

1. zip_compress()

2.zip()

3.compress()

4.gzcompress()


More MCQS

  1. PHP Mcq Set 1
  2. PHP Mcq Set 2
  3. PHP Mcq Set 3
  4. PHP Mcq Set 4
  5. Current affairs mcq php
  6. Current affairs mcq php set 2
  7. Current affairs mcq php set 3
  8. PHP MCQ
  9. PHP MCQ– Basics
  10. PHP Mcq – Functions
  11. PHP Mcq Arrays
  12. PHP Mcq– Basics of Object-Oriented PHP
  13. PHP Mcq – Error Handling
  14. PHP Basics Mcq Questions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!