Unit 3: Continuous Integration (CI) & Build Automation - Practice Quiz

INT331 — Fundamentals Of Devops 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What does the abbreviation CI stand for in DevOps?

CI fundamentals and benefits Easy
A. Continuous Integration
B. Continuous Isolation
C. Central Infrastructure
D. Code Inspection

2 Which of the following is a key benefit of Continuous Integration?

CI fundamentals and benefits Easy
A. Manual code merging only
B. Elimination of all testing
C. Early detection of integration bugs
D. Slower release cycles

3 In CI, how often are developers encouraged to integrate their code into the main branch?

CI fundamentals and benefits Easy
A. Frequently, often several times a day
B. Only once per release
C. Only at project completion
D. Once a month

4 What typically triggers a CI pipeline to start running?

CI Pipeline Architecture Easy
A. A user logging out
B. A code commit or push to the repository
C. A server reboot
D. A monthly calendar event only

5 Which of the following is a common stage found in a CI pipeline?

CI Pipeline Architecture Easy
A. Marketing
B. Build
C. Payroll
D. Recruitment

6 In a CI pipeline, what is an artifact?

CI Pipeline Architecture Easy
A. A database backup schedule
B. A hardware server component
C. The output produced by a build, such as a JAR or binary
D. A type of network protocol

7 Which of the following CI tools is an open-source automation server written primarily in Java?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Easy
A. CircleCI
B. Jenkins
C. GitLab CI
D. GitHub Actions

8 Which CI/CD tool is built directly into the GitHub platform?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Easy
A. CircleCI
B. GitHub Actions
C. Bamboo
D. Jenkins

9 What file format is commonly used to define GitHub Actions workflows?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Easy
A. DOCX
B. PDF
C. YAML
D. XLSX

10 Which configuration file is used to define pipelines in GitLab CI?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Easy
A. package.json
B. Jenkinsfile
C. .gitlab-ci.yml
D. pom.xml

11 Which build tool uses a file named pom.xml for its configuration?

Build Tools Overview: Maven, Gradle, npm Easy
A. CircleCI
B. Maven
C. Gradle
D. npm

12 Which build tool is most commonly associated with JavaScript/Node.js projects?

Build Tools Overview: Maven, Gradle, npm Easy
A. npm
B. Gradle
C. Ant
D. Maven

13 Which build tool uses a Groovy or Kotlin based DSL in files like build.gradle?

Build Tools Overview: Maven, Gradle, npm Easy
A. npm
B. Maven
C. Make
D. Gradle

14 Which file stores project dependencies for an npm project?

Build Tools Overview: Maven, Gradle, npm Easy
A. Jenkinsfile
B. pom.xml
C. package.json
D. build.gradle

15 What is the name of the file used to define a Jenkins pipeline as code?

Writing Jenkins Declarative Pipelines Easy
A. build.yml
B. pipeline.txt
C. Jenkinsfile
D. config.xml

16 In a Jenkins declarative pipeline, which block contains all the stages?

Writing Jenkins Declarative Pipelines Easy
A. pipeline
B. routine
C. workflow
D. process

17 In a Jenkins declarative pipeline, what does the agent directive specify?

Writing Jenkins Declarative Pipelines Easy
A. The Git commit message
B. The color of the console output
C. Where the pipeline or stage will execute
D. The name of the developer

18 What is the main goal of an automated build?

Automated Builds Easy
A. To compile and package code without manual steps
B. To hire new developers
C. To design UI mockups
D. To manually write documentation

19 Why is automated testing important in a CI pipeline?

Automated Testing Easy
A. It replaces version control
B. It quickly verifies code changes without manual effort
C. It slows down the release process
D. It removes the need for source code

20 What does code coverage measure?

Test Automation Basics (Unit Testing, Coverage) Easy
A. The percentage of code executed by tests
B. The speed of the CPU
C. The size of the repository in MB
D. The total number of code files

21 A team merges code into the shared main branch only once every two weeks, resulting in painful merge conflicts. Which core Continuous Integration principle would most directly address this problem?

CI fundamentals and benefits Medium
A. Assigning a dedicated integration engineer to merge branches at the end of each sprint
B. Delaying integration until a full QA cycle is completed to reduce build server load
C. Using longer-lived feature branches so developers can work in isolation without interruption
D. Integrating code changes frequently, ideally multiple times per day, into the shared mainline

