PrepIQ Using Git with GitHub Ultimate Exam, Exams of Technology

This foundational certification exam evaluates candidates on core version control and collaboration skills with Git and GitHub. Topics include Git basics (commits, branches, merges), pull requests, cloning and forking repositories, resolving merge conflicts, and collaboration workflows. Passing demonstrates competency in managing code repositories and team projects using GitHub effectively.

Typology: Exams

2025/2026

Available from 04/09/2026

shilpi-jain-3
shilpi-jain-3 🇮🇳

2.5

(11)

80K documents

1 / 93

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PrepIQ Using Git with GitHub Ultimate
Exam
**Question 1. Which Git command creates a new empty repository in the current
directory?**
A) git start
B) git init
C) git new
D) git create
Answer: B
Explanation: `git init` initializes a new Git repository, creating a .git folder to track
version history.
**Question 2. In Git terminology, which area holds files that have been modified but
not yet staged?**
A) Working Directory
B) Staging Area
C) Repository
D) Index
Answer: A
Explanation: The Working Directory contains the current checkout of files; changes
appear here before being added to the Staging Area.
**Question 3. Which of the following best describes a distributed version control
system (DVCS)?**
A) Central server holds the only copy of the repository.
B) Every developer has a full copy of the repository history.
C) Changes are committed directly to the main branch only.
D) Only binary files can be versioned.
Answer: B
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d

Partial preview of the text

Download PrepIQ Using Git with GitHub Ultimate Exam and more Exams Technology in PDF only on Docsity!

Exam

Question 1. Which Git command creates a new empty repository in the current directory? A) git start B) git init C) git new D) git create Answer: B Explanation: git init initializes a new Git repository, creating a .git folder to track version history. Question 2. In Git terminology, which area holds files that have been modified but not yet staged? A) Working Directory B) Staging Area C) Repository D) Index Answer: A Explanation: The Working Directory contains the current checkout of files; changes appear here before being added to the Staging Area. Question 3. Which of the following best describes a distributed version control system (DVCS)? A) Central server holds the only copy of the repository. B) Every developer has a full copy of the repository history. C) Changes are committed directly to the main branch only. D) Only binary files can be versioned. Answer: B

Exam

Explanation: DVCS like Git give each clone a complete repository, enabling offline work and easier branching. Question 4. What does the git status command show? A) Commit history graph. B) Differences between two branches. C) Files that are staged, modified, or untracked. D) Remote repository URLs. Answer: C Explanation: git status summarizes the state of the working directory and staging area. Question 5. Which flag added to git log produces a one-line summary for each commit? A) --graph B) --oneline C) --stat D) --decorate Answer: B Explanation: --oneline condenses each commit to a single line showing the abbreviated SHA and message. Question 6. To permanently discard local changes in a tracked file, which command is appropriate? A) git revert file.txt B) git reset --hard HEAD file.txt C) git restore file.txt

Exam

B) git switch -c feature-x C) git checkout -b feature-x D) Both B and C are correct Answer: D Explanation: Both git switch -c and git checkout -b create and checkout a new branch. Question 10. After committing, you realize the commit message contains a typo. Which command lets you edit the most recent commit message? A) git commit --amend B) git rebase -i HEAD~ C) git reset --soft HEAD~ D) git revert HEAD Answer: A Explanation: git commit --amend replaces the last commit with a new one, allowing you to edit the message. Question 11. When merging, what does a fast-forward merge imply? A) A new merge commit is always created. B) The target branch’s HEAD moves forward without a merge commit. C) Conflicts are automatically resolved. D) The source branch is deleted after merge. Answer: B Explanation: If the target branch has no divergent commits, Git simply moves its pointer forward.

Exam

Question 12. Which command lists all remote repositories configured for a local repo? A) git remote -v B) git remote list C) git remote show D) git remote status Answer: A Explanation: git remote -v displays remote names and their fetch/push URLs. Question 13. What does the git fetch command do? A) Merges remote changes into the current branch. B) Downloads objects and refs from a remote without merging. C) Pushes local commits to the remote. D) Deletes remote branches. Answer: B Explanation: git fetch updates remote-tracking branches but does not alter the working tree. Question 14. Which of the following is the correct syntax to push a local branch dev to a remote named origin? A) git push origin dev:dev B) git push dev origin C) git push origin dev D) git push origin/master dev Answer: C

