Home > PHP & Programming > Quizzes > Practice Test: Namespaces In PHP
Practice Test: Namespaces In PHP
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 88% Most missed: “The … constant is useful for dynamically constructing names.”
Practice Test: Namespaces In PHP
Time left 00:00
18 Questions

1. … are not allowed in namespace declarations, because such constructs are interpreted as relative namespaces expressions.
2. Which of the following are the kinds of aliasing or importing used in PHP.
i) aliasing a class name.
ii) aliasing an interface name.
iii) aliasing a namespace name.
3. For …, if no import rule applies and the name refers to a class-like symbol, the current namespace is prepended.
4. For the namespace used on PHP … is an identifier with a namespace separator.
5. For the namespace used on PHP … is an identifier without a namespace separator.
6. … is an identifier with a namespace separator that begins with a namespace separator.
7. Which of the following statements about name resolution rules are TRUE.
i) Fully qualified names always resolve to the name without leading namespace separator.
ii) Relative names always resolve to the name with namespace replaced by the current namespace.
8. Which of the following are the kinds of aliasing or importing used in PHP.
i) aliasing a class name.
ii) aliasing an interface name.
iii) aliasing a namespace name.
9. The … constant is useful for dynamically constructing names.
10. For …, if no import rule applies and the name refers to a function or constant and the code is outside the global namespace.
11. Which of the following statements about namespaces are TRUE.
i) Multiple namespaces may be declared in the same file.
ii) PHP code may exist outside of the namespace brackets except for an opening declare statement.
iii) Classes, functions, and constants being imported from the same namespace can be grouped together in a single-use statement.
12. State whether the following statements are TRUE or FALSE.
i) PHP namespaces also contain the ability to specify a hierarchy of namespace names.
ii) The same namespace may be defined in multiple files.
13. Which of the following types of code are affected by namespaces.
i) Classes
ii) Interfaces
iii) Functions
iv) Constants
14. In PHP, aliasing is accomplished with the … operator.
15. For …, if no import rule applies, the current namespace is prepended to the name.
16. In PHP, aliasing is accomplished with the … operator.
17. Which of the following types of code are affected by namespaces.
i) Classes
ii) Interfaces
iii) Functions
iv) Constants
18. For the namespace used on PHP … is an identifier without a namespace separator.