22 Which outcome is the least likely direct benefit of adopting Continuous Integration?

CI fundamentals and benefits Medium
A. Reduced integration risk near release time
B. Faster detection of integration bugs
C. Consistent, repeatable build results
D. Automatic deployment of every commit to production users

23 In a typical CI pipeline, what event most commonly acts as the trigger that starts a pipeline run?

CI Pipeline Architecture Medium
A. A scheduled nightly reboot of the application server
B. A change in the production monitoring dashboard
C. A manual approval from the product owner
D. A push or pull request to the version control repository

24 A pipeline is arranged so that if the compile/build stage fails, no later stages run. What is the primary reason for this fail-fast ordering?

CI Pipeline Architecture Medium
A. Running tests on code that does not compile wastes resources and gives no useful signal
B. The version control system locks the repository until the build passes
C. Later stages always require manual approval before they can start
D. Test stages consume more memory than build stages and must be avoided

25 Which statement correctly distinguishes GitHub Actions from a self-hosted Jenkins server in a default setup?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Medium
A. GitHub Actions cannot integrate with GitHub repositories, while Jenkins can
B. GitHub Actions requires a dedicated master node and agents, while Jenkins is fully serverless by default
C. GitHub Actions uses Groovy pipelines, while Jenkins uses YAML workflows
D. GitHub Actions runs on cloud-hosted runners managed by GitHub, while Jenkins is typically installed and maintained on your own infrastructure

26 In GitLab CI, which file located at the repository root defines the pipeline configuration?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Medium
A. Jenkinsfile
B. circle.yml
C. .github/workflows/main.yml
D. .gitlab-ci.yml

27 A team wants to run each job of their CI pipeline inside a fresh, isolated container image they specify. Which CI tool is especially known for making per-job Docker containers a first-class, native concept via a docker executor?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Medium
A. Apache Ant
B. GNU Make
C. A traditional freestyle Jenkins job with no plugins
D. CircleCI

28 A Java project uses Maven. Which command compiles the code, runs tests, and packages the result into a JAR/WAR without installing it to the local repository?

Build Tools Overview: Maven, Gradle, npm Medium
A. mvn deploy
B. mvn clean
C. mvn install
D. mvn package

29 What is the primary functional advantage of Gradle's incremental build support compared to a naive full rebuild every time?

Build Tools Overview: Maven, Gradle, npm Medium
A. It re-executes only the tasks whose inputs or outputs have changed, reducing build time
B. It removes the need for any dependency declarations in the build script
C. It automatically deploys artifacts to production after every build
D. It converts all Java source files into Python before compiling

30 In a Node.js project, which file records the exact resolved version of every installed dependency to ensure reproducible installs across machines?

Build Tools Overview: Maven, Gradle, npm Medium
A. package-lock.json
B. package.json
C. node_modules.json
D. npmrc.json

31 Which pair correctly matches a build tool with the ecosystem it is most commonly used in?

Build Tools Overview: Maven, Gradle, npm Medium
A. Gradle — Python; npm — Ruby
B. npm — Java; Maven — Node.js
C. Maven — JavaScript; npm — Java
D. Maven — Java; npm — JavaScript/Node.js

32 In a Jenkins Declarative Pipeline, which block is required at the top level to specify where the pipeline will execute?

Writing Jenkins Declarative Pipelines Medium
A. triggers
B. post
C. environment
D. agent

33 Consider this Jenkins snippet:
groovy
post {
always {
echo 'Cleaning up'
}
}

When does the always block execute?

Writing Jenkins Declarative Pipelines Medium
A. Only when at least one stage fails
B. Before any stage begins, as a setup step
C. After the stages complete, regardless of whether the build succeeded or failed
D. Only when every stage succeeds

34 In a Declarative Pipeline, where must individual stage blocks be placed?

Writing Jenkins Declarative Pipelines Medium
A. Inside a stages block
B. Inside the agent block
C. Inside the environment block
D. Inside the parameters block

35 A pipeline author wants a variable available as an environment variable to every step in all stages of the build. Which directive should be used at the top level of the Declarative Pipeline?

Writing Jenkins Declarative Pipelines Medium
A. environment
B. steps
C. input
D. options

