PHP Syntax
21. | Which of the following is used to execute a block of code at least once and repeatedly as long as a condition is true in PHP? |
---|
A. if statement
B. switch statement
C. for loop
D. do-while loop
View Answer Discuss Work SpaceAnswer: option d
Explanation:
do-while loop is used to execute a block of code at least once and repeatedly as long as a condition is true in PHP.
22. | Which of the following is used to select one of several blocks of code to be executed in PHP? |
---|
A. if statement
B. switch statement
C. for loop
D. while loop
View Answer Discuss Work SpaceAnswer: option b
Explanation:
switch statement is used to select one of several blocks of code to be executed in PHP.
23. | Which of the following is used to define a namespace in PHP? |
---|
A. namespace Namespace_name;
B. use Namespace_name;
C. define Namespace_name;
D. all of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
namespace Namespace_name; is used to define a namespace in PHP.
24. | Which of the following is used to import classes or namespaces into the current namespace in PHP? |
---|
A. namespace Namespace_name;
B. use Namespace_name;
C. define Namespace_name;
D. all of the above
View Answer Discuss Work SpaceAnswer: option b
Explanation:
use Namespace_name; is used to import classes or namespaces into the current namespace in PHP.
25. | Which of the following is used to define a constant in PHP? |
---|
A. define('Constant_name', 'value');
B. constant Constant_name = value;
C. Constant_name = value;
D. all of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
define('Constant_name', 'value'); is used to define a constant in PHP.