31.
What will be the output of the following PHP code ?
<?php
$one = "one";
$two = "two";
print("$one$two");
?>

32.
What will be the output of the following PHP code ?
<?php
$one = "one";
$two = "two";
print($one==$two);
?>

33.
What will be the output of the following PHP code ?
<?php
$one = "one";
$two = "one";
print($one == $two);
?>

34.
What will be the output of the following PHP code ?
<?php
print("this"."was"."a"."bad"."idea");
?>

35.
What will be the output of the following PHP code ?
<?php
define("GREETING", "PHP is a scripting language");
echo $GREETING;
?>

36.
What will be the output of the following PHP code ?
<?php
class Constants
{
    define('MIN_VALUE', '0.0');  
    define('MAX_VALUE', '1.0');  
    public static function getMinValue()
    {
        return self::MIN_VALUE;
    }
    public static function getMaxValue()
    {
        return self::MAX_VALUE;
    }
}
echo Constants::getMinValue();
echo Constants::getMaxValue();
?>

37.
What will be the output of the following PHP code ?
<?php
define("__LINE__", "PHP is a scripting language");
echo __LINE__;
?>

38.
What will be the output of the following PHP code ?
<?php
define('IF', 42); 
echo "IF: ", IF;
?>

39.
What will be the output of the following PHP code ?
<?php
define("NEW_GOOD_NAME_CONSTANT", "I have a value");
define("OLD_BAD_NAME_CONSTANT", NEW_GOOD_NAME_CONSTANT);
 
echo NEW_GOOD_NAME_CONSTANT;
echo OLD_BAD_NAME_CONSTANT; 
?>

40.
What will be the output of the following PHP code ?
<?php
define("VAR_NAME","test"); 
${VAR_NAME} = "value"; 
echo VAR_NAME;
echo ${VAR_NAME}; 
?>

Read More Section(Operators and Expressions in php)

Each Section contains maximum 100 MCQs question on Operators and Expressions in php. To get more questions visit other sections.