ExamVeda
Login
Home
51
Which one of the following is the right way to define a constant?
Discuss
Answer & Solution
Answer: Option D
Solution:
Class constants are created like: const NAME = ‘VALUE’;
52
Which one of the following is the right way to call a class constant, given that the class is mathFunction?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
53
Which one of the following is the right way to invoke a method?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
54
Which of the following is/are the right way to declare a method?
1. function functionName() { function body }
2. scope function functionName() { function body }
3. method methodName() { method body }
4. scope method methodName() { method body }
Discuss
Answer & Solution
Answer: Option C
Solution:
In case of public methods, you can forgo explicitly declaring the scope and just declare the method like you would a function.
55
Which of the following method scopes is/are not supported by PHP?
1. private
2. final
3. static
4 abstract
Discuss
Answer & Solution
Answer: Option D
Solution:
PHP supports six method scopes: public, private, final, static, protected and abstract.
56
Which method scope prevents a method from being overridden by a subclass?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
57
Which of the following statements is/are true about Constructors in PHP?
1. PHP 4 introduced class constructors.
2. Constructors can accept parameters.
3. Constructors can call class methods or other functions.
4. Class constructors can call on other constructors.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
58
PHP recognizes constructors by the name_________
Discuss
Answer & Solution
Answer: Option D
Solution:
A double underscore followed by the construct keyword. Its syntax is function __construct ([ argument1, argument2,…..]) { Class Initialization code }.
59
Which version of PHP introduced the instanceof keyword?
Discuss
Answer & Solution
Answer: Option B
Solution:
Using instanceof keyword we can determine whether an object is an instance of a class. $manager = new Employee() … if ($manager instanceof Employee) echo “True”;
60
Which one of the following functions is used to determine whether a class exists?
Discuss
Answer & Solution
Answer: Option C
Solution:
The class_exist() function returns true or false according to whether the class exists within the currently executing script content.