GitHub Foundations Exam-style mock test
GitHub Foundations Practice Exams|Practice test
Full explanations
Exam format
Pass line 70%
33 USD One-time · lifetime access
Enroll →
Sample questions
Example1 · Introduction to Git and GitHub
A solo founder starts a small web app and runs 'git init' inside the project folder before any GitHub account exists. What has this command accomplished on her laptop?
✓It created a new local Git repository so the folder can track changes
Correct. 'git init' creates a new local repository in the folder, enabling version tracking without any remote or network.
・It uploaded the current folder to GitHub and made it publicly visible to everyone online
Incorrect. 'git init' never contacts GitHub; publishing requires a remote and a push, and a repository is private by default when created there.
・It permanently linked the folder to a shared company server
Incorrect. Initializing a repo does not attach it to any shared server or require authentication against one.
・It installed the Git program onto the operating system for the very first time today
Incorrect. 'git init' assumes Git is already installed; it does not install the Git software.
Explanation
'git init' turns an ordinary directory into a Git repository stored locally. No GitHub account, remote, or network connection is involved, and Git must already be installed for the command to run.
Example2 · Working with GitHub Repositories
A two-person startup is beginning a prototype that must stay confidential until launch, but they want everyone on the small team to eventually contribute. When creating the repository on GitHub, which visibility setting lets only the owner and explicitly invited collaborators see and work in the repo?
✓Private, for the owner and invited collaborators
Correct. Private limits visibility to the owner and the specific invited collaborators, matching the need to keep the prototype hidden while still letting the small team contribute.
・Public, readable by anyone on the internet
Incorrect. Public makes the repository readable by anyone on the internet, which breaks the requirement to keep the prototype confidential before launch.
・Internal, visible to the whole owning enterprise's members
Incorrect. Internal exposes the repository to every member of the owning enterprise, which is far broader than a two-person startup wants for confidential prototype work.
・Archived, a read-only project state
Incorrect. Archived is a read-only state for finished projects, not a visibility level, so it cannot control who can see or contribute to an active prototype.
Explanation
Repository visibility is chosen at creation time and can be Public, Internal (enterprise only), or Private. Private restricts access to the owner and invited collaborators, which fits confidential startup work.
Example3 · Collaboration Features
A startup dev team wants contributors to propose code changes that maintainers can review and discuss before the code is combined into the main branch. Which GitHub feature is designed for this purpose?
✓A pull request bundling proposed commits for review
Correct. A pull request packages proposed commits so reviewers can comment, approve, or request changes before the branch is merged.
・An issue, which only tracks a reported bug or requested feature
Incorrect. Issues track work items such as bugs or feature requests but do not carry the proposed code changes or the merge workflow.
・A discussion, which only provides an open-ended conversation space, not a merge
Incorrect. Discussions host open-ended conversation and are not the mechanism for reviewing and merging a set of proposed commits.
・A gist, which stores a standalone snippet outside the repository and its branches
Incorrect. A gist stores an isolated snippet outside the repository and offers no review-and-merge workflow for a branch.
Explanation
Pull requests are the core collaboration feature for proposing, reviewing, and merging code changes. Issues, discussions, and gists serve other purposes and lack the review-then-merge workflow.
Example4 · Modern Development (Actions, Codespaces, Copilot, Packages)
A fintech platform team wants a GitHub Actions workflow to run its test suite automatically every time a developer opens or updates a pull request against the main branch. Which workflow trigger should they configure in the 'on' key?
・schedule, a cron-based timer
Incorrect. The schedule event runs a workflow on a cron timer, not in response to pull request activity.
✓pull_request, firing on PR activity
Correct. The pull_request event triggers the workflow when a PR is opened, synchronized, or reopened, matching the team's need.
・workflow_dispatch, allowing only manual UI runs
Incorrect. workflow_dispatch only allows a workflow to be started manually from the UI or API, not automatically on PR activity.
・release, on published releases
Incorrect. The release event fires when a release is published or edited, which is unrelated to pull request updates.
Explanation
Workflow triggers are declared under the 'on' key. The pull_request event responds to PR lifecycle activity such as opened and synchronized, making it the right choice for running tests on every PR.
Example5 · Project Management
A platform team at a fintech company tracks dozens of issues and pull requests in a GitHub Project. The team lead wants to view the same work as a spreadsheet-like grid one moment and as a kanban-style flow of columns the next, without creating a separate Project for each. Which capability of GitHub Projects supports this?
✓Switching between Table and Board views in the Project
Correct. A single GitHub Project can be displayed through multiple saved views, and each view can use a Table layout or a Board layout over the same underlying items.
・Exporting to CSV and rebuilding a separate Project for each different presentation
Incorrect. Exporting to CSV and rebuilding a separate Project just to change presentation is unnecessary because layouts are a built-in, instant property of a Project view.
・Converting the repository wiki pages into a kanban-style column display
Incorrect. The repository wiki stores documentation pages and has no kanban or board capability.
・Enabling branch protection rules on the default branch of the repository
Incorrect. Branch protection rules govern merges into a branch and have nothing to do with how Project items are displayed.
Explanation
A GitHub Project holds one set of items that can be shown through several views, and each view's layout can be set to Table or Board. This lets a team switch presentations instantly without duplicating the Project.
Example6 · Privacy, Security, and Administration
A fintech platform team migrates its repositories from scattered personal accounts into a single GitHub organization. The platform lead wants a way to group engineers so that database repositories can be shared with the whole data group at once, and so that nested access can mirror the reporting structure. Which organization feature should they use?
✓Organization teams
Correct. Teams let an organization group members and grant repository access collectively, and teams can be nested to mirror a reporting hierarchy.
・Branch protection rules
Incorrect. Branch protection rules enforce merge conditions on specific branches and do not grant repository access to groups of members.
・Personal access tokens
Incorrect. Personal access tokens authenticate an individual user to the API and do not define shared group access.
・Repository fork copies
Incorrect. Forks create a separate copy of a repository and are not a mechanism for granting grouped member access.
Explanation
Organization teams group members so access can be granted in bulk, and nested teams can reflect an org's reporting structure. Branch protection, tokens, and forks address unrelated concerns.
Example7 · Introduction to Git and GitHub
A machine learning agency keeps its model training code on a shared network drive, where team members manually copy folders named 'final_v2' and 'final_FINAL' to track changes. They want each engineer to have the full project history locally so they can review past work and commit even while offline during client site visits. Which characteristic of Git best addresses this need?
✓Git is distributed, so every single clone holds the project's complete history locally, letting engineers review past work and commit offline during client site visits before they sync later
Correct. Git is distributed, meaning each clone holds the full history locally, so engineers can review past work and commit offline during site visits and sync later.
・Git stores only the newest snapshot of each file on one central server that every engineer must stay connected to
Incorrect. Git keeps the full history in each clone, not just the latest snapshot tied to one always-connected server.
・Git demands a constant network link to a central repository and locks a file for everyone the moment one engineer edits it
Incorrect. Git does not lock files or require a constant connection; that describes older centralized, lock-based systems.
・Git automatically renames folders with numbered version suffixes so the team can keep every draft side by side on the drive
Incorrect. Git tracks changes through commits rather than by creating version-suffixed duplicate folders.
Explanation
Git is a distributed version control system in which every clone is a complete copy of the repository and its history. This lets engineers commit offline and avoids the manual 'final_v2' folder-copying problem.
Example8 · Introduction to Git and GitHub
An ML engineer at the agency has finished and staged changes to a data-cleaning script and wants to permanently record this state in the local repository's history with a descriptive message. Which Git operation records the staged changes as a new point in the project history?
✓A commit, which saves a snapshot of the staged changes with a message
Correct. A commit records the staged changes as a new snapshot in the local history, attaching the engineer's message.
・A clone, which downloads an entirely separate working copy of a remote repository onto the engineer's own machine
Incorrect. Clone copies a remote repository rather than recording local staged changes.
・A fetch, which only retrieves the latest remote updates into tracking references without recording the engineer's own local changes
Incorrect. Fetch pulls remote updates and does not save the engineer's local work.
・A checkout, which merely switches the engineer's working directory over to point at a different branch or an older commit
Incorrect. Checkout switches branches or commits and does not record new changes.
Explanation
A commit captures the currently staged changes as a labeled snapshot in the repository's history. Clone, fetch, and checkout serve different purposes and do not record staged work.
Example9 · Introduction to Git and GitHub
Two ML engineers need to experiment with a new feature-engineering approach without disturbing the stable code that the client demo relies on. They want an isolated line of development that can later be combined back into the main code. Which Git concept provides this isolation?
✓A branch, which is an independent line of development that diverges from the main code for isolated work
Correct. A branch is an independent line of development, letting the engineers build the feature in isolation from the stable main code.
・A tag, which simply marks one commit with a static label and holds no ongoing development on top
Incorrect. A tag is a static label on one commit and does not carry ongoing development work.
・A remote, which is merely a named reference pointing to another separate hosted copy of the repository elsewhere online
Incorrect. A remote is a reference to a hosted copy of the repository, not an isolated development line.
・A stash, which only temporarily shelves the engineer's uncommitted changes rather than forming a parallel line
Incorrect. A stash temporarily sets aside uncommitted changes rather than forming a parallel branch of work.
Explanation
A branch creates a separate line of development that diverges from main, so experimental work stays isolated until it is merged. Tags, remotes, and stashes do not provide this ongoing isolated workspace.
Example10 · Introduction to Git and GitHub
A SaaS analytics startup is evaluating version control. Their lead engineer explains that each developer's laptop holds a full copy of the repository, including its entire commit history, so work can continue even when the central server is unreachable. Which characteristic of Git does this describe?
✓Git is a distributed system where every clone is a complete repository
Correct. In a distributed VCS like Git, each clone contains the full repository and history, so local work continues offline.
・Git is a centralized system that stores history only on a single shared server
Incorrect. A centralized model keeps history only on one server, which contradicts every clone holding the full history described here.
・Git is a centralized file-locking system that stops two people from editing the same file at once
Incorrect. Git does not rely on exclusive file locks to coordinate edits; it merges concurrent changes instead.
・Git is a backup tool that mirrors files to cloud storage on a fixed schedule
Incorrect. Git is version control, not a scheduled file-mirroring backup service copying files to the cloud at set times.
Explanation
Git is a distributed version control system, meaning each cloned repository is a self-contained copy with the full commit history. This lets developers commit, branch, and review history locally without a constant connection to a central server.
Example11 · Introduction to Git and GitHub
A game studio developer wants a local working copy of a teammate's repository that is already hosted on GitHub, including its full history, so she can build and run the game engine on her machine. Which Git operation should she use?
✓git clone, which downloads the remote repository and its history into a new local directory
Correct. git clone copies an existing remote repository, including its history, into a new local directory.
・git init, which creates a brand-new empty local repository with no connection to the remote project
Incorrect. git init starts a new empty repository and does not retrieve the teammate's existing code or history.
・git commit, which records staged changes as a snapshot in the local repository
Incorrect. git commit records a snapshot of already-staged local changes; it does not obtain a remote repository.
・git status, which reports the state of the working tree and staging area
Incorrect. git status only reports the current state of files; it cannot download the remote repository.
Explanation
Cloning creates a local copy of a remote repository along with its complete commit history, ready for building and development. Other commands either start empty projects or operate only on existing local changes.
Example12 · Introduction to Git and GitHub
A university research lab stores its climate-model code in a central Git repository. Each graduate student runs 'git clone' to get a working copy on a laptop. What does this behavior demonstrate about Git as a distributed version control system?
・The central server alone keeps the full project history, forcing students online to review any past commits
Incorrect. In a distributed system the full history lives in every clone, not only on the server, so offline access to history is possible.
✓Each clone holds the full repository history, letting students commit and read history offline
Correct. A clone copies the entire history, so each student can commit, inspect logs, and diff locally without a network connection.
・Each student receives only the latest file snapshot without the earlier commit history
Incorrect. A clone includes the whole commit history, not merely the most recent snapshot of the files.
・The clone locks the central repository so no other student can download the project concurrently
Incorrect. Cloning reads from the repository and never locks it, so many students can clone concurrently.
Explanation
Git is distributed: cloning copies the complete repository, including its full commit history. This lets each collaborator work and review history independently and offline.
Example13 · Introduction to Git and GitHub
A government developer wants to try an experimental tax-form validator without disturbing the stable code that other team members build from every day. Which Git concept best fits this need?
・Deleting the remote repository and recreating it with the experimental code added in
Incorrect. Deleting and recreating the repository would destroy shared history and is unnecessary for isolating work.
✓Creating a branch so the experimental work is isolated from the stable line of development
Correct. A branch provides an isolated line of development so experiments do not affect the stable default branch until merged.
・Editing the files directly on the default branch and relying on everyone to avoid that area
Incorrect. Editing the default branch directly exposes everyone to unfinished, possibly broken changes.
・Making a brand-new unrelated repository and manually copying files back later by hand
Incorrect. A separate unrelated repository loses shared history and forces error-prone manual copying.
Explanation
Branches let developers isolate work so experiments proceed without affecting the stable default branch. When ready, the branch can be merged back.
Example14 · Introduction to Git and GitHub
A boutique consultancy stores a client proposal repository on each consultant's laptop. When a consultant clones the repository, they can commit, view full history, and compare past versions entirely offline while flying to a client site. Which characteristic of Git best explains why this fully offline workflow is possible?
✓Git is distributed, so every clone holds the project's complete history locally
Correct. Git is distributed, so every clone holds the full history and objects, enabling commits, diffs, and log inspection without any network connection.
・Git depends on a central server reachable for every single commit, rejecting offline commits
Incorrect. Git does not require a central server for each commit; commits are recorded in the local repository first.
・Git stores only the latest version of each file
Incorrect. Git keeps the full snapshot history, not just the latest version of each file.
・Git keeps a temporary file cache that expires once the laptop goes offline
Incorrect. A clone is a complete, permanent local repository, not an expiring temporary cache of a few files.
Explanation
Git's distributed model gives every clone the entire repository, so a consultant can work, commit, and inspect history offline. Synchronization with others happens later through push and fetch when a connection is available.
Example15 · Introduction to Git and GitHub
A nonprofit's volunteer wants to safely experiment with a new donation-page layout without disturbing the stable code that the live website is built from. What is the primary purpose of creating a Git branch for this experiment?
✓To isolate the experimental donation-page work on its own separate development line, keeping the stable live-site code safe until merged
Correct. A branch provides an isolated line of development where the experimental work can proceed without affecting the stable code until it is merged.
・To permanently delete the stable live-site version so only the untested experiment survives
Incorrect. Branching does not delete the stable version; both lines of development coexist.
・To compress the repository history so the donation page loads faster for visitors
Incorrect. Branching organizes development; it does not compress history or change how a site loads for visitors.
・To copy the repository to another GitHub user's account so it cannot be changed
Incorrect. Copying a repository to another account is a fork, not a branch, and branching does not restrict editing.
Explanation
Branches let contributors develop features in isolation from the main line. The experiment can be reviewed and merged later, keeping the stable code intact in the meantime.
▶ Try 10 free questions (graded)