bidezones.com /PHP/PHP Mcq Basics of Object-Oriented PHP Sample Test,Sample questions

Question:
 If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?

1.Normal class

2.Static class

3.Abstract class

4.Interface

Posted Date:-2022-02-16 13:17:31


Question:
 The practice of separating the user from the true inner workings of an application through well-known interfaces is known as _________

1.Polymorphism

2.Inheritance

3.Encapsulation

4.Abstraction

Posted Date:-2022-02-16 12:47:57


Question:
 Which version of PHP introduced the instanceof keyword?

1.PHP 4

2.PHP 5

3.PHP 5.3

4.PHP 6

Posted Date:-2022-02-16 13:02:36


Question:
. In the following PHP code, what is/are the properties?

    <?php
    class Example 
    {
        public $name;
        function Sample()
        {
            echo "This is an example";
        }
    } 
    ?>

1.echo “This is an example”;

2. public $name;

3.class Example

4.function sample()

Posted Date:-2022-02-16 13:07:41


Question:
. Which of the following method scopes is/are not supported by PHP?

i) private
ii) friendly
iii) static
iv) abstract

1.Only ii)

2.Only iv)

3.ii) and iv)

4.Only i)

Posted Date:-2022-02-16 12:55:56


Question:
PHP recognizes constructors by the name _________

1.classname()

2._construct()

3.function _construct()

4.function __construct()

Posted Date:-2022-02-16 13:01:54


Question:
The practice of creating objects based on predefined classes is often referred to as ______________

1.class creation

2.object creation

3.object instantiation

4.class instantiation

Posted Date:-2022-02-16 12:49:18


Question:
Which feature allows us to call more than one method or function of the class in single instruction?

1.Typecasting

2.Method Including

3.Method adding

4.Method chaining

Posted Date:-2022-02-16 13:19:22


Question:
Which keyword is used to refer to properties or methods within the class itself?

1.private

2.public

3.protected

4.$this

Posted Date:-2022-02-16 13:08:26


Question:
Which magic method is used to implement overloading in PHP?

1.__call

2.__invoke

3.__wakeup

4.__unset

Posted Date:-2022-02-16 13:20:21


Question:
Which method is used to tweak an object’s cloning behavior?

1.clone()

2.__clone()

3._clone

4. object_clone()

Posted Date:-2022-02-16 13:18:39


Question:
Which of the following advanced OOP features is/are not supported by PHP?

1.Method overloading

2.Multiple Inheritance

3.Namespaces

4.Object Cloning

Posted Date:-2022-02-16 13:13:57


Question:
Which of the following is/are the right way to declare a method?

i) function functionName() { function body }
ii) scope function functionName() { function body }
iii) method methodName() { method body }
iv) scope method methodName() { method body }

1.Only ii)

2. Only iv)

3.i) and ii)

4. iii) and iv)

Posted Date:-2022-02-16 12:53:59


Question:
Which of the following is/are true for an abstract class?
i) Abstract classes in PHP are declared with the help of abstract keyword.
ii) A class is declare abstract by using the keyword implements.
iii) It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.
iv) Attempting to instantiate an abstract class results in an error.

1.Only i)

2.Only iii)

3.ii) and iv)

4. ii), iii) and iv)

Posted Date:-2022-02-16 13:16:22


Question:
Which of the following statements is/are true about Constructors in PHP?

i) PHP 4 introduced class constructors.
ii) Constructors can accept parameters.
iii) Constructors can call class methods or other functions.
iv) Class constructors can call on other constructors.

1.ii)

2. ii) and iii)

3.i), ii), iii) and iv)

4. ii), iii) and iv)

Posted Date:-2022-02-16 13:00:46


Question:
Which of the following term originates from the Greek language that means “having multiple forms,” defines OOP’s ability to redefine, a class’s characteristics?

1.Abstraction

2.Polymorphism

3.Inheritance

4.Differential

Posted Date:-2022-02-16 12:48:32


Question:
Which one of the following can be used to instantiate an object in PHP assuming class name to be Foo?

1. $obj = new $foo;

2.$obj = new foo;

3. $obj = new foo ();

4.obj = new foo ();

Posted Date:-2022-02-16 12:49:56


Question:
Which one of the following functions is used to determine object type?

1.obj_type()

2. type()

3.is_a()

4.is_obj()

Posted Date:-2022-02-16 13:04:44


Question:
Which one of the following functions is used to determine whether a class exists?

1.exist()

2.exist_class()

3.class_exist()

4.__exist()

Posted Date:-2022-02-16 13:03:53


Question:
Which one of the following is the right way to call a class constant, given that the class is mathFunction?

1.echo PI;

2. echo mathFunction->PI;

3.echo mathFunction::PI;

4.echo mathFunction=PI;

Posted Date:-2022-02-16 12:53:18


Question:
Which one of the following is the right way to clone an object?

1._clone(targetObject);

2.destinationObject = clone targetObject;

3.destinationObject = _clone(targetObject);

4.destinationObject = clone(targetObject);

Posted Date:-2022-02-16 13:15:12


Question:
Which one of the following is the right way to define a constant?

1.constant PI = “3.1415”;

2.const $PI = “3.1415”;

3.constant PI = ‘3.1415’;

4.const PI = ‘3.1415’;

Posted Date:-2022-02-16 12:52:24


Question:
Which one of the following keyword is used to inherit our subclass into a superclass?

1.extends

2.implements

3.inherit

4.include

Posted Date:-2022-02-16 13:06:22


More MCQS[bidezones.com ]

  1. PHP Mcq Set 1
  2. PHP Mcq Set 2
  3. PHP Mcq Set 3
  4. PHP Mcq Set 4
  5. Current affairs mcq php
  6. Current affairs mcq php set 2
  7. Current affairs mcq php set 3
  8. PHP MCQ
  9. PHP MCQ Basics
  10. PHP Mcq Functions
  11. PHP Mcq Arrays
  12. PHP Mcq Basics of Object-Oriented PHP
  13. PHP Mcq Error Handling
  14. PHP Basics Mcq Questions