Online Test for PHP

  1. PHP is an open source software
    True
    False

  1. include_once is a ________.
    Function
    Statement
    Language Constructor
    All of the above


  1. To create instance of class "new" keyword is not required.
    True
    False

  1. Which is correct statement to terminate PHP statement?
    Semicolon at the end of each statement
    The closing tag of a block of PHP code automatically implies a semicolon;
    Colon at the end of each statement
    A & B

  1. How does the identity operator === compare two values?
    It converts both to a common compatible data type and then compares the values
    It returns True only if they are both of the same type and value
    It converts both values to strings and compares them
    If the two values are strings, it performs a syntax comparison

  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. Find Error/Output in follwing code:
  2.                                 
    <?php
    
    $val1 
    42;
    if(
    is_numeric($val1)) {
      echo 
    "Integer";
    } else {
      echo 
    "Not Integer";
    }

    $val2 '42';
    if(
    is_numeric($val2)) {
      echo 
    "Integer";
    } else {
      echo 
    "Not Integer";
    }
    ?>
    Integer Integer
    Integer Not Integer
    Not Integer Integer
    Not Integer Not Integer

  1. The variable name is case-sensitive in PHP.
    True
    False

  1. In PHP, variable always start with _____?
    %
    #
    &
    $

  1. list in PHP is ?
    Language construct
    Keyword
    A & C Both
    None of the above

Post Your Question
Social Sharing
Search