Q. What is NULL in PHP?

  • (A) Value
  • (B) Keyword
  • (C) Data Type
  • (D) Function
πŸ’¬ Discuss
βœ… Correct Answer: (C) Data Type

Q. What will be the output of the following PHP code?

Code:
<?php
$value1 = NULL;
$value2 = null;

var_dump($value1);
var_dump($value2);
?>
  • (A) Error
  • (B) NULL undefined
  • (C) NULL object
  • (D) NULL NULL
πŸ’¬ Discuss
βœ… Correct Answer: (D) NULL NULL

Q. Which type is used to store the database call?

  • (A) object
  • (B) class
  • (C) resource
  • (D) string
πŸ’¬ Discuss
βœ… Correct Answer: (C) resource

Q. What will be the output of the following PHP code?

Code:
<?php
echo strpos("Hello, Includehelp!", "Includehelp!");
?> 
  • (A) 6
  • (B) 7
  • (C) 8
  • (D) -1
πŸ’¬ Discuss
βœ… Correct Answer: (B) 7

Q. Which function is used to replace text within a string?

  • (A) str_replace()
  • (B) replace()
  • (C) replace_str()
  • (D) string-replace()
πŸ’¬ Discuss
βœ… Correct Answer: (A) str_replace()

Q. What will be the output of the following PHP code?

Code:
<?php 
$str = addcslashes("IncludeHelp","e");
echo($str); 
?>
  • (A) Includehelp
  • (B) IncludeH\elp
  • (C) Includ\eHelp
  • (D) Includ\eH\elp
πŸ’¬ Discuss
βœ… Correct Answer: (D) Includ\eH\elp

Q. What will be the output of the following PHP code?

Code:
<?php 
$str = addslashes('Hello "Includehelp!"');
echo($str); 
?>
  • (A) Hello Includehelp!
  • (B) Hello "Includehelp!"
  • (C) Hello ""Includehelp!""
  • (D) Hello \"Includehelp!\"
πŸ’¬ Discuss
βœ… Correct Answer: (D) Hello \"Includehelp!\"

Q. Which function converts a string of ASCII characters to hexadecimal values?

  • (A) bin2hex()
  • (B) str2hex()
  • (C) hex()
  • (D) str_hex()
πŸ’¬ Discuss
βœ… Correct Answer: (A) bin2hex()

Q. What will be the output of the following PHP code?

Code:
<?php
$str = "mcqbuddy";
echo pack("H*",bin2hex($str));
?>
  • (A) 496e636c75646568656c70
  • (B) mcqbuddy
  • (C) 496e636c75646568656c70mcqbuddy
  • (D) mcqbuddy496e636c75646568656c70
πŸ’¬ Discuss
βœ… Correct Answer: (B) mcqbuddy

Q. Which function is used to convert the ASCII value to the character?

  • (A) asc()
  • (B) str()
  • (C) char()
  • (D) chr()
πŸ’¬ Discuss
βœ… Correct Answer: (D) chr()