ExamVeda
Login
Home
21
What does PDO stand for?
Discuss
Answer & Solution
Answer: Option D
Solution:
The PDO class provides a common interface to different database applications.
22
Which version of PHP allows you to define constant properties within a class?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
23
Which keyword is used to declare a constant property?
Discuss
Answer & Solution
Answer: Option A
Solution:
A constant property is declared with the const keyword. Like global constants, class constants cannot be changed once they are set.
24
Which one of the following is a constant variable?
Discuss
Answer & Solution
Answer: Option D
Solution:
Constants are not prefixed with a dollar sign like regular properties. By convention, they are often named using only uppercase characters
25
What will happen if you try to set a value to a constant once it has been declared?
Discuss
Answer & Solution
Answer: Option C
Solution:
You should use constants when your property needs to be available across all instances of a class, and when the property value needs to be fixed and unchanging.
26
How many of the following can be contained in constants? 1. boolean 2. integer 3. float 4. string
Discuss
Answer & Solution
Answer: Option D
Solution:
All scalar data i.e boolean, integer, float and string can be contained in constants.
27
Which one of the following class can not be instantiated?
Discuss
Answer & Solution
Answer: Option B
Solution:
An abstract class cannot be instantiated. Instead it defines (and, optionally, partially implements) the interface for any class that might extend it.
28
Which one of the following keywords is used to define an abstract class?
Discuss
Answer & Solution
Answer: Option C
Solution:
The introduction of abstract classes was one of the major changes ushered in with PHP 5. Its inclusion in the list of new features was another sign of PHP’s extended commitment to object-oriented design.
29
Which one of the following is the correct abstract method?
Discuss
Answer & Solution
Answer: Option D
Solution:
An abstract method cannot have an implementation. You declare it in the normal way, but end the declaration with a semicolon rather than a method body.
30
Atleast how many abstract methods must an abstract class contain?
Discuss
Answer & Solution
Answer: Option B
Solution:
Classes defined as abstract may not be instantiated, and any class that contains at least one abstract method must also be abstract.