PHP - MCQ Questions and Answers

Test your knowledge of PHP with these interactive multiple-choice questions.

« First 7 8 9 10 Last »
« Previous Page Next Page »

161. Which AWS SDK method uploads files to S3 in PHP?

  • a) putObject()
  • b) uploadFile()
  • c) sendToS3()
  • d) storeObject()
Answer: A - $s3->putObject([...]) is the standard S3 upload method.

162. What is the purpose of GitHub Actions for PHP projects?

  • a) Automated testing
  • b) Deployment pipelines
  • c) Dependency updates
  • d) All of the above
Answer: D - GitHub Actions automates CI/CD workflows for PHP.

163. Which Docker directive optimizes PHP-FPM images?

  • a) COPY --chown=www-data
  • b) RUN docker-php-ext-install
  • c) FROM php:fpm-alpine
  • d) All of the above
Answer: D - All contribute to optimized PHP-FPM containers.

164. What is the purpose of PHP's pcov extension?

  • a) Code coverage reporting
  • b) Performance profiling
  • c) Parallel execution
  • d) Vulnerability scanning
Answer: A - pcov is a faster alternative to Xdebug for code coverage.

165. Which Azure service runs PHP serverless functions?

  • a) Azure Functions
  • b) App Service
  • c) Container Instances
  • d) Kubernetes Service
Answer: A - Azure Functions supports PHP runtime for event-driven code.

166. What is the purpose of PHPStan in CI pipelines?

  • a) Static code analysis
  • b) Unit test execution
  • c) Performance benchmarking
  • d) Dependency auditing
Answer: A - PHPStan finds bugs without running code (static analysis).

167. Which GCP service stores PHP session data?

  • a) Cloud Memorystore
  • b) Firestore
  • c) Cloud SQL
  • d) All of the above
Answer: D - All can store sessions (Memorystore/Redis recommended).

168. What is the purpose of PHPMD in development?

  • a) Detects code smells
  • b) Measures test coverage
  • c) Optimizes database queries
  • d) Formats code style
Answer: A - PHPMD (PHP Mess Detector) identifies potential code issues.

169. Which Kubernetes resource deploys PHP applications?

  • a) Deployment
  • b) Pod
  • c) Service
  • d) All of the above
Answer: D - Pods run containers, Deployments manage pods, Services expose them.

170. What is the purpose of Psalm in PHP projects?

  • a) Static type checking
  • b) Security scanning
  • c) Documentation generation
  • d) Performance tuning
Answer: A - Psalm analyzes type correctness (like TypeScript for PHP).

171. Which GitLab CI directive caches Composer dependencies?

  • a) cache:paths
  • b) artifacts:paths
  • c) variables:COMPOSER_CACHE_DIR
  • d) Both A and C
Answer: D - Caching vendor/ and COMPOSER_CACHE_DIR speeds up builds.

172. What is the purpose of PHP's assert() function in debugging?

  • a) Checks assumptions during development
  • b) Validates user input
  • c) Measures execution time
  • d) Tests database connections
Answer: A - assert() verifies internal invariants (disabled in production).

173. Which Heroku buildpack deploys PHP applications?

  • a) heroku/php
  • b) heroku/apache
  • c) heroku/composer
  • d) heroku/web
Answer: A - The official PHP buildpack handles web/dyno configuration.

174. What is the purpose of PHP's debug_backtrace()?

  • a) Inspects call stack
  • b) Measures memory usage
  • c) Lists defined functions
  • d) Dumps global variables
Answer: A - Returns array of current call stack frames for debugging.

175. Which Terraform resource provisions PHP cloud infrastructure?

  • a) aws_lambda_function
  • b) google_cloud_run_service
  • c) azurerm_app_service
  • d) All of the above
Answer: D - All can deploy PHP apps on respective clouds.

176. What is the purpose of PHP's xdebug_get_function_stack()?

  • a) Returns detailed call trace
  • b) Lists all available functions
  • c) Measures function execution time
  • d) Counts stack frames
Answer: A - Provides richer stack info than debug_backtrace().

177. Which Jenkins plugin tests PHP projects?

  • a) PHPUnit Plugin
  • b) HTML Publisher
  • c) Xdebug Plugin
  • d) All of the above
Answer: D - All support PHP testing pipelines (results, coverage, etc.).

178. What is the purpose of PHP's error_log() in debugging?

  • a) Sends errors to system log
  • b) Emails error messages
  • c) Writes to custom file
  • d) All of the above
Answer: D - error_log() supports multiple logging destinations.

179. Which VSCode extension debugs PHP applications?

  • a) PHP Debug
  • b) Xdebug
  • c) PHP Intelephense
  • d) Both A and B
Answer: D - PHP Debug (Felix Becker) integrates Xdebug with VSCode.

180. What is the purpose of PHP's register_tick_function()?

  • a) Executes function on each tick
  • b) Measures script ticks
  • c) Registers error handlers
  • d) Counts function calls
Answer: A - Runs callback on each tick (declare(ticks=N) for low-level debugging.
« First 7 8 9 10 Last »
« Previous Page Next Page »

Learn Computer Skills with PCBooks

Master computer skills with PCBooks! Explore interactive tutorials, MCQ tests, and online exams for programming, web development, and IT fundamentals. Perfect for beginners and advanced learners.

Online MCQ Tests for Programming

Practice programming MCQ questions and improve your coding skills with our online quizzes. Whether you're learning Python, Java, or C programming, PCBooks has you covered.

Free Web Development Tutorials

Learn HTML, CSS, and JavaScript with our free web development tutorials. Test your knowledge with interactive quizzes and online exams.