36 Which practice best characterizes an automated build in a CI context?

Automated Builds Medium
A. Each engineer builds only on their own laptop using a locally customized, undocumented set of steps
B. A single command or trigger compiles the code, resolves dependencies, and produces artifacts without manual steps
C. The QA team assembles the release by hand at the end of each release cycle for accuracy
D. A developer manually copies compiled files to a shared drive after each change and emails the team

37 Why is producing a versioned, immutable build artifact (e.g., a specific JAR) important in a CI/CD workflow?

Automated Builds Medium
A. It guarantees the application will never contain any bugs
B. It allows the source code to be deleted immediately after the build
C. The same tested artifact can be promoted through environments, ensuring what was tested is what gets deployed
D. It forces developers to recompile the code separately for every environment

38 A CI pipeline runs unit tests automatically on every push. A commit introduces code that breaks a test. What is the most valuable immediate benefit of this automation?

Automated Testing Medium
A. The failing test is permanently deleted so the pipeline can proceed
B. The broken code is automatically rewritten to pass the test
C. All future commits are blocked until the next scheduled nightly run
D. The regression is detected right after the commit that caused it, making it easy to locate and fix

39 Which ordering of test types generally reflects a healthy test pyramid, from most to fewest tests?

Automated Testing Medium
A. Unit tests → integration tests → end-to-end tests
B. End-to-end tests → integration tests → unit tests
C. Integration tests → unit tests → end-to-end tests
D. End-to-end tests → unit tests → integration tests

40 A test suite reports 85% line coverage. What does this figure specifically indicate?

Test Automation Basics (Unit Testing, Coverage) Medium
A. 85% of the requirements have been formally documented
B. 85% of the executable lines of code were run at least once during the tests
C. 85% of all known bugs in the software have been fixed
D. The software is guaranteed to be 85% free of defects

41 A team practices trunk-based development with CI, but developers still experience frequent 'integration hell' at release time. Investigation shows that although commits are pushed to the main branch several times daily, the CI pipeline only runs a compile step and no tests, and feature flags are absent. Which corrective action most directly restores the core CI benefit being violated?

CI fundamentals and benefits Hard
A. Switch from trunk-based development to long-lived feature branches with weekly merges
B. Add automated test execution to every pipeline run so integration defects surface at commit time
C. Increase the frequency of merges to the main branch to more than ten times per day
D. Move the compile step to a nightly scheduled build to reduce runner load

42 In a fan-out/fan-in CI pipeline, a build stage produces an artifact consumed by three parallel test stages (unit, integration, contract), which then converge into a single deploy stage. If the integration test stage has a flaky 20% failure rate per run and the pipeline retries only that stage up to 2 additional times, what is the approximate probability the pipeline reaches the deploy stage on a given trigger (assuming other stages always pass)?

CI Pipeline Architecture Hard
A.
B.
C.
D.

43 Consider this Jenkins declarative snippet:

groovy
pipeline {
agent none
stages {
stage('Build') {
agent { label 'linux' }
steps { sh 'make' }
}
stage('Test') {
agent { label 'linux' }
steps { sh './run-tests --input target/app.bin' }
}
}
}


The Test stage fails because target/app.bin does not exist. What is the root cause?

Writing Jenkins Declarative Pipelines Hard
A. Each stage's agent runs in a separate workspace, so build artifacts are not automatically shared unless stashed/archived
B. agent none disables workspace creation entirely, so no files can be written in any stage
C. Declarative pipelines require artifacts to be declared in a parameters block to persist
D. The sh step cannot access the target directory without an explicit dir() block

44 A Gradle build is slow on CI despite the code changing minimally between runs. The CI runner is ephemeral (fresh container per build). Which combination most effectively reduces build time while remaining correct?

Build Tools Overview: Maven, Gradle, npm Hard
A. Run Gradle with --offline only, which forces reuse of previously compiled classes
B. Switch every module to api dependencies so more tasks can be parallelized
C. Enable the Gradle build cache with a shared remote cache and persist the Gradle user home across runs
D. Disable incremental compilation and always run --rerun-tasks for deterministic output

45 A module has 100% line coverage but a production bug slips through: a function divide(a, b) throws on b == 0, which callers never handle. Why did high coverage fail to catch this, and what metric would have exposed the gap?