Exam

D) Push the last three commits to the remote. Answer: A Explanation: Interactive rebase (-i) lets you edit, reorder, squash, or drop the specified range of commits. Question 18. Which of the following statements about Git tags is true? A) Tags are mutable references that move with new commits. B) Tags are lightweight pointers that can be signed. C) Tags can only be created on the main branch. D) Tags automatically trigger CI builds. Answer: B Explanation: Git tags are immutable references (lightweight or annotated) that can be GPG-signed to mark releases. Question 19. If you encounter a “detached HEAD” state, which command will safely re-attach HEAD to a branch named main? A) git checkout main B) git merge HEAD C) git reset --hard HEAD D) git branch -f HEAD main Answer: A Explanation: Checking out a branch moves HEAD from the detached commit to the branch tip. Question 20. Which command shows a list of recent actions, including commits that are no longer reachable from any branch? A) git log --all

Exam

B) git reflog C) git fsck --lost-found D) git stash list Answer: B Explanation: git reflog records updates to HEAD, allowing recovery of “lost” commits. Question 21. What does the git reset --soft HEAD~1 command do? A) Deletes the last commit and discards its changes. B) Moves HEAD back one commit, leaving changes staged. C) Moves HEAD back one commit, leaving changes unstaged. D) Resets the working directory to match the remote. Answer: B Explanation: --soft moves the branch pointer but preserves the changes in the index (staged). Question 22. Which remote-tracking branch name would Git create after cloning origin? A) origin/master B) master/origin C) refs/heads/origin D) remote/master Answer: A Explanation: Remote-tracking branches are stored as remote-name/branch-name, e.g., origin/master.

Exam

Explanation: Git LFS replaces large files with lightweight pointers and stores the actual content on a separate server. Question 26. Which command lists all local branches, highlighting the current one? A) git branch -a B) git branch --list C) git branch D) git branch -v Answer: C Explanation: git branch without options shows local branches and marks the current one with an asterisk. Question 27. When you run git pull --rebase, what happens? A) Git merges the remote branch using a merge commit. B) Git rebases your local commits on top of the fetched remote commits. C) Git discards local changes and resets to remote. D) Git creates a new branch named rebase. Answer: B Explanation: --rebase rewrites local commits to appear after the newly fetched commits, avoiding a merge commit. Question 28. Which of the following is a valid way to configure your user name globally for all repositories? A) git config --global user.name "Alice" B) git config --system user.name "Alice" C) git config user.name "Alice"

Exam

D) git set user.name "Alice" Answer: A Explanation: --global writes the setting to ~/.gitconfig, applying it to every repository for the current user. Question 29. In a GitHub Actions workflow file, which key defines when the workflow should run? A) jobs B) on C) steps D) runs-on Answer: B Explanation: The on field specifies triggers such as push, pull_request, or schedule events. Question 30. What does the git merge --no-ff option force? A) A fast-forward merge even if a merge commit is possible. B) Creation of a merge commit even when a fast-forward is possible. C) Abort the merge if conflicts arise. D) Automatically resolve all conflicts. Answer: B Explanation: --no-ff ensures a merge commit is recorded, preserving branch history. Question 31. Which command permanently removes a file from the repository history, not just from the latest commit? A) git rm file.txt

Exam

Question 34. In Git, what does the SHA-1 hash of a commit represent? A) The size of the repository. B) A unique identifier derived from the commit’s contents and metadata. C) The number of files changed. D) The branch name. Answer: B Explanation: SHA-1 is computed from the commit’s tree, parent(s), author, timestamp, and message, ensuring uniqueness. Question 35. Which of the following commands will list the differences between the staging area and the latest commit? A) git diff --cached B) git diff HEAD C) git diff --staged D) Both A and C are correct Answer: D Explanation: --cached and --staged are synonymous, showing changes staged for the next commit. Question 36. What is the effect of setting core.autocrlf to true on Windows? A) Git will convert LF to CRLF on checkout and CRLF to LF on commit. B) Git will ignore all line-ending differences. C) Git will reject files with mixed line endings. D) Git will store files with CRLF in the repository. Answer: A

