Courseiva

200-901 Software Development and Design Practice Question

Which Git command is used to create a new branch and switch to it in one step?

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

✓

git checkout -b <branch>

The 'git checkout -b <branch>' command creates a new branch and switches to it immediately.

Answer analysis

Option-by-option breakdown

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

  • ✗

    git branch <branch>

    Why it's wrong here

    git branch <branch> only creates the branch; it leaves HEAD on the current branch, so no switch occurs. It is tempting because branch creation is half the task, and this command is correct when you want to create a branch without leaving your current working context.

  • ✗

    git branch -d <branch>

    Why it's wrong here

    git branch -d deletes the named branch, which is the opposite of creating and switching to it. It is tempting because it manipulates branches and shares the git branch prefix, but -d is the correct choice only when removing a fully merged local branch.

  • ✗

    git checkout <branch>

    Why it's wrong here

    git checkout <branch> switches to an existing branch but does not create it, so it fails when the branch is absent. It is tempting because checkout does change branches, and it is correct when the target branch already exists locally.

  • ✓

    git checkout -b <branch>

    Why this is correct

    The -b flag instructs git checkout to create the named branch before switching to it, combining branch creation and checkout in a single command. Without -b, checkout only switches to an existing branch, so this satisfies the one-step requirement in the stem.

About these practice questions

Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.