ExamVeda
Login
Home
31
Which one of the following keyword is used to implement an interface?
Discuss
Answer & Solution
Answer: Option D
Solution:
A class can implement an interface using the implements keyword in its declaration.
32
Which version of PHP introduced the concept called late static binding?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
33
Which one of the following methods in the exception class, is used to get a nested exception object?
Discuss
Answer & Solution
Answer: Option A
Solution:
getCode() – Get the code integer that was passed to the constructor. getFile() – Get the file in which the exception was generated. getLine() – Get the line number at which the exception was generated.
34
Which one of the following keyword is used in conjunction with an Exception object?
Discuss
Answer & Solution
Answer: Option C
Solution:
The throw keyword is used in conjunction with an Exception object. It halts execution of the current method and passes responsibility for handling the error back to the calling code.
35
Which keyword is used to put a stop on inheritance?
Discuss
Answer & Solution
Answer: Option D
Solution:
A final class cannot be subclassed.
36
PHP provides built-in interceptor methods, which can intercept messages sent to undefined methods and properties. This is also known as _________
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
37
Which one of the following method is invoked when a value is assigned to an undefined property?
Discuss
Answer & Solution
Answer: Option B
Solution:
The __set() method is invoked when client code attempts to assign to an undefined property. It is passed two arguments: the name of the property, and the value the client is attempting to set.
38
Which one of the following method is invoked when an undefined method is called by client code?
Discuss
Answer & Solution
Answer: Option D
Solution:
The __call() method is probably the most useful of all the interceptor methods. The __call() method can be useful for delegation. Delegation is the mechanism by which one object passes method invocations on to a second.
39
Which method introduced in PHP 5, is invoked just before an object is garbage collected?
Discuss
Answer & Solution
Answer: Option C
Solution:
You can use this method to perform any final cleaning up that might be necessary. Imagine, for example, a class that saves itself to a database when so ordered. I could use the __destruct() method to ensure that an instance saves its data when it is deleted.
40
Which one of the following statements is true ?
class CopyMe {}
$first = new CopyMe();
$second = $first;
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board