Q. [:alpha:] can also be specified as.

  • (A) [A-z].
  • (B) [A-Za-z0-9].
  • (C) [a-z].
  • (D) [A-za-z].
πŸ’¬ Discuss
βœ… Correct Answer: (D) [A-za-z].

Q. Which one of the following regular expression matches any string containing zero or one p?

  • (A) p*
  • (B) p+
  • (C) p#
  • (D) P?
πŸ’¬ Discuss
βœ… Correct Answer: (D) P?

Q. PHP has long supported two regular expression implementations known as _______ and _______.

  • (A) PEAR
  • (B) Perl
  • (C) POSIX
  • (D) Perl and POSIX both
πŸ’¬ Discuss
βœ… Correct Answer: (D) Perl and POSIX both

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

Code:
<?php
class newObject { }
define('newObject::CONSTANT', 'Example');
echo newObject::CONSTANT; 
?>
  • (A) Error
  • (B) Example
  • (C) CONSTANT
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (A) Error

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

Code:
<?php
define("STR_VAR","Ravinder"); 
${STR_VAR} = "Singh"; 
echo STR_VAR;
echo ${STR_VAR}; 
?>
  • (A) Ravinder
  • (B) RavinderSingh
  • (C) Error
  • (D) Singh
πŸ’¬ Discuss
βœ… Correct Answer: (B) RavinderSingh

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

Code:
<?php
define('OCTAL_NUM1', 0500);
define('OCTAL_NUM2', 0300);
print OCTAL_NUM1;
echo "\n";
print OCTAL_NUM2; 
?>
  • (A) 320
  • (B) Error
  • (C) 320 192
  • (D) 192
πŸ’¬ Discuss
βœ… Correct Answer: (C) 320 192

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

Code:
<?php
define("FIRST_NAME", "Ajit");
define("LAST_NAME", FIRST_NAME);
 
echo FIRST_NAME;
echo LAST_NAME; 
?>
  • (A) Nothing
  • (B) Ajit
  • (C) FIRST_NAME LAST_NAME
  • (D) AjitAjit
πŸ’¬ Discuss
βœ… Correct Answer: (D) AjitAjit

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

Code:
<?php
define('IF', 102); 
echo "IF: ", IF;
?>
  • (A) Error
  • (B) Nothing
  • (C) 102
  • (D) IF:102
πŸ’¬ Discuss
βœ… Correct Answer: (A) Error

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

Code:
<?php
define("__LINE__", "She is beautiful");
echo "\n";
echo __LINE__;
?>
  • (A) She is beautiful
  • (B) Error
  • (C) Nothing
  • (D) 4
πŸ’¬ Discuss
βœ… Correct Answer: (D) 4

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

Code:
<?php
class Constants
{
    define('MIN_VA', '10.10');  
    define('MAX_VAL', '20.20');  
    public static function getMin()
    {
        return self::MIN_VAL;
    }
    public static function getMax()
    {
        return self::MAX_VAL;
    }
}
echo Constants::getMin();
echo Constants::getMax();
?>
  • (A) Error
  • (B) 10.10
  • (C) 20.20
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (A) Error