What do you know about PHP?

Multiple choice questions about PHP programming for you to try.

  1. Question 1: What does PHP represent:
    1. Preprocessed Hypertext Page
    2. Hypertext Transfer Protocol
    3. PHP: Hypertext Preprocessor
    4. Hypertext Markup Language
  2. Question 2: The following code, print out the following value
     
    1. first
    2. 2
    3. 3
    4. There is no answer
  3. Question 3: The following code, print out the following value
     
    1. HELLO WORLD!
    2. hello world!
    3. hello wolrd
    4. Failed to run, report an error
  4. Question 4: Which of the following code snippets is used to annotate PHP
    1. / * commented code here * /
    2. // you are handsome
    3. # you are gay
    4. All the above comments
  5. Question 5. The default of a variable with no value is shown with the keyword
    1. none
    2. null
    3. undef
    4. There is no such concept in PHP
  6. Question 6: What symbols are used when using variables in PHP?
    1. $$
    2. $
    3. @
    4. #
  7. Question 7: The following code, print out the following value
     
    1. false
    2. true
    3. Void
    4. true false
  8. Question 8: Which of the following functions is used to declare constants
    1. const
    2. constants
    3. define
    4. def
  9. Question 9: The following code, print out the following value
     $ var = '0'; 

    if ($ var) {

    echo 'true';

    } else {

    echo 'false';

    }
    1. false
    2. true
    3. void
    4. true false
  10. Question 10: Value of the following parameter
     $ var = 1/2; 
    1. first
    2. 0
    3. 0.5
    4. 1/2
  11. Question 11: Access to the word section with value 'd'
     $ a = array ( 

    'a',

    3 => 'b',

    1 => 'c',

    'd'

    );
    1. $ a [1]
    2.   $ a [2]
    3.   $ a [3]
    4. $ a [4]
  12. Question 12: Which of the following answers is not predetermined by PHP (Magic constants)
    1. __LINE__
    2. __FILE__
    3. __DATE__
    4. __METHOD__
  13. Question 13: The following code, print out the following value
     $ a = array (); 

    if ($ a == null) {

    echo 'true';

    } else {

    echo 'false';

    }
    1. true
    2. false
    3.   no print
    4. A and B
  14. Question 14: The following code, print out the following value
     if (null === false) { 

    echo 'true';

    } else {

    echo 'false';

    }
    1. true
    2. false
    3. error
    4. A and B
  15. Question 15: The following code, print out the following value
     
    1. 22
    2. 11
    3. 39
    4. 29
  16. Question 16: Where is not the math used in comparison in PHP?
    1. ===
    2. > =
    3. ! =
    4. <=>
  17. Question 17: The following code, print out the following value
     $ var = 'a'; 

    $ VAR = 'b';

    echo "$ var $ VAR";
    1. ab
    2. aa
    3. bb
    4. AB
  18. Question 18: The following code, print out the following value
     $ a = array ( 

    null => 'a',

    true => 'b',

    false => 'c',

    0 => 'd',

    1 => 'e',

    '' => 'f'

    );

    echo count ($ a);
    1. 2
    2. 3
    3. 5
    4. 6
  19. Question 19: The following code, print out the following value
     class MyException extends Exception {} 

    try {

    throw new MyException ('Oops!');

    } catch (Exception $ e) {

    echo "Caught Exception";

    } catch (MyException $ e) {

    echo "Caught MyException";

    }
    1. Caught Exception
    2.   Caught MyException
    3. Not executed
  20. Question 20: The following code, print out the following value
     $ a = 1; 

    {

    $ a = 2;

    }

    echo $ a;
    1. first
    2. 2
    3. twelfth
Update 24 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile