15 real Namespaces & Autoloading questions from the PHP bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.
1. What is Namespace?
Junior
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
2. Which term means: "a named container that groups related classes, functions, and constants to prevent identifier collisions between code from different sources"?
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
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
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"?
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
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
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"?
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
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
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"?
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
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
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"?
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
Answers, AI explanations, and a scored voice mock interview
Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.