Test Automation Basics (Unit Testing, Coverage) Hard
A. Line coverage does not measure untested input partitions or branches; branch/path coverage on the divisor would expose the missing case
B. Statement coverage already includes the zero-divisor path, so the tests must have been disabled
C. The bug is uncatchable by any coverage metric because exceptions are runtime-only phenomena
D. 100% line coverage guarantees correctness, so the bug must be in the test runner configuration itself

46 In GitHub Actions, a workflow defines two jobs: build and deploy, where deploy has needs: build. Both jobs set concurrency: production. A developer pushes two commits in quick succession. What behavior results?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Hard
A. Both runs execute fully in parallel because needs only affects ordering within a single run
B. The deploy job runs twice simultaneously since needs releases the concurrency lock after build
C. GitHub Actions rejects the second push entirely because the concurrency group is already claimed
D. The second run's jobs sharing the production concurrency group cancel or queue against the first, since concurrency groups are evaluated per matching key across runs

47 A reproducible build requirement states that building the same commit twice must yield byte-identical artifacts. A Java build currently fails this check. Which factor is the most likely culprit?

Automated Builds Hard
A. Compiling with the same JDK version on every machine, causing hash drift
B. Running unit tests before packaging, which mutates the compiled class files
C. Using a locked dependency version file, which forces different bytes on each run
D. Embedded build timestamps and non-deterministic file ordering inside the JAR manifest/zip entries

48 A pipeline uses caching to speed up dependency installation. After a security advisory, a compromised dependency version was published and later yanked. The team pins versions but still gets the compromised artifact on some CI runs. What architectural flaw explains this?

CI Pipeline Architecture Hard
A. The cache key does not incorporate the lockfile hash, so stale cached dependencies persist despite pin changes
B. CI caches are immutable, so once populated they can never reflect pinned versions
C. The registry mirror always serves yanked packages regardless of the cache
D. Version pinning is incompatible with any form of dependency caching

49 In a Jenkins declarative pipeline, you need a stage to run only when the branch is main AND a prior stage set an environment variable DEPLOYABLE=true. Which when construct is correct?

Writing Jenkins Declarative Pipelines Hard
A. when { anyOf { branch 'main'; environment name: 'DEPLOYABLE', value: 'true' } }
B. when { allOf { branch 'main'; environment name: 'DEPLOYABLE', value: 'true' } }
C. when { not { branch 'main'; environment name: 'DEPLOYABLE', value: 'true' } }
D. when { expression { branch == 'main' || env.DEPLOYABLE } }
E. when { branch 'main' and environment 'DEPLOYABLE=true' }

50 A CI suite runs 5000 tests in 40 minutes. The team wants sub-10-minute feedback. They shard tests across 4 parallel runners by simple alphabetical file split, but one runner consistently takes 30 minutes. What is the best fix?

Automated Testing Hard
A. Split shards using historical per-test timing data so each runner gets balanced execution time
B. Increase runners to 8 while keeping the alphabetical split unchanged
C. Run all tests on a single more powerful runner to avoid sharding overhead
D. Alphabetize the tests in reverse to redistribute the slow files

51 During npm ci on CI, the build fails with an error that package-lock.json is out of sync with package.json. A developer suggests switching to npm install to 'auto-fix' it. Why is this the wrong fix for CI?

Build Tools Overview: Maven, Gradle, npm Hard
A. npm install cannot run in CI environments because it requires interactive prompts
B. npm install is slower than npm ci, so it only affects performance, not correctness
C. npm install may mutate the lockfile and install differing versions, breaking reproducibility; the lockfile should be regenerated and committed locally instead
D. npm ci and npm install are identical, so switching has no effect on the failure

52 In GitLab CI, a job in the test stage must run only for merge requests targeting main, but never on scheduled pipelines. Which rules configuration achieves this correctly?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Hard
A. only: - merge_requests except: - schedules main
B. rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' when: always
C. rules: - when: manual combined with only: main
D. rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"' - if: '$CI_PIPELINE_SOURCE == "schedule"' when: never

53 A team enforces a coverage gate of 80%. A developer adds a large auto-generated file with no tests, dropping coverage below the gate. To pass, they add coverage exclusions for generated code. Later, a genuine untested handler also gets excluded by an overly broad glob. What is the key lesson about coverage gates?

