141. Which PHP extension is used for microservices communication via gRPC?
- a) grpc
- b) protobuf
- c) soap
- d) thrift
Answer: A - The gRPC PHP extension provides high-performance RPC framework support.
142. What is the purpose of PHP's APCu caching?
- a) Userland caching (opcode/data)
- b) Database query caching
- c) HTTP response caching
- d) Distributed caching
Answer: A - APCu caches data in shared memory (successor to APC's user cache).
143. Which tool profiles PHP performance at the function level?
- a) XHProf
- b) Blackfire
- c) OPcache
- d) Both A and B
Answer: D - Both XHProf and Blackfire provide detailed call graphs and metrics.
144. What is the purpose of circuit breakers in microservices?
- a) Prevents cascading failures
- b) Encrypts service communication
- c) Load balances requests
- d) Monitors performance metrics
Answer: A - Stops calling a failing service after threshold failures (e.g., using Symfony's HttpClient).
145. Which PHP function measures memory peak usage?
- a) memory_get_peak_usage()
- b) memory_get_highest()
- c) peak_memory()
- d) get_memory_peak()
Answer: A - Returns maximum memory used during script execution.
146. What is the purpose of Redis in PHP applications?
- a) In-memory data structure store
- b) Session storage
- c) Queue implementation
- d) All of the above
Answer: D - Redis serves as cache, session handler, and queue broker.
147. Which PHP framework is designed specifically for microservices?
- a) Lumen
- b) Slim
- c) Mezzio
- d) All of the above
Answer: D - All are lightweight frameworks suitable for microservices.
148. What is the purpose of PHP's JIT compiler in OPcache?
- a) Compiles hot code paths to machine code
- b) Minifies PHP scripts
- c) Precompiles all scripts
- d) Optimizes database queries
Answer: A - Just-In-Time compilation improves CPU-bound performance (PHP 8+).
149. Which header enables HTTP/2 server push in PHP?
- a) Link (with rel=preload)
- b) HTTP2-Push
- c) Push-Assets
- d) X-Accel-Push
Answer: A - Link: ; rel=preload hints resources to push.
150. What is the purpose of message queues in PHP?
- a) Asynchronous task processing
- b) Decoupling services
- c) Rate limiting
- d) All of the above
Answer: D - Queues (RabbitMQ, SQS) handle background jobs and inter-service communication.
151. Which tool analyzes PHP memory leaks?
- a) Valgrind
- b) Xdebug
- c) PHP's garbage collector
- d) Both A and B
Answer: D - Valgrind (system-level) and Xdebug (PHP-level) help diagnose leaks.
152. What is the purpose of PHP-FPM's process manager?
- a) Manages worker processes
- b) Load balances requests
- c) Both A and B
- d) Compiles PHP scripts
Answer: C - Controls process spawning and request distribution.
153. Which caching strategy invalidates cache when data changes?
- a) Write-through
- b) Cache-aside
- c) Read-through
- d) All of the above
Answer: D - All strategies can implement cache invalidation properly.
154. What is the purpose of OpenTelemetry in PHP?
- a) Distributed tracing
- b) Metrics collection
- c) Both A and B
- d) Error logging
Answer: C - Standardized observability for microservices (replaces OpenTracing/Zipkin).
155. Which PHP function serializes data for storage?
- a) serialize()
- b) json_encode()
- c) igbinary_serialize()
- d) All of the above
Answer: D - All convert data to storable formats (with different tradeoffs).
156. What is the purpose of PHP's preloading?
- a) Loads classes into shared memory at startup
- b) Prefetches database results
- c) Compiles templates in advance
- d) Caches configuration files
Answer: A - Preloading (PHP 7.4+) reduces autoloading overhead for frequently used classes.
157. Which tool visualizes PHP dependency graphs?
- a) DePHPend
- b) PHPMD
- c) PHPStan
- d) Psalm
Answer: A - DePHPend analyzes and visualizes class/method dependencies.
158. What is the purpose of connection pooling in database access?
- a) Reuses existing connections
- b) Reduces authentication overhead
- c) Both A and B
- d) Load balances read queries
Answer: C - Maintains reusable connections to avoid repeated setup/teardown.
159. Which PHP extension provides concurrent HTTP requests?
- a) curl_multi
- b) Swoole
- c) Guzzle Async
- d) All of the above
Answer: D - All enable parallel HTTP requests (different implementations).
160. What is the purpose of PHP's garbage collector?
- a) Reclaims memory from circular references
- b) Optimizes opcode cache
- c) Clears expired sessions
- d) Compacts memory fragments
Answer: A - PHP's GC specifically handles circular reference memory leaks.