Vidyalelo
PHP · all questions

Object Oriented Concept
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

141

Questions

7/8

Page

Pick an option on a question to see the right answer and solution.

The pseudo-variable ...... is available inside any class method when that method is called from within an object context.

Select an option to see the answer and solution.

A class may contain its own .............

Select an option to see the answer and solution.

Child classes are defined using the keyword .....

Select an option to see the answer and solution.

In PHP, the difference between double quote and single quote is that variables . . . . in single quoted strings whereas they . . . . . in double quoted strings.

Select an option to see the answer and solution.

PHP strings are binary-safe (i.e. they can contain null bytes) . Their size is limited only by the amount of memory that is available to PHP.

Select an option to see the answer and solution.

What is the output of below statement?
Print substr (‘watch out for that tree’,20,5);

Select an option to see the answer and solution.

What is the value of var?
$var = 'HELLO WORLD!';
var);

Select an option to see the answer and solution.

The functions strtolower() and strtoupper() work on individual characters and not on entire strings.

Select an option to see the answer and solution.

Heredoc's are a great alternative to quoted strings because of increased readability and maintainability.

Select an option to see the answer and solution.

Which of the below is most useful for debugging:

Select an option to see the answer and solution.

What is the value of message?
$name = “John”;
name’;

Select an option to see the answer and solution.

The result of below statements will be:
$str = ""Hello fri3nd, you're
 feeling          happy today?”;
echo str_word_count($str);

Select an option to see the answer and solution.

PHP recognises constructors by the name . . . . .

Select an option to see the answer and solution.

In . . . . . constructors, it is important to remember that you have to call the parent constructor explicitly.

Select an option to see the answer and solution.

Constructor and destructor methods have no . . . . . . and are called automatically - they cannot be called explicitly and consequently their declarations need no access specifier. 

Select an option to see the answer and solution.

Unlike constructors, you cannot pass information to a destructor, because you are never sure when its going to be run.

Select an option to see the answer and solution.

You can invoke class constructors that don’t have any relation to the instantiated object by simply prefacing _constructor with the class name like.

Select an option to see the answer and solution.

 . . . . . . is a class which can only be instantiated once. You can effectively only have one object per . . . . . class in an application.

Select an option to see the answer and solution.

Even if you don’t delete the object yourself using . . . . . , PHP still calls the destructor when it determines that the object is no longer used.

Select an option to see the answer and solution.

You can overwrite a Singleton with the wrong kind of data. 

Select an option to see the answer and solution.