Microsoft GitHub Actions GH-200 Exam Questions

Page: 1 / 14
Total 72 questions
Question 1

Which of the following commands will set the $FOO environment variable within a script, so that it may be used in subsequent workflow job steps?



Answer : B

The $GITHUB_ENV environment variable is used to set environment variables that persist across steps in a workflow job. By echoing FOO=bar into $GITHUB_ENV, the variable FOO will be available in subsequent steps within the same job.


Question 2

Which files are required for a Docker container action in addition to the source code? (Choose two.)



Answer : A, D

Dockerfile: The Dockerfile is required for Docker container actions. It defines the environment for the action, specifying the base image, dependencies, and any commands to set up the action's runtime inside the container.

action.yml: The action.yml file is required for all GitHub Actions, including Docker container actions. It contains metadata about the action, including the inputs, outputs, and the runtime environment (which in this case is Docker, defined under runs.using).


Question 3

What is the smallest scope for an environment variable?



Answer : B

The smallest scope for an environment variable is within a step. Environment variables defined within a step are only accessible to that particular step, which makes it the smallest scope for a variable in a GitHub Actions workflow.


Question 4

As a developer, you are using a Docker container action in your workflow. What is required for the action to run successfully?



Answer : B

For a Docker container action to run in a GitHub Actions workflow, the runner must have Docker installed. The runs-on attribute of the job should specify an environment that supports Docker, typically a Linux environment (e.g., ubuntu-latest), since Docker is widely supported and commonly used in Linux-based environments.


Question 5

Which of the following scenarios would require the use of self-hosted runners instead of GitHub-hosted runners?



Answer : A, D

GitHub-hosted runners have a limit on the number of concurrent workflows (typically 20 for free-tier accounts and 5 for enterprise). If your organization needs to run more workflows simultaneously, you would need to use self-hosted runners to increase the available concurrency.

Self-hosted runners allow you to configure specialized hardware or software setups that are necessary for certain workflows. GitHub-hosted runners may not have access to custom hardware configurations like GPUs or other specialized resources, so self-hosted runners are required in such cases.


Question 6

How many jobs will result from the following matrix configuration?



Answer : D

The matrix configuration specifies two variables: color and animal. The color variable has 2 values (green and pink), and the animal variable has 2 values (owl and magpie). This would result in 4 combinations (2 color values 2 animal values). Additionally, the include section introduces two more combinations (color: blue and animal: owl; color: pink and animal: magpie).


Question 7

Where should workflow files be stored to be triggered by events in a repository?



Answer : A

Workflow files must be stored in the .github/workflows/ directory of the repository. This is the standard location for GitHub Actions workflow files, and workflows in this directory are automatically triggered by events defined in the file, such as pushes, pull requests, or other GitHub events.


Page:    1 / 14   
Total 72 questions