PHP Basics to Advanced: Quiz for Developers

PHP Basics to Advanced: Quiz for Developers

1. What is the purpose of the $_GET superglobal in PHP?

  • (A) Used to get input from a form via POST
  • (B) Used to get input from a form via GET
  • (C) Used to send cookies
  • (D) Used to send email data

ANSWER= (A) Used to get input from a form via GET

 

2. What is the correct way to include a PHP file in another PHP file?

  • (A) include("file.php");
  • (B) import("file.php");
  • (C) require("file.php");
  • (D) check_array()

ANSWER= (D) Both a and c
 

3. Which operator is used for string concatenation in PHP?

  • (A) +
  • (B) &
  • (C) .
  • (D) ,

ANSWER= (C) .

 

4. What does the isset() function do in PHP?

  • (A) Checks if a variable is null
  • (B) Checks if a variable is set and not null
  • (C) Initializes a variable
  • (D) Both a and b

ANSWER= (B) Checks if a variable is set and not null

 

5. How can you prevent form resubmission after page reload in PHP?

  • (A) Use header() to redirect after form submission
  • (B) Use JavaScript to prevent resubmission
  • (C) Use cookies to store the form status
  • (D) Both a and b

ANSWER= (A) Use header() to redirect after form submission

 

6. Which of the following is the correct way to start a PHP block?

  • (A) <?php
  • (B) <%
  • (C) #php
  • (D) <script language="php">

ANSWER= (A) <?php
 

7. Which of the following is NOT a valid data type in PHP?

  • (A) Integer
  • (B) String
  • (C) Float
  • (D) Character

ANSWER= (D) Character

Comments (0)
Login or create account to leave comments