adplus-dvertising

Welcome to the Constants and Operators in PHP MCQs Page

Dive deep into the fascinating world of Constants and Operators in PHP with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Constants and Operators in PHP, a crucial aspect of PHP. In this section, you will encounter a diverse range of MCQs that cover various aspects of Constants and Operators in PHP, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within PHP.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Constants and Operators in PHP. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of PHP.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Constants and Operators in PHP. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Constants and Operators in PHP MCQs | Page 7 of 12

Q61.
What will be the output of the following PHP code ?
<?php
define("VAR_NAME","test"); 
${VAR_NAME} = "value"; 
echo VAR_NAME;
echo ${VAR_NAME}; 
?>
Discuss
Answer: (c).testvalue
Q62.
What will be the output of the following PHP code ?
<?php
class myObject { }
define('myObject::CONSTANT', 'test');
echo myObject::CONSTANT; 
?>
Discuss
Answer: (b).error
Q63.
What will be the output of the following PHP code ?
<?php
$a = 10;
echo ++$a;
echo $a++;
echo $a;
echo ++$a;
?>
Discuss
Answer: (a).11111213
Q64.
What will be the output of the following PHP code ?
<?php
$a = 12;
--$a;
echo $a++;
?>
Discuss
Answer: (a).11
Q65.
What will be the output of the following PHP code ?
<?php
$x = "test";
$y = "this";
$z = "also"; 
$x .= $y .= $z ;
echo $x;
echo $y;
?>
Discuss
Answer: (c).testthisalsothisalso
Q66.
What will be the output of the following PHP code ?
<?php
$x = 1;
$y = 2;
if (++$x == $y++)
{
    echo "true ", $y, $x;
}
?>
Discuss
Answer: (b).true 23
Q67.
What will be the output of the following PHP code ?
<?php
$y = 2;
$w = 4;
$y *= $w /= $y;
echo $y, $w;
?>
Discuss
Answer: (d).42
Q68.
What will be the output of the following PHP code ?
<?php
$y = 2;
if ($y-- == ++$y)
{
    echo $y;
}
?>
Discuss
Answer: (a).2
Q69.
What will be the output of the following PHP code ?
<?php
$y = 2;
if (**$y == 4)
{
    echo $y;
}
?>
Discuss
Answer: (c).error at line2
Q70.
What will be the output of the following PHP code ?
<?php
$y = 2;
if (--$y == 2 || $y xor --$y)
{
    echo $y;
}
?>
Discuss
Answer: (b).0

Suggested Topics

Are you eager to expand your knowledge beyond PHP? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!