Online Test for PHP

  1. Find wrong statement
    A class may contain its own constants, properties, and methods.
    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.
    A "class" is not a PHP reserved word.
    The class name can be any valid label, provided it is not a PHP reserved word.

  1. Array values are keyed by ______ values (called indexed arrays) or using ______ values (called associative arrays).
    Float, string
    Even number, string
    String, Boolean
    Integer, string


  1. What function split an array into chunks?
    array_chunk()
    array_split()
    array_split_chunk
    array_chunks()

  1. In which circumstance it is not possible to assign default value to a parameter while declaring a function?
    When the parameter is Boolean
    When the function is being declared as a member of a class
    When the parameter is being declared as passed by reference
    When the function contains only one parameter

  1. PEAR stands for?
    PHP Extension and Application Record
    PHP Extended and Application Repository
    PHP Extension and Application Repository
    PHP Extension and Applicable Repository

  1. Static methods can be call with class name and colon operator, $this is not available inside the method declared as static.
    True
    False


  1. What option should be enable to allow php short tags in php.ini?
    short_tag
    short_open_tag
    asp_tag
    allow_all_tag

  1. If parent class has Final method abc(). Method abc() can be overridden in child class.
    True
    False

  1. Find Error/Output in follwing code:
  2.                                 
    <?php
    
    $strings 
    'test test';
    if (
    ctype_alpha($strings)) {
      echo 
    "The string consists of all letters.";
    } else {
      echo 
    "The string does not consist of all letters.";
    }
    ?>
    The string does not consist of all letters.
    The string consists of all letters.
    Fatal Error
    Syntax Error

  1. Which of the following tags is not a valid way t o begin and end a PHP code block?
    &lt;% %&gt;
    &lt;! !&gt;
    &lt;? ?&gt;
    &lt;?= ?&gt;

Post Your Question
Social Sharing
Search