php-programming-skills-quiz

php-programming-skills-quiz

1. What does PHP stand for?

  • (A) Personal Hypertext Preprocessor
  • (B) Preprocessed Hypertext Processor
  • (C) Hypertext Preprocessor
  • (D) Hypertext Personal Processor

ANSWER= (C) Hypertext Preprocessor

 

2. Which function is used to check if a variable is an array in PHP?

  • (A) is_array()
  • (B) array_check()
  • (C) is_object()
  • (D) check_array()

ANSWER= (A) is_array()
 

3. What does the explode() function do in PHP?

  • (A) Splits a string into an array
  • (B) Joins elements of an array into a string
  • (C) Checks if a string exists in an array
  • (D) Encodes a string into base64

ANSWER= (A) Splits a string into an array

 

4. Which of the following is used to comment out a single line of code in PHP?

  • (A) <!-- This is a comment -->
  • (B) // This is a comment
  • (C) # This is a comment
  • (D) Both b and c

ANSWER= (D) Both b and c

 

5. Which PHP function is used to send a raw HTTP header to a client?

  • (A) send()
  • (B) header()
  • (C) output()
  • (D) redirect()

ANSWER= (B) header()

 

6. What is the correct way to declare a constant in PHP?

  • (A) const myConstant = "value";
  • (B) define("myConstant", "value");
  • (C) constant("myConstant", "value");
  • (D) Both a and b

ANSWER= (D) Both a and b
 

7. Which of the following is the correct way to create a PHP array?

  • (A) $arr = array("apple", "banana", "cherry");
  • (B) $arr = ["apple", "banana", "cherry"];
  • (C) Both a and b
  • (D) None of the above

ANSWER= (C) Both a and b

 

8. How do you declare a variable in PHP?

  • (A) var myVariable;
  • (B) $myVariable;
  • (C) $myVariable = "value";
  • (D) Both b and c

ANSWER= (D) Both b and c

Comments (0)
Login or create account to leave comments