Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 3 MCQs Microservices with Docker Compose

INT332 — Devops Virtualization And Configuration Management 60 questions. Pick an option to check it.

Read the notes

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Monolithic vs microservices Easy

    What is a primary characteristic of a monolithic application architecture?

  2. Question 2 of 60 Need for microservices Easy

    Why do modern applications often use a microservices architecture?

  3. Question 3 of 60 Advantages: scalability Easy

    How does microservices architecture improve scalability?

  4. Question 4 of 60 Advantages: isolation Easy

    What does fault isolation mean in the context of microservices?

  5. Question 5 of 60 API Gateway Easy

    What is the primary role of an API Gateway in a microservices architecture?

  6. Question 6 of 60 Docker Compose: YAML Structure Easy

    What file format is primarily used by Docker Compose for its configuration files?

  7. Question 7 of 60 Writing docker-compose.yml Easy

    What is the default filename Docker Compose looks for when you run the docker-compose up command?

  8. Question 8 of 60 version Easy

    What does the version field at the top of a docker-compose.yml file specify?

  9. Question 9 of 60 services Easy

    In a docker-compose.yml file, what does the services section define?

  10. Question 10 of 60 volumes Easy

    What is the purpose of defining volumes in Docker Compose?

  11. Question 11 of 60 networks Easy

    What is the function of the networks field in a docker-compose.yml file?

  12. Question 12 of 60 Environment variables Easy

    How do you pass configuration settings, like database passwords, to a container in Docker Compose?

  13. Question 13 of 60 Build vs image fields in YAML Easy

    What is the difference between the build and image directives in Docker Compose?

  14. Question 14 of 60 Service dependency ordering Easy

    Which Docker Compose keyword is used to express dependency between services, ensuring one starts before another?

  15. Question 15 of 60 Secrets and configs Easy

    In Docker Compose, what is the best practice for handling highly sensitive data like API keys or TLS certificates?

  16. Question 16 of 60 Multi-container apps (database + backend + frontend) Easy

    In a standard three-tier multi-container application, what does the backend container usually do?

  17. Question 17 of 60 WordPress + MySQL Easy

    When deploying a WordPress application using Docker Compose, which database is traditionally paired with it as a separate service?

  18. Question 18 of 60 Node.js + MongoDB Easy

    Why is MongoDB frequently paired with Node.js in multi-container deployments (the MEAN/MERN stack)?

  19. Question 19 of 60 Java Spring Boot + PostgreSQL Easy

    When using Docker Compose to deploy a Java Spring Boot backend, what kind of service is PostgreSQL?

  20. Question 20 of 60 Advantages: agility Easy

    How do microservices improve agility for development teams?

  21. Question 21 of 60 Monolithic vs microservices Medium

    An e-commerce application is experiencing high traffic exclusively on its payment processing module during a sale. How does a microservices architecture handle this more efficiently than a monolithic architecture?

  22. Question 22 of 60 API Gateway Medium

    In a microservices architecture involving a UI frontend and multiple backend services (e.g., users, orders, inventory), what is the primary role of an API Gateway?

  23. Question 23 of 60 Advantages: scalability, isolation, agility Medium

    A developer introduces a memory leak in the 'Reporting' microservice. Under a microservices architecture, how does the 'isolation' advantage prevent a system-wide outage?

  24. Question 24 of 60 version Medium

    When defining a docker-compose.yml file, what does the version field primarily dictate?

  25. Question 25 of 60 volumes Medium

    A PostgreSQL database container is destroyed and recreated using Docker Compose, resulting in complete data loss. Which configuration should be added to the docker-compose.yml to prevent this in the future?

  26. Question 26 of 60 Docker Compose: YAML Structure Medium

    Which of the following represents the correct hierarchical structure for defining a web service mapped to port 80 in docker-compose.yml?

  27. Question 27 of 60 Environment variables Medium

    If an environment variable DB_PASS is defined in an .env file, and simultaneously defined under the environment section of a service in docker-compose.yml with a different value, what will be the value inside the container?

  28. Question 28 of 60 networks Medium

    You have a frontend service and a backend service in docker-compose.yml. You want the backend to communicate with the database, but the frontend should NOT be able to reach the database. How can this be achieved?

  29. Question 29 of 60 Build vs image fields in YAML Medium

    In a docker-compose.yml, what happens if a service defines BOTH the build and image fields?

  30. Question 30 of 60 Service dependency ordering Medium

    A Node.js backend crashes upon startup because the MongoDB container it depends on is still initializing, even though depends_on: - mongo is used. What is the correct way to ensure the backend waits until MongoDB is fully ready to accept connections?

  31. Question 31 of 60 Secrets and configs Medium

    When passing highly sensitive data like an API token to a service in Docker Compose, why is using Docker Secrets generally preferred over standard environment variables?

  32. Question 32 of 60 WordPress + MySQL Medium

    When deploying a WordPress + MySQL stack using Docker Compose, how does the WordPress container know how to locate the MySQL database?

  33. Question 33 of 60 Node.js + MongoDB Medium

    A developer sets up a Node.js backend and a MongoDB database. The database service is named mongo_db. What should the Mongoose connection string look like in the Node.js application?

  34. Question 34 of 60 Java Spring Boot + PostgreSQL Medium

    In a Docker Compose deployment of a Spring Boot app and a PostgreSQL database, the Spring Boot application configuration (application.properties) has spring.datasource.url=jdbc:postgresql://postgres_server:5432/mydb. Which of the following MUST be true in docker-compose.yml for the connection to work?

  35. Question 35 of 60 Use Case Deployments: Multi-container apps (database + backend + frontend) Medium

    You are deploying a 3-tier application (React frontend, Express backend, PostgreSQL database) using Docker Compose. The React frontend runs in a user's browser. How should the frontend make API calls to the backend?

  36. Question 36 of 60 Writing docker-compose.yml Medium

    A developer writes the following snippet in docker-compose.yml:
    yaml
    ports:
    - 8080:80

    What does this mapping signify?

  37. Question 37 of 60 Microservices Architecture: Need for microservices Medium

    A legacy monolithic application uses a single relational database for all transactions. As the user base grows, database locks cause widespread performance issues. How does a microservices architecture address this specific 'Need for microservices'?

  38. Question 38 of 60 Service dependency ordering Medium

    If Service A depends on Service B in a docker-compose.yml file, what happens when you execute docker-compose stop Service B?

  39. Question 39 of 60 Environment variables Medium

    A developer wants to keep database credentials out of the docker-compose.yml file tracked in Git. They place the credentials in an .env file. What is a crucial best practice regarding this .env file?

  40. Question 40 of 60 Docker Compose: YAML Structure Medium

    Consider the volumes configuration in a Docker Compose service:
    yaml
    volumes:
    - mydata:/var/lib/mysql

    Where must mydata be defined for this configuration to be completely valid at the file level?

  41. Question 41 of 60 Monolithic vs microservices Hard

    A team is migrating a legacy monolithic application to a microservices architecture. They notice that transactions previously handled by a single ACID-compliant database commit now span multiple distinct services and databases. Which of the following architectural patterns is most appropriate to manage data consistency across these services?

  42. Question 42 of 60 API Gateway Hard

    In a Docker Compose deployment containing an API Gateway and multiple scaled instances of a backend service (e.g., docker-compose up --scale backend=3), how does the API Gateway natively resolve the internal routing to distribute traffic among the backend instances?

  43. Question 43 of 60 Docker Compose: YAML Structure Hard

    When designing a complex docker-compose.yml file, you need multiple services to share identical logging configurations, environment variables, and restart policies without duplicating code. Which YAML feature is natively utilized in Compose to achieve this DRY (Don't Repeat Yourself) principle?

  44. Question 44 of 60 Service dependency ordering Hard

    Service A has a depends_on configuration pointing to Service B with the condition service_healthy. Service B defines a healthcheck in the Compose file. If Service B starts successfully but its healthcheck repeatedly fails (returns unhealthy), what will Docker Compose do when starting the environment?

  45. Question 45 of 60 Environment variables Hard

    Consider the following environment variable hierarchy in Docker Compose. You have an environment variable DB_PORT set to 5432 in the .env file, DB_PORT=5433 exported in your host OS shell, DB_PORT=5434 defined in an env_file referenced in the Compose file, and DB_PORT: 5435 defined directly under the environment: key of the service. What value will the container actually use for DB_PORT?

  46. Question 46 of 60 Build vs image fields in YAML Hard

    In a docker-compose.yml file, a service defines both the build: ./webapp and image: custom-webapp:v2 keys simultaneously. What is the precise behavior when docker-compose up -d is executed, assuming the image custom-webapp:v2 does not exist locally?

  47. Question 47 of 60 volumes Hard

    A docker-compose.yml file provisions a PostgreSQL database using a named volume db_data mounted at /var/lib/postgresql/data. Upon the very first startup, the named volume is completely empty, but the PostgreSQL base image already contains default database configuration files at /var/lib/postgresql/data. What happens to these files?

  48. Question 48 of 60 networks Hard

    You are deploying a multi-tier application using Docker Compose with three services: frontend, backend, and database. You want frontend to only communicate with backend, and backend to communicate with both frontend and database. The database should be completely unreachable from the frontend. Which network configuration enforces this isolation?

  49. Question 49 of 60 Secrets and configs Hard

    In a non-Swarm local Docker Compose deployment, a service is configured to use a secret defined via a file (e.g., file: ./db_password.txt). How is this secret materialized inside the running container, and what are the security implications compared to environment variables?

  50. Question 50 of 60 Environment variables Hard

    A docker-compose.yml file contains the following environment variable declaration for a service: APP_TIMEOUT: ${TIMEOUT:?Error: TIMEOUT is not set}. If the user runs docker-compose up without defining the TIMEOUT variable in their shell or .env file, what is the exact outcome?

  51. Question 51 of 60 Java Spring Boot + PostgreSQL Hard

    A microservices deployment features a Java Spring Boot application and a PostgreSQL database in Docker Compose. The spring-boot service depends_on the postgres service with condition: service_healthy. However, the Spring Boot application intermittently crashes on startup, throwing a Connection refused exception. Which of the following is the most likely architectural root cause?

  52. Question 52 of 60 Node.js + MongoDB Hard

    You are setting up a Node.js application backed by a MongoDB Replica Set using Docker Compose. A Replica Set requires an initialization command (rs.initiate()) to be run exactly once after the MongoDB nodes start. What is the most robust and Docker-native way to handle this initialization in a docker-compose.yml file?

  53. Question 53 of 60 WordPress + MySQL Hard

    A user deploys WordPress and MySQL using Docker Compose. They map the WordPress container's port to 8080:80 and the MySQL container's port to 3306:3306. In the WordPress configuration (WORDPRESS_DB_HOST), they specify localhost:3306. When they navigate to http://localhost:8080, WordPress fails to connect to the database. Why does this happen, and how should it be fixed?

  54. Question 54 of 60 version Hard

    In the modern Compose Specification (integrated into Docker Compose V2), the top-level version: element (e.g., version: '3.8') behaves differently than in classic docker-compose V1. Which of the following statements accurately describes the handling of the version key in modern Compose?

  55. Question 55 of 60 Microservices Architecture: Need for microservices Hard

    An organization adopted microservices to increase release agility. However, they now find that every time they update the 'Order' service, they must also deploy specific versions of the 'Inventory' and 'Billing' services simultaneously to prevent system crashes. What architectural anti-pattern has the organization likely created?

  56. Question 56 of 60 Service dependency ordering Hard

    In a complex docker-compose.yml, Service A depends on Service B, Service B depends on Service C, and Service C depends on Service A. All dependencies are standard (no healthcheck conditions). What is the outcome when docker-compose up is executed?

  57. Question 57 of 60 Writing docker-compose.yml Hard

    You have a docker-compose.yml containing a primary web application and an optional debug-tools service. You want debug-tools to be completely ignored by default when running docker-compose up, but you want the ability to explicitly start it when troubleshooting. Which Docker Compose feature is explicitly designed to handle this scenario?

  58. Question 58 of 60 Advantages: scalability, isolation, agility Hard

    A team wishes to leverage Docker Compose to horizontally scale a backend Node.js microservice (docker-compose up --scale backend=5). The backend uses an in-memory cache to store user session tokens. Which of the following issues will occur, and what is the required architectural change to support this scaling?

  59. Question 59 of 60 Use Case Deployments: Multi-container apps (database + backend + frontend) Hard

    In a multi-container deployment, the frontend container (React/Nginx) needs to make API calls to the backend container (Express/Node.js). The frontend container is mapped to host port 3000, and the backend is mapped to host port 5000. In the React application code running in the user's browser, which base URL should be used to fetch data from the backend?

  60. Question 60 of 60 API Gateway Hard

    When introducing an API Gateway (like Traefik or Nginx) to a Docker Compose microservices architecture, you decide to implement SSL/TLS termination and JWT token validation directly at the Gateway. What is the primary architectural advantage of this approach?

That's unit 3

Answer a few questions and your score shows up here.