Q. Which one of the following functions will convert a string to all uppercase?

  • (A) struppercase()
  • (B) str_uppercase()
  • (C) uppercase()
  • (D) strtoupper()
πŸ’¬ Discuss
βœ… Correct Answer: (D) strtoupper()

Q. Say we have two compare two strings which of the following function/functions can you use?

  • (A) strcspn()
  • (B) strcmp()
  • (C) strcasecmp()
  • (D) All of above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of above

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

Code:
$cars = array("Datsun", "Jeep", "Lada", "Spyker");
$car = preg_grep("/^L/", $cars);
print_r($car);
?>
  • (A) Array ( [2] => Lada )
  • (B) Array ( [1] => Jeep )
  • (C) Array ( [0] => Datsun )
  • (D) Array ( [3] => Spyker )
πŸ’¬ Discuss
βœ… Correct Answer: (A) Array ( [2] => Lada )

Q. How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.

  • (A) 10
  • (B) 9
  • (C) 8
  • (D) 7
πŸ’¬ Discuss
βœ… Correct Answer: (C) 8

Q. Which among the following is/are not a metacharacter?

  • (A) \B
  • (B) \a
  • (C) \A
  • (D) \b
πŸ’¬ Discuss
βœ… Correct Answer: (B) \a

Q. Which of the following would be a potential match for the Perl-based regular expression /fo{2,4}/ ?

  • (A) fooool
  • (B) fol
  • (C) fool
  • (D) fool and fooool both
πŸ’¬ Discuss
βœ… Correct Answer: (D) fool and fooool both

Q. POSIX stands for

  • (A) Portative Operating System Interface for Unix
  • (B) Portative Operating System Interface for Linux
  • (C) Portable Operating System Interface for Linux
  • (D) Portable Operating System Interface for Unix
πŸ’¬ Discuss
βœ… Correct Answer: (D) Portable Operating System Interface for Unix

Q. POSIX implementation was deprecated in which version of PHP?

  • (A) PHP 5.3
  • (B) PHP 5.2
  • (C) PHP 5
  • (D) PHP 4
πŸ’¬ Discuss
βœ… Correct Answer: (A) PHP 5.3

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

Code:
$name = "ruCHiSharma";
if (ereg("([^a-z])",$name))
echo "Name must be all lowercase!";
else
echo "Name is all lowercase!";
?>
  • (A) Name is all lowercase!
  • (B) No Output is returned
  • (C) Name must be all lowercase!
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) Name must be all lowercase!

Q. How many functions does PHP offer for searching strings using POSIX style regular expression?

  • (A) 10
  • (B) 9
  • (C) 8
  • (D) 7
πŸ’¬ Discuss
βœ… Correct Answer: (D) 7