PHP Basic Knowledge Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Jpatiaga
J
Jpatiaga
Community Contributor
Quizzes Created: 1 | Total Attempts: 1,425
Questions: 10 | Attempts: 1,425

SettingsSettingsSettings
PHP Basic Knowledge Quiz - Quiz

When getting into web development, the first glance at PHP and all that comes with it can be a daunting task. Once you learn the basics, however, things become easier. Let’s see how much you know thus far!


Questions and Answers
  • 1. 

    What does PHP stand for?

    • A.

      Personal Hypertext Processor

    • B.

      Personal Home Page

    • C.

      PHP: Hypertext Preprocessor

    • D.

      Private Home Page

    Correct Answer
    C. PHP: Hypertext Preprocessor
    Explanation
    PHP stands for "PHP: Hypertext Preprocessor." PHP is a widely-used open-source scripting language that is specifically designed for web development. It is used to create dynamic web pages and can be embedded into HTML code. The name "PHP: Hypertext Preprocessor" is a recursive acronym, which means that one of the letters stands for itself. In this case, the "P" in PHP stands for PHP itself.

    Rate this question:

  • 2. 

    PHP server scripts are surrounded by delimiters, which?

    • A.

    • B.

      ...

    • C.

      ...

    • D.

    Correct Answer
    A.
    Explanation
    PHP server scripts are surrounded by delimiters, which are . These delimiters are used to indicate the beginning and end of a PHP script. Any code or content within these delimiters is processed by the PHP server and executed accordingly. This allows for easy integration of PHP code within HTML or other web scripting languages.

    Rate this question:

  • 3. 

    How do you write "Hello World" in PHP

    • A.

      Echo "Hello World";

    • B.

      Document.Write("Hello World");

    • C.

      "Hello World";

    Correct Answer
    A. Echo "Hello World";
    Explanation
    The correct answer is "echo 'Hello World';". In PHP, the "echo" statement is used to output text or variables. In this case, it is used to output the string "Hello World" to the screen. The other options, "Document.Write('Hello World');" and ""Hello World";" are not valid syntax in PHP.

    Rate this question:

  • 4. 

    All variables in PHP start with which symbol?

    • A.

      !

    • B.

      &

    • C.

      $

    • D.

      Var

    Correct Answer
    C. $
    Explanation
    In PHP, all variables start with the symbol $. This symbol is used to declare and access variables in PHP. It is followed by the variable name, which can contain letters, numbers, and underscores. The $ symbol is essential for distinguishing variables from other types of data in PHP code.

    Rate this question:

  • 5. 

    What is the correct way to end a PHP statement?

    • A.

      New line

    • B.

    • C.

      ;

    • D.

      .

    Correct Answer
    C. ;
    Explanation
    The correct way to end a PHP statement is with a semicolon (;). This is a common practice in many programming languages, including PHP, to indicate the end of a statement. The semicolon is used to separate multiple statements on the same line or to terminate a single statement on its own line. It helps to ensure that the code is properly interpreted and executed by the PHP interpreter.

    Rate this question:

  • 6. 

    How do you make an array of values?

    • A.

      $arr[] = new Array('value1', 'value2');

    • B.

      $arr = new ['value1', 'value2'];

    • C.

      $arr = array('value1', 'value2');

    Correct Answer
    C. $arr = array('value1', 'value2');
    Explanation
    To make an array of values, the correct syntax is "$arr = array('value1', 'value2');". This syntax creates an array called "$arr" and assigns it the values "value1" and "value2". The other options provided are incorrect. "$arr[] = new Array('value1', 'value2');" attempts to create a new array using the "new" keyword, but the correct syntax does not require the use of "new" or "Array". "$arr = new ['value1', 'value2'];" is also incorrect because it uses square brackets instead of the "array()" function.

    Rate this question:

  • 7. 

    How do you get information from a form that is submitted using the "get" method?

    • A.

      $_GET[];

    • B.

      Request.QueryString;

    • C.

      Request.Form;

    Correct Answer
    A. $_GET[];
    Explanation
    When a form is submitted using the "get" method, the information entered in the form is appended to the URL as query parameters. In PHP, the $_GET[] superglobal is used to retrieve these values from the URL. It allows you to access the submitted data by specifying the name of the input field as the key inside the square brackets. This method is commonly used when you want to retrieve and display the form data in the URL itself, such as in search forms. The other options, Request.QueryString and Request.Form, are not valid in PHP and are typically used in other programming languages like ASP.NET.

    Rate this question:

  • 8. 

    When using the POST method, variables are displayed in the URL:

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    When using the POST method, variables are not displayed in the URL. The POST method is used to send data to the server in the body of the HTTP request, rather than appending it to the URL. This makes it more secure and suitable for sending sensitive information like passwords or credit card details.

    Rate this question:

  • 9. 

    In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In PHP, both single quotes and double quotes can be used for defining strings. This allows flexibility in choosing the type of quotes based on the specific requirements of the string. Single quotes are generally preferred when there is no need for variable interpolation or special character interpretation. Double quotes, on the other hand, allow for variable interpolation and special character interpretation. Therefore, the statement "In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings" is true.

    Rate this question:

  • 10. 

    What does this statement print out?print count("123");

    • A.

      3

    • B.

      FALSE

    • C.

      NULL

    • D.

      6

    • E.

      1

    Correct Answer
    E. 1
    Explanation
    The statement "print count("123");" prints out the number 1. This is because the count() function is used to count the number of occurrences of a substring within a string. In this case, the substring "123" appears only once in the string, so the count() function returns 1, which is then printed out.

    Rate this question:

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.