PHP Multiple Choice Questions

  1. The break statement ends execution of which of the following?
    1. while
    2. for
    3. switch
    4. All of the above
Answer :
D
Explanation:
Added By : Sakshi


  1. Which is a valid character for starting a PHP function name?
    1. Dollar Sign ($)
    2. Underscore (_)
    3. Percent (%)
    4. All of the above
Answer :
B
Explanation:
Added By : Sakshi

  1. Which PHP function or variable will return the value of current session id?
    1. session_id()
    2. get_session_id;
    3. $_SESSION['CURRENT_ID'];
    4. $_SESSION['ID']
Answer :
A
Explanation:
Added By : Sakshi


  1. What is the simplest method of computing the sum of all the elements of an array?
    1. array_intersect()
    2. array_count()
    3. array_sum()
    4. array_value_count()
Answer :
C
Explanation:
Added By : Amit

  1. What is the name of function used to convert an array into a string?
    1. explode()
    2. glue()
    3. implode()
    4. None of the above
Answer :
C
Explanation:
Added By : Amit

  1. _______ function is used to sort an array in ascending order by value while preserving key associations.
    1. ksort()
    2. asort()
    3. krsort()
    4. usort()
Answer :
B
Explanation:
Added By : Amit


  1. Array values are keyed by ______ values (called indexed arrays) or using ______ values (called associative arrays).
    1. Float, string
    2. Even number, string
    3. String, Boolean
    4. Integer, string
Answer :
D
Explanation:
Added By : Amit

  1. Which object-oriented pattern would you use to implement a class that must be instantiated only once for the entire lifespan of a script?
    1. Model-view-controller
    2. Abstract factory
    3. Singleton
    4. Proxy
Answer :
C
Explanation:
Added By : Amit

Post Your Question
Social Sharing
Search