15 Namespaces & Autoloading questions from the PHP bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.
Free to start: the 2-minute IT readiness check — six questions and a result.
A.the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading
B.the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
C.a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources
D.a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier
Answer + AI explanation with Pro
2. Which term means: "a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources"?
Junior
A.use statement
B.PSR-4
C.Namespace
D.Composer autoloader
Answer + AI explanation with Pro
3. Which statement is correct?
Junior
A.Namespace — the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
B.Namespace — the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings
C.Namespace — a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier
D.Namespace — a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources
Answer + AI explanation with Pro
4. What is use statement?
Junior
A.the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
B.the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings
C.the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading
D.a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier
Answer + AI explanation with Pro
5. Which term means: "a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier"?
Junior
A.PSR-4
B.spl_autoload_register
C.use statement
D.Composer autoloader
Answer + AI explanation with Pro
6. Which statement is correct?
Junior
A.use statement — the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
B.use statement — the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings
C.use statement — a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources
D.use statement — a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier
Answer + AI explanation with Pro
7. What is PSR-4?
Mid
A.the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
B.the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings
C.the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading
D.a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier
Answer + AI explanation with Pro
8. Which term means: "the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading"?
Mid
A.Composer autoloader
B.use statement
C.spl_autoload_register
D.PSR-4
Answer + AI explanation with Pro
9. Which statement is correct?
Mid
A.PSR-4 — a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources
B.PSR-4 — the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
C.PSR-4 — the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings
D.PSR-4 — the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading
Answer + AI explanation with Pro
10. What is Composer autoloader?
Mid
A.the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings
B.the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
C.a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier
D.the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading
Answer + AI explanation with Pro
11. Which term means: "the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings"?
Mid
A.PSR-4
B.use statement
C.spl_autoload_register
D.Composer autoloader
Answer + AI explanation with Pro
12. Which statement is correct?
Mid
A.Composer autoloader — a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier
B.Composer autoloader — the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading
C.Composer autoloader — the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings
D.Composer autoloader — a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources
Answer + AI explanation with Pro
13. What is spl_autoload_register?
Senior
A.the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading
B.a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources
C.the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
D.the generated file, included once at bootstrap, that registers handlers to load class files on demand based on their namespace and the project's mappings
Answer + AI explanation with Pro
14. Which term means: "the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading"?
Senior
A.use statement
B.Namespace
C.spl_autoload_register
D.Composer autoloader
Answer + AI explanation with Pro
15. Which statement is correct?
Senior
A.spl_autoload_register — the standard that maps a namespace prefix to a base directory so a fully qualified class name translates directly into a file path for autoloading
B.spl_autoload_register — a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources
C.spl_autoload_register — a declaration that imports a namespaced name into the current file, optionally aliasing it so it can be referred to by a shorter identifier
D.spl_autoload_register — the function that adds a callback to a queue invoked automatically whenever a referenced class has not yet been defined, enabling lazy class loading
Answer + AI explanation with Pro
Free to start
Start with a free readiness check
Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Namespaces & Autoloading question come with Pro.