PHP Practice Test: Trivia Quiz

21 Questions | Total Attempts: 101

SettingsSettingsSettings
Please wait...
PHP Practice Test: Trivia Quiz

PHP practice test: a trivia quiz. This server scripting language is commonly used to design interactive WebPages. If you have just started learning about it, this quiz is exactly what you need to refresh your memory. Do you know how to work with the remote file in PHP? This quiz tests you on how to align strings in your algorithm but identifiers as well. Give it a try and see how helpful it will be for you.


Questions and Answers
  • 1. 
    PHP is a widely used ……………. scripting language that is especially suited for web development and can be embedded into HTML.
    • A. 

      Open source general purpose

    • B. 

      Proprietary general purpose

    • C. 

      Open source special purpose

    • D. 

      Proprietary special purpose

  • 2. 
    Which of the following variables is not a predefined variable?
    • A. 

      $get

    • B. 

      $ask

    • C. 

      $request

    • D. 

      $post

  • 3. 
    Given a variable $email containing the string [email protected] which of the following will extract the string example.com?
    • A. 

      Strstr($email,”@”);

    • B. 

      Strchr($email,”@”);

    • C. 

      Substr($email, strops(($email,”@”));

    • D. 

      Substr($email, strops(($email,”@”)+1);

  • 4. 
    Which of the following will not combine strings $s1 and $s2 into a single string?
    • A. 

      $s1+$s2

    • B. 

      “{$s1}{$s2}”

    • C. 

      $s1.$s2

    • D. 

      Implode(‘ ‘, array($s1,$s2))

  • 5. 
    The ____ function can be used to compare two strings using a case-insensitive binary algorithm.
    • A. 

      Strcmp()

    • B. 

      Stricmp()

    • C. 

      Strcasecmp()

    • D. 

      Stristr()

    • E. 

      None

  • 6. 
    A variable $word is set to “HELLO WORLD”, which of the following script returns in title case?
    • A. 

      Echo ucwords($word)

    • B. 

      Echo ucwords(strtolower($word))

    • C. 

      Echo ucfirst($word)

    • D. 

      Echo ucfirst(strtolower($word)

  • 7. 
    The difference between include() and require()
    • A. 

      Are different how they handle failure

    • B. 

      Both are same in every aspects

    • C. 

      Is include() produced a Fatal Error while require results in a Warning

    • D. 

      None of above

  • 8. 
    Trace the odd data type.
    • A. 

      Floats

    • B. 

      Integer

    • C. 

      Doubles

    • D. 

      Real number

  • 9. 
    Which of the following are valid float values?
    • A. 

      4.5678

    • B. 

      4.0

    • C. 

      7e4

    • D. 

      All of above

  • 10. 
    In PHP string data are
    • A. 

      Delimited by single quote

    • B. 

      Delimited by double quote

    • C. 

      Delimited by

    • D. 

      All of above

  • 11. 
    Casting operator introduced in PHP 6 is
    • A. 

      (array)

    • B. 

      (int64)

    • C. 

      (real) or (double) or (float)

    • D. 

      (object)

  • 12. 
    When defining identifier in PHP you should remember that
    • A. 

      Identifier are case sensitive. So $result is different than $ result

    • B. 

      Identifiers can be any length

    • C. 

      Both of above

    • D. 

      None of above

  • 13. 
    The output of following script would be $somerar=15; function ad it () { GLOBAL $somevar; $somerar++ ; echo "somerar is $somerar"; } addit ();
    • A. 

      Somerar is 15

    • B. 

      Somerar is 16

    • C. 

      Somerar is 1

    • D. 

      Somerar is $ somerar

  • 14. 
    Which of the following method sends input to a script via a URL?
    • A. 

      Get

    • B. 

      Post

    • C. 

      Both

    • D. 

      None

  • 15. 
    Which of the following method is suitable when you need to send larger form submissions?
    • A. 

      Get

    • B. 

      Post

    • C. 

      Both Get and Post

    • D. 

      There is no direct way for larger form. You need to store them in a file and retrieve

  • 16. 
    The function setcookie( ) is used to
    • A. 

      Enable or disable cookie support

    • B. 

      Declare cookie variables

    • C. 

      Store data in cookie variable

    • D. 

      All of above

  • 17. 
    To work with remote files in PHP you need to enable.
    • A. 

      Allow_url_fopen

    • B. 

      Allow_remote_files

    • C. 

      Both of above

    • D. 

      None of above

  • 18. 
    Which of the following function returns the number of characters in a string variable?
    • A. 

      Count($variable)

    • B. 

      Len($variable)

    • C. 

      Strcount($variable)

    • D. 

      Strlen($variable)

  • 19. 
    The left associative dot operator (.) is used in PHP for
    • A. 

      Multiplication

    • B. 

      Concatenation

    • C. 

      Separate object and its member

    • D. 

      Delimeter

  • 20. 
    Which of the following variable assignments is 'by value' assignment in PHP.
    • A. 

      $value1= $value?

    • B. 

      $value1= & $value?

    • C. 

      $value1= & $value?

    • D. 

      None

  • 21. 
    Which of the following functions require the allow-url-fopen must be enabled?
    • A. 

      Include()

    • B. 

      Require()

    • C. 

      Both of above

    • D. 

      None of above

Back to Top Back to top