Home > PHP & Programming > Quizzes > PHP Programming Basics Practice Test: Object Tools and Design and Variables in PHP
PHP Programming Basics Practice Test: Object Tools and Design and Variables in PHP
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 0% Most missed: “What will be the output of the following PHP code?”
Quiz questions on object tools and their design and variables and their syntax. In PHP, objects are compound data types that can store data and functions together in a single variable. Objects can be instances of either a built-in or user defined class. A class is a blueprint for creating objects with specific properties and methods. For example, a class called Car can create objects such as Mercedes, BMW, and Skoda.  Here are some basic concepts of object-oriented programming (OOP) in PHP: Class: A blueprint that holds objects along with their behavior and properties Data Members:... Show more
PHP Programming Basics Practice Test: Object Tools and Design and Variables in PHP
Time left 00:00
25 Questions

1. What will be the output of the following PHP code?
$color = red;
echo "\$color";
?>
2. What will be the output of the following PHP code?
$On_e = 1;
$tw_o = 2;
$thre_e = 3;
$fou_r = 4;
echo $on_e / $tw_o + $thre_e / $fou_r;
?>
3. What will be the output of the following PHP code?
echo "echo "Hello World"";
?>
4. What will be the output of the following PHP code?
$color1 = "red";
$color2 = "1";
echo "$color1" + "$color2";
?>
5. A package is a set of related _________
6. What will be the output of the following PHP code?
$x = 4;
$y = 3;
function fun($x, $y)
{
$z = $x + $y / $y + $x;
echo "$z";
}
echo $x;
echo $y;
echo $z;
fun(3, 4);
?>
7. What will be the output of the following PHP code?
$color1 = red;
$color2 = green;
echo "$color1"."$color2";
?>
8. Till which version of PHP, developers were forced to name their files in a global context?
9. What will be the output of the following PHP code?
$on$e = 1;
$tw$o = 2;
$thre$e = 3;
$fou$r = 4;
echo "$on$e / $tw$o + $thre$e / $fou$r";
?>
10. In a class diagram the class is divided into three sections, what is displayed in the first section?
11. What will be the output of the following PHP code?
echo "Hello World"
?>
12. What will be the output of the following PHP code?
$hello = "Hello World";
$bye = "Bye";
echo $hello;"$bye";
?>
13. What will be the output of the following PHP code?
$x = 4;
$y = 3
$z = 1;
$z = $z + $x + $y;
echo "$z";
?>
14. Object-oriented code tries to minimize dependencies by moving responsibility for handling tasks away from ___ and toward the objects in the system.
15. What will be the output of the following PHP code?
$x = 4;
$y = 3;
$z = 1;
echo "$x = $x + $y + $z";
?>
16. PHP 4 did not support instanceof. Instead, which function did it provide?
17. Which function was introduced to help automate the inclusion of class files?
18. What will be the output of the following PHP code?
$color1 = "red";
$color2 = "1";
$color3 = "grey"
echo "$color1" + "$color2" . "$color3";
?>
19. Which one of the following is displayed in the third section of the class diagram?
20. What will be the output of the following PHP code?
$on_e = 1;
$tw_o = 2;
$thre_e = 3;
$fou_r = 4;
echo $on_e / $tw_o + $thre_e / $fou_r;
?>
21. What will be the output of the following PHP code?
$x = 10;
$y = 4;
$z = 3;
echo ($x % ($y) + $z);
?>
22. If the diamond is filled it depicts which relationship?
23. Placing a static method for generating ________ objects in the ____________ class is convenient.
24. What will be the output of the following PHP code?
echo $red;
?>
25. Which one of the following is displayed below the class name in the class diagrams?