Test Automation Basics (Unit Testing, Coverage) Hard
A. Coverage gates are meaningless and should be removed from all pipelines
B. Auto-generated code must always be counted toward coverage to be safe
C. Coverage exclusions must be narrowly scoped; broad globs can mask real untested code and give false confidence
D. Coverage gates should always be set to 100% to prevent any exclusions

54 A manager claims 'we have CI because we run a nightly build and test job'. A CI expert disagrees. Which argument best explains why a nightly-only build is not true Continuous Integration?

CI fundamentals and benefits Hard
A. CI requires integration and verification on every commit/merge to give fast feedback; nightly batching delays defect detection and reintroduces integration risk
B. CI is defined solely by the tool used, not by the frequency of integration
C. Nightly builds fail CI only if they skip the deployment stage
D. Nightly builds are CI as long as they run automated tests, regardless of frequency

55 A Maven multi-module project builds fine locally but fails on CI with 'Could not resolve dependencies for project A: artifact B not found'. Module A depends on module B, both in the same reactor. Locally, B was previously mvn installed. What is the correct CI-safe build command?

Automated Builds Hard
A. Run mvn install on A only, since Maven auto-discovers sibling modules from the registry
B. Publish B to Maven Central first, then build A separately on CI
C. Build the whole reactor together, e.g. mvn -pl A -am install, so B is built before A in the same run
D. Delete the local .m2 repository on CI before building A

56 In CircleCI, a workflow uses a context to inject shared secrets and restricts it to a security group. A contractor's job in the same workflow needs a different, non-privileged credential set. What is the correct approach to enforce least privilege?

Popular CI Tools: Jenkins, GitHub Actions, GitLab CI, CircleCI Hard
A. Assign each job its own context so secrets are scoped per job, granting the contractor's job only the non-privileged context
B. Grant the contractor org-admin so their job can read whichever context it needs
C. Store the privileged secrets in the config YAML and gate them with an if condition
D. Put all secrets in a single project-wide context so every job shares identical access

57 A declarative pipeline must guarantee that a cleanup step runs whether the build succeeds, fails, or is aborted, and a notification runs only on failure. Which structure is correct?

Writing Jenkins Declarative Pipelines Hard
A. Put cleanup in the last stage and notify in a catchError block only
B. Use post { success { cleanup; notify } } so both run after completion
C. Wrap all stages in a try/finally since declarative pipelines support raw Groovy control flow
D. Use post { always { cleanup } failure { notify } } at the pipeline or stage level

58 A CI pipeline reports intermittent test failures that disappear on re-run. Analysis shows two tests share a database table and run in parallel. Which statement best characterizes the problem and the most robust fix?

Automated Testing Hard
A. The CI runner is underpowered; the fix is to allocate more CPU to eliminate the race
B. The tests are flaky due to network latency; adding a fixed sleep before assertions is the robust fix
C. Parallel execution is inherently unsafe for tests; disable all parallelism permanently
D. The tests are not isolated (shared mutable state); isolate them via per-test transactions/schemas or unique data, rather than relying on retries

59 A pipeline separates a fast 'commit stage' (compile + unit tests, target < 5 min) from a slower 'acceptance stage'. A proposal suggests moving slow end-to-end tests into the commit stage 'to catch more bugs earlier'. Why does this typically harm the pipeline?

CI Pipeline Architecture Hard
A. End-to-end tests cannot technically execute in an early stage of any pipeline
B. It inflates commit-stage duration, destroying the fast-feedback contract and increasing the cost of every commit's verification
C. It reduces total test coverage because e2e tests overwrite unit test results
D. It forces the acceptance stage to run twice, doubling infrastructure cost only

60 Comparing Maven and Gradle for a large monorepo, a team values incremental builds and task-level caching but also wants a low-magic, declarative configuration. Which trade-off statement is most accurate?

Build Tools Overview: Maven, Gradle, npm Hard
A. Maven's convention-over-configuration makes it strictly faster than Gradle in every scenario
B. Gradle offers superior incremental/cacheable task graphs but its Groovy/Kotlin DSL is imperative and can grow complex, while Maven's XML is more declarative but less flexible for fine-grained incrementality
C. Maven provides finer task-level incremental caching than Gradle, and its XML is fully imperative
D. Gradle and Maven have identical build models, differing only in configuration file format