Courseiva
Design and implement a source control strategymediumMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement a source control strategy

Your team is using GitHub Flow for a web application. Developers create feature branches from main, make changes, and open pull requests. Recently, several pull requests were merged without required reviews because the branch protection rules were not enforced on the main branch. What should you do to ensure all pull requests to main require at least one reviewer?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Enable the 'Require a pull request before merging' rule in branch protection for main, and set 'Required approvals' to 1.

Branch protection rules in GitHub can enforce required pull request reviews before merging. By enabling 'Require a pull request before merging' and setting 'Required approvals' to 1, any pull request to main must have at least one reviewer approve before merging. Option B is incorrect because deleting head branches after merge does not enforce reviews. Option C is incorrect because requiring branches to be up to date is about ensuring the branch is current with the base branch, not about requiring reviews. Option D is incorrect because CODEOWNERS are optional and do not enforce mandatory reviews unless branch protection rules are set accordingly.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Enable the 'Require a pull request before merging' rule in branch protection for main, and set 'Required approvals' to 1.

    Why this is correct

    Enabling 'Require a pull request before merging' in branch protection forces every commit to main to be introduced via a pull request, which is the foundational mechanism for mandatory code review. When combined with 'Required approvals' set to 1, the merge is blocked until at least one reviewer has explicitly approved the changes, providing a hard enforcement of the team's review policy.

  • Configure the repository to automatically delete head branches after pull requests are merged.

    Why it's wrong here

    Configuring the repository to automatically delete head branches after pull requests are merged is a repository cleanup convenience that removes feature branches once they are merged. This does not add any review requirement or approval gate; it simply reduces branch clutter and does nothing to enforce code review.

  • Enable the 'Require branches to be up to date' rule in branch protection for main.

    Why it's wrong here

    Enabling 'Require branches to be up to date' ensures that a pull request branch is kept current with the latest main branch before merging, which helps prevent merge conflicts and ensures the branch has the latest changes. However, this is a technical freshness check and does not require any human approval, so a branch could still be merged without anyone reviewing the code unless a pull request review requirement is also configured.

  • Add a CODEOWNERS file and configure it so that every file has at least one owner.

    Why it's wrong here

    Adding a CODEOWNERS file that assigns ownership for every path does not, by itself, make code review mandatory. CODEOWNERS only defines which individuals or teams are automatically requested as reviewers when a pull request touches files under their ownership; these requests can be dismissed or ignored. To actually block merging without the code owner's approval, you must separately enable the 'Require review from Code Owners' branch protection rule, which itself depends on having 'Require a pull request before merging' and 'Required approvals' configured. Since the team's goal is to enforce that every change is reviewed, a mere CODEOWNERS file without a matching branch protection gate leaves merging to the author's discretion and therefore does not satisfy the requirement.

About these practice questions

This AZ-400 question is part of Courseiva's 823-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.