Exam

Explanation: core.autocrlf=true ensures consistent LF in the repo while providing Windows-style CRLF in the working tree. Question 37. Which GitHub feature allows you to enforce that a PR must have at least one approving review before merging? A) Required status checks B) Branch protection rule – Require pull request reviews before merging C) CODEOWNERS file D) Issue templates Answer: B Explanation: Branch protection can be configured to require an approved review, preventing merges without it. Question 38. In a collaborative workflow, what is the purpose of a “fork”? A) To create a new branch in the same repository. B) To clone a repository under your own GitHub account, allowing independent changes. C) To delete the original repository. D) To archive the repository. Answer: B Explanation: Forking creates a personal copy of another user’s repo, enabling contributions via pull requests. Question 39. Which command can be used to view the commit graph in a compact form? A) git log --graph --oneline --all B) git show --graph

Exam

A) A remote named origin pointing to the source URL. B) A remote named upstream. C) A branch called clone. D) A tag called origin. Answer: A Explanation: Cloning sets up origin as the default remote pointing to the cloned repository. Question 43. Which command can be used to delete a remote branch named feature-x? A) git branch -d feature-x B) git push origin --delete feature-x C) git remote delete feature-x D) git rm -r feature-x Answer: B Explanation: Pushing with --delete removes the specified branch from the remote. Question 44. In GitHub, what does a “milestone” help you track? A) The number of lines of code. B) A set of issues and pull requests grouped by a target date or goal. C) The size of the repository. D) The number of forks. Answer: B Explanation: Milestones aggregate issues/PRs to monitor progress toward a release or deadline.

Exam

Question 45. Which of the following is the correct syntax to add a new SSH key to your GitHub account? A) Upload the public key file via the GitHub web UI. B) Run git config --global ssh-key add C) Use ssh-add -L to register the key with GitHub. D) Edit the .ssh/config file with your GitHub username. Answer: A Explanation: GitHub accepts SSH public keys through the website’s “SSH and GPG keys” settings. Question 46. What does the git bisect command assist with? A) Splitting a repository into multiple sub-modules. B) Finding the commit that introduced a bug by binary search. C) Compressing the object database. D) Reverting the last five commits. Answer: B Explanation: git bisect automates a binary search through commit history to locate a faulty change. Question 47. Which of the following statements about Git’s index (staging area) is true? A) It stores the full history of the repository. B) It is a hidden file named .git/index. C) It is only used during merge conflicts. D) It cannot be inspected directly. Answer: B

Exam

C) It creates a new branch named lease. D) It disables all hooks on the remote. Answer: A Explanation: --force-with-lease adds a safety check to ensure you don’t unintentionally discard remote changes. Question 51. Which Git command can be used to compare the content of two branches dev and main? A) git diff dev..main B) git compare dev main C) git log dev main D) git merge-base dev main Answer: A Explanation: git diff dev..main shows differences that would be introduced if dev were merged into main. Question 52. In GitHub Actions, which token is automatically provided to workflows for authentication with the repository? A) GITHUB_TOKEN B) PERSONAL_ACCESS_TOKEN C) SSH_KEY D) OAUTH_TOKEN Answer: A Explanation: GITHUB_TOKEN is generated for each workflow run, allowing safe authenticated API actions. Question 53. Which of the following best describes a “bare” Git repository?

Exam

A) A repository that contains a working directory. B) A repository without a working tree, used for sharing. C) A repository stored on a USB drive. D) A repository with no branches. Answer: B Explanation: Bare repositories lack a checked-out working directory and are typically used as remote endpoints. Question 54. Which command can be used to apply a previously saved stash and remove it from the stash list? A) git stash apply B) git stash pop C) git stash drop D) git stash clear Answer: B Explanation: git stash pop re-applies the top stash and then deletes it. Question 55. When you add a collaborator to a private GitHub repository, what permission level does “Read” provide? A) Ability to push commits. B) Ability to merge pull requests. C) Ability to clone and view the repository. D) Ability to delete the repository. Answer: C Explanation: “Read” grants cloning and issue access but not write privileges.