PHP Class MCQs
PHP Class MCQs : This section focuses on "Class" in PHP. These Multiple Choice Questions (mcq) should be practiced to improve the PHP skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. Classes are the _______ of objects.
View Answer
2. Class is a programmer-defined data type, which includes _____ methods and ______ variable?
View Answer
3. What will be the syntax of defining the class?
View Answer
4. We define our own class by starting with the keyword ______ ?
View Answer
5. Which of the following is the output of the below code?
<?php
class letsfindcourse
{
public function __construct(){
echo 'The class "' . __CLASS__ . '" was initiated!<br>';
}
}
$lfc = new letsfindcourse;
?>
View Answer
6. Which of the following is the output of the below code?
<?php
class letsfindcourse
{
public function __destruct(){
echo 'The class "' . __CLASS__ . '" was destroyed!';
}
}
$lfc = new letsfindcourse;
?>
View Answer
7. Which one of the following functions is used to determine whether a class exists?
View Answer
8. Which keyword is used to refer to properties or methods within the class itself?
View Answer
9. Which one of the following is the right way to call a class constant, given that the class is mathFunction?
View Answer
10. The class from which the child class inherits is called
(i) Child class
(ii) Parent class
(iii) Super class
(iv) Base class
View Answer
Also check :
Discussion