PHP Quiz Part Deux

15 Questions | Total Attempts: 140

SettingsSettingsSettings
Please wait...
PHP Quizzes & Trivia

The second quiz of our PHP studying


Questions and Answers
  • 1. 
    Include files must have a file extension of ".inc"
    • A. 

      True

    • B. 

      False

  • 2. 
    What is the correct way to include the file "time.inc" ?
    • A. 

      < ?php include("time.inc"); ? >

    • B. 

      < !--include file="time.inc"-- >

    • C. 

      < % include file="time.inc" % >

    • D. 

      < ?php include_file("time.inc"); ? >

  • 3. 
    Which operator will check if two variables are the same?
    • A. 

      =

    • B. 

      ==

    • C. 

      !=

    • D. 

  • 4. 
    The concatenation operator in PHP looks like this:
    • A. 

      +

    • B. 

      &

    • C. 

      .

    • D. 

      $

  • 5. 
    The assignment operator looks like this:
    • A. 

      ==

    • B. 

      =

    • C. 

      +

    • D. 

      ++

  • 6. 
    +, -, *, /, %, are all examples of what category of operators
    • A. 

      Assignment Operators

    • B. 

      Arithmetic Operators

    • C. 

      String Operators

    • D. 

      Comparison Operators

  • 7. 
    If I wanted to concatenate a word to a string variable I would use which of these?
    • A. 

      $dan .= "Dan";

    • B. 

      $dan += "Dan";

    • C. 

      $dan &= "Dan";

    • D. 

      $Dan == "Dan";

  • 8. 
    Which command works the same as the include() command?(the only difference being include() creates a warning whereas this alternative creates an error() when they fail)
    • A. 

      Input()

    • B. 

      Add()

    • C. 

      Aquire()

    • D. 

      Require()

  • 9. 
    Which of these are logical operators? (choose three)
    • A. 

      &&

    • B. 

      ||

    • C. 

      !

    • D. 

      £

    • E. 

      ^

  • 10. 
    Which of these is the correct syntax for an if ... else statement?
    • A. 

      If (condition) code to be executed if condition is true;

    • B. 

      If (condition) code to be executed if condition is true; else code to be executed if condition is false;

    • C. 

      If (condition) code to be executed if condition is true; elseif (condition) code to be executed if condition is true; else code to be executed if condition is false;

    • D. 

      If (condition) code to be executed if condition is true; elseif(condition) code to be executed if condition is false;

  • 11. 
    Which of these is the correct syntax for a switch statement?
    • A. 

      Case (n) { switch label1: code to be executed if n=label1; break; switch label2: code to be executed if n=label2; break; default: code to be executed if n is different from both label1 and label2; }

    • B. 

      Switch (n) { case label1: code to be executed if n=label1; case label2: code to be executed if n=label2; default: code to be executed if n is different from both label1 and label2; }

    • C. 

      Switch (n) { case label1: code to be executed if n=label1; break; case label2: code to be executed if n=label2; break; default: code to be executed if n is different from both label1 and label2; }

  • 12. 
    Which of the following statement is valid to use a Node module http in a Node based application?
    • A. 

      Var http = require("http");

    • B. 

      Var http = import("http");

    • C. 

      Package http;

    • D. 

      Import http;

  • 13. 
    Which of the following is true about __filename global object? (Nodejs)
    • A. 

      The __filename represents the filename of the code being executed.

    • B. 

      The __filename represents the resolved absolute path of code file.

    • C. 

      Both of the above.

    • D. 

       None of the above.

  • 14. 
    Which of the following code print the name of operating system?
    • A. 

      Console.log('type : ' + os.type);

    • B. 

      Console.log('type : ' + os.type());

    • C. 

      Console.log('type : ' + os.getType());

    • D. 

      None of the above.

  • 15. 
     Which of the following statement is valid to use a Node module fs in a Node based application?
    • A. 

      Var fs = require("fs");

    • B. 

      Var fs = import("fs");

    • C. 

      Package fs;

    • D. 

      Import fs;