PHP Multiple Choice Questions

  1. If property of class is declare using var then PHP5 will treat the property as?
    1. Protected
    2. Private
    3. Public
    4. Final
Answer :
C
Explanation:
Added By : Rahul


  1. Class member variables are also called?
    1. Properties
    2. Fields
    3. Attributes
    4. All of the above
Answer :
D
Explanation:
Added By : Rahul

  1. Which of the following is a correct way to declare constant variable?
    1. const $CONSTANT = 'constant value';
    2. const CONSTANT = 'constant value';
    3. const CONSTANT = $a * $b;
    4. All of the above
Answer :
B
Explanation:
Added By : Rahul


  1. Find wrong statement
    1. A class may contain its own constants, properties, and methods.
    2. Basic class definitions begin with the keyword class, followed by a class name, followed by a pair of curly braces which keeps the definitions of the properties and methods.
    3. A "class" is not a PHP reserved word.
    4. The class name can be any valid label, provided it is not a PHP reserved word.
Answer :
C
Explanation:
Added By : Rahul

  1. How to typecast a variable to Boolean?
    1. $var = $var == $var;
    2. $var = (true)$var;
    3. $var = (bool)$var;
    4. Variable cannot be typecast in Boolean
Answer :
C
Explanation:
Added By : Raju

  1. include_once is a ________.
    1. Function
    2. Statement
    3. Language Constructor
    4. All of the above
Answer :
B
Explanation:
Added By : Sanjay


  1. microtime() returns _______.
    1. current Unix timestamp with seconds
    2. current Unix timestamp with nanoseconds
    3. current Unix timestamp with microseconds
    4. None of the above
Answer :
C
Explanation:
Added By : Sanjay

  1. What will range('a', 'z') return?
    1. Find difference between 'a' to 'z'
    2. An alphabetically ordered array of letters from 'a' to 'z'
    3. Will only apply on integer value
    4. None of the above
Answer :
B
Explanation:
Added By : Sonali

Post Your Question
Social Sharing
Search