Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
You're offline
Unit 2 MCQsVersion Control & Source Code Management
Answer: Tracking bugs, tasks, and feature requests
GitHub Issues let teams report bugs, request features, and track tasks related to a project.
Question 21 of 60 · Why Version Control? · Medium
A team of five developers is working on the same codebase without any version control system. Which problem are they most likely to encounter first?
Not quite. Try another option.
Answer: Overwriting each other's changes when copying files manually
Without version control, concurrent edits are hard to reconcile and developers often overwrite one another's work. Version control tracks changes and enables safe collaboration.
Question 22 of 60 · Git Repositories · Medium
You run git init inside an existing project folder. What is created as a result?
Not quite. Try another option.
Answer: A hidden .git directory that stores repository metadata and history
git init creates a local .git directory containing objects, refs, and configuration. No remote or commit is created automatically.
Question 23 of 60 · Git Cmd/Bash: Git basic operations (add, init, push, pull) · Medium
After editing app.js, you run git commit -m "fix" but Git reports nothing to commit. What did you most likely forget?
Not quite. Try another option.
Answer: To stage the file with git add app.js
Git commits only staged changes. Modified files must be added to the staging area with git add before git commit records them.
Question 24 of 60 · Git Cmd/Bash: Git basic operations (add, init, push, pull) · Medium
Your local branch is behind the remote. Which command updates your local branch by fetching and integrating remote changes in one step?
Not quite. Try another option.
Answer: git pull
git pull combines git fetch (download remote changes) and git merge (integrate them) into a single command.
Question 25 of 60 · Commits · Medium
What does the SHA-1 hash associated with a Git commit primarily represent?
Not quite. Try another option.
Answer: A unique identifier derived from the commit's content and metadata
Each commit hash is computed from its tree, parent, author, message, and other metadata, giving every commit a unique, tamper-evident ID.
Question 26 of 60 · Commits · Medium
You committed with the wrong message and have not pushed yet. Which command lets you correct only the message of the most recent commit?
Not quite. Try another option.
Answer: git commit --amend
git commit --amend rewrites the latest commit, allowing you to change its message. It is safe on commits that have not been pushed.
Question 27 of 60 · Branching · Medium
Which single command creates a new branch called featureand switches to it immediately?
Not quite. Try another option.
Answer: git checkout -b feature
git checkout -b feature creates the branch and checks it out in one step. git branch feature only creates it without switching.
Question 28 of 60 · Branching · Medium
In Git, what does a branch fundamentally point to?
Not quite. Try another option.
Answer: A movable reference to a specific commit
A branch is a lightweight, movable pointer to a commit. As you add commits, the branch pointer advances automatically.
Question 29 of 60 · Merging · Medium
You merge feature into main, and main had no new commits since feature diverged. What type of merge does Git perform by default?
Not quite. Try another option.
Answer: A fast-forward merge
When the target branch has not advanced, Git simply moves the branch pointer forward (fast-forward) without creating a merge commit.
Question 30 of 60 · Merging · Medium
When Git creates a merge commit during a three-way merge, how many parent commits does that merge commit have?
Not quite. Try another option.
Answer: Two
A standard merge commit records two parents: the tip of the current branch and the tip of the branch being merged in.
Question 31 of 60 · tagging · Medium
Your team wants to mark commit v1.0 with a tag that stores the tagger name, date, and a message. Which command creates such an annotated tag?
Not quite. Try another option.
Answer: git tag -a v1.0 -m "release 1.0"
The -a flag creates an annotated tag storing metadata like tagger and message. A plain git tag v1.0 creates a lightweight tag without that data.
Question 32 of 60 · rebasing · Medium
What is the primary effect of running git rebase main while on your feature branch?
Not quite. Try another option.
Answer: Replays your feature commits on top of the latest main, creating a linear history
Rebasing moves your branch's commits to begin from the tip of main, producing a cleaner, linear history without merge commits.
Question 33 of 60 · rebasing · Medium
Why is it generally discouraged to rebase commits that have already been pushed to a shared remote branch?
Not quite. Try another option.
Answer: It rewrites commit history, causing divergence for collaborators
Rebasing creates new commit hashes. If others already based work on the old commits, the rewritten history causes confusing divergence and forced pushes.
Question 34 of 60 · stashing · Medium
You have uncommitted changes but must quickly switch branches to fix a bug. Which command temporarily saves your work and cleans the working directory?
Not quite. Try another option.
Answer: git stash
git stash saves your uncommitted changes onto a stack and reverts the working directory to a clean state, letting you switch contexts safely.
Question 35 of 60 · stashing · Medium
After stashing changes, which command reapplies the most recent stash and removes it from the stash list?
Not quite. Try another option.
Answer: git stash pop
git stash pop applies the latest stash and deletes it from the stack. git stash apply reapplies it but keeps it in the list.
Question 36 of 60 · Git Remote Workflows: GitHub Flow · Medium
In GitHub Flow, what is the recommended way to introduce a new feature into the main branch?
Not quite. Try another option.
Answer: Create a branch, open a pull request, review, then merge into main
GitHub Flow uses short-lived branches and pull requests for review before merging into a continuously deployable main branch.
Question 37 of 60 · Feature Branch Workflow · Medium
In the Feature Branch Workflow, what is the main purpose of keeping each feature on its own branch?
Not quite. Try another option.
Answer: To isolate work so main always stays stable and deployable
Feature branches encapsulate in-progress work, keeping the shared main branch stable until the feature is complete and reviewed.
Question 38 of 60 · Resolving Merge Conflicts · Medium
While merging, Git inserts markers like <<<<<<<, =======, and >>>>>>> into a file. What must you do to complete the merge?
Not quite. Try another option.
Answer: Edit the file to keep the desired content, remove the markers, then stage and commit
Conflict markers show the competing changes. You manually resolve them, delete the markers, git add the file, and commit to finish the merge.
Question 39 of 60 · GitHub: Issues · Medium
On GitHub, which feature is best suited for tracking a reported bug and discussing how to fix it before any code is written?
Not quite. Try another option.
Answer: An Issue
GitHub Issues track bugs, tasks, and feature requests, providing a place to describe and discuss work before implementation begins.
Question 40 of 60 · Pull Requests · Medium
In a GitHub pull request, what does linking it to an issue with a keyword like Closes #42 accomplish?
Not quite. Try another option.
Answer: Automatically closes issue #42 when the pull request is merged
Closing keywords such as Closes, Fixes, or Resolves in a PR link it to an issue and auto-close that issue upon merge.
Question 41 of 60 · Git Cmd/Bash: Git basic operations (add, init, push, pull) · Hard
You run git init in a directory that is already inside an existing Git repository's working tree (a subfolder). What is the actual effect?
Not quite. Try another option.
Answer: It creates a new nested repository in the subfolder, and files there are now tracked by the inner repo, effectively shadowing the outer repository for that path unless carefully managed
git init simply creates a .git directory wherever it is run. Git permits nested repositories; the innermost .git takes precedence for commands run inside that folder, which can cause confusing shadowing. It is not automatically made a submodule.
Question 42 of 60 · Commits · Hard
A commit C has SHA abc123. You amend it with git commit --amend without changing anything except the author date. Which statement is true about the resulting commit?
Not quite. Try another option.
Answer: It produces a new commit with a different SHA, because the SHA is a hash over content including metadata such as author/committer info and timestamps
A commit object's SHA hashes the tree, parents, author, committer, and message. Changing any metadata (like author date) yields a new hash, hence a new SHA, even if the tree is identical.
Question 43 of 60 · rebasing · Hard
You rebase your feature branch onto main with git rebase main. Midway a conflict appears. After editing files and running git add, which command correctly continues the rebase?
Not quite. Try another option.
Answer: git rebase --continue
After staging the resolved files with git add, git rebase --continue reapplies the remaining commits. --resume and --next are not valid rebase subcommands, and you should not create a new commit manually.
Question 44 of 60 · Merging · Hard
Branch feature and main have diverged. You run git merge feature on main and Git performs a fast-forward. What must have been true?
Not quite. Try another option.
Answer: main had no commits that were not already reachable from feature, so main's tip is an ancestor of feature
A fast-forward is only possible when the current branch tip is an ancestor of the target; Git just moves the pointer forward. No merge commit is created, and it never happens with truly divergent histories.
Question 45 of 60 · stashing · Hard
You have staged changes to a.txt and unstaged changes to b.txt. You run git stash push, then later git stash pop. By default, what is the state of the staging area after popping?
Not quite. Try another option.
Answer: Both a.txt and b.txt changes return as unstaged; the original staged/unstaged distinction is lost unless --index was used
By default git stash pop restores all changes as unstaged. To preserve which files were staged, you must pop with --index.
Question 46 of 60 · tagging · Hard
What is the key structural difference between a lightweight tag and an annotated tag in Git?
Not quite. Try another option.
Answer: A lightweight tag is just a named pointer to a commit, whereas an annotated tag is a full Git object storing tagger name, date, message, and optional GPG signature, referencing the commit it points to
Lightweight tags are simple refs pointing at a commit. Annotated tags are stored as their own objects with metadata and can be signed, which is why they are preferred for releases.
Question 47 of 60 · Resolving Merge Conflicts · Hard
During a conflict, you see markers <<<<<<< HEAD, =======, and >>>>>>> feature. Which section sits between <<<<<<< HEAD and =======?
Not quite. Try another option.
Answer: The content from your current branch (HEAD)
The region between <<<<<<< HEAD and ======= is your current branch's version; the region between ======= and >>>>>>> feature is the incoming branch's version. Git does not auto-generate a suggestion in default conflict markers.
Question 48 of 60 · rebasing · Hard
Why is rebasing a branch that has already been pushed and pulled by collaborators considered dangerous?
Not quite. Try another option.
Answer: Rebasing rewrites commit history creating new SHAs, so collaborators' local branches diverge from the rewritten remote, causing duplicated commits and painful conflicts on their next pull
Rebase creates new commit objects with new SHAs. Shared history that others based work on now conflicts with the rewritten history, so the golden rule is: never rebase public/shared branches.
Question 49 of 60 · Git Remote Workflows: GitHub Flow · Hard
In GitHub Flow, which sequence best reflects the intended workflow?
Not quite. Try another option.
Answer: Create a branch from main, commit work, open a pull request, discuss/review, deploy or test, then merge to main
GitHub Flow is lightweight: main is always deployable, work happens on short-lived branches, and changes reach main through pull requests. The other options describe Git Flow-style multi-branch models.
Question 50 of 60 · Branching · Hard
You create a branch with git branch feature but keep committing. Later you notice your new commits landed on main instead of feature. Why?
Not quite. Try another option.
Answer: git branch feature only creates the branch; it does not switch to it, so HEAD stayed on main
git branch feature creates the ref but leaves HEAD on the current branch. Use git checkout -b feature or git switch -c feature to create and switch in one step.
Question 51 of 60 · Git Repositories · Hard
What does the term "bare repository" refer to in Git, and why is it used for remotes?
Not quite. Try another option.
Answer: A repository without a working tree, containing only the version-control data, so pushes cannot conflict with checked-out files, making it ideal as a shared central remote
Bare repos (typically *.git) have no working directory. This avoids ambiguity when others push, which is why central/shared remotes are bare.
Question 52 of 60 · Git Cmd/Bash: Git basic operations (add, init, push, pull) · Hard
git pull is conceptually equivalent to which combination of operations by default?
Not quite. Try another option.
Answer: git fetch followed by git merge of the tracked upstream branch into the current branch
By default git pull = git fetch + git merge. It becomes fetch + rebase only if pull.rebase is set or --rebase is passed.
Question 53 of 60 · Merging · Hard
What distinguishes a "recursive" (or "ort") merge from an "octopus" merge in Git?
Not quite. Try another option.
Answer: Recursive/ort merges two branches and can resolve criss-cross histories, while octopus merges three or more branches in a single commit but refuses conflicting merges
The default recursive/ort strategy handles two-head merges including multiple merge bases. Octopus is used to merge several branches at once and cannot handle merges that require conflict resolution.
Question 54 of 60 · GitHub: Issues, Pull Requests, Discussions · Hard
In a GitHub pull request description, you write "Closes #42". What happens when the PR is merged into the default branch?
Not quite. Try another option.
Answer: Issue #42 is automatically closed and linked to the merging commit
Keywords like Closes, Fixes, or Resolves followed by an issue number auto-close the referenced issue when the PR merges into the default branch. Issues are closed, never deleted, this way.
Question 55 of 60 · stashing · Hard
By default, git stash does NOT stash which category of files?
Not quite. Try another option.
Answer: Untracked and ignored files (unless -u or -a is specified)
Plain git stash saves tracked modified/staged files but leaves untracked and ignored files behind. Use -u to include untracked and -a to also include ignored files.
Question 56 of 60 · Git Remote Workflows: Feature Branch Workflow · Hard
In the Feature Branch Workflow, why should feature branches be kept short-lived and frequently synced with the integration branch?
Not quite. Try another option.
Answer: Long-lived branches accumulate divergence, increasing the size and difficulty of merge conflicts and delaying integration feedback
The more a branch diverges from the integration branch, the larger and harder the eventual merge. Keeping branches short and syncing often reduces conflict pain and surfaces integration problems early.
Question 57 of 60 · rebasing · Hard
During an interactive rebase (git rebase -i), you want to combine a commit into the previous one while discarding the combined commit's message. Which action word should you use?
Not quite. Try another option.
Answer: fixup
fixup melds the commit into the previous one and discards its message. squash also combines but keeps/prompts for both messages; reword changes a message; edit pauses for amending.
Question 58 of 60 · Commits · Hard
You accidentally committed a large secret file, then made 5 more commits. To completely remove that file from all of history (not just the latest commit), which is the appropriate approach?
Not quite. Try another option.
Answer: Use a history-rewriting tool such as git filter-repo (or BFG) to purge the file from every commit, then force-push and rotate the secret
The file exists in the blobs of past commits, so only rewriting history (filter-repo/BFG) removes it everywhere. .gitignore, git rm --cached, and git revert only affect future or current state, not past commits. Always rotate the leaked secret.
Question 59 of 60 · Why Version Control? · Hard
Which scenario most directly demonstrates a capability that distributed version control (like Git) provides but a purely centralized system (like classic CVS/SVN) does not?
Not quite. Try another option.
Answer: A developer offline on a plane commits repeatedly, browses full history, and creates branches, all without any server connection
In a DVCS every clone is a full repository with complete history, so committing, branching, and viewing history work offline. Centralized systems require the server for most operations. Conflicts and permission sync are not solved by distribution alone.
Question 60 of 60 · Resolving Merge Conflicts · Hard
After a botched conflict resolution during git merge, you want to abandon the merge and return the working tree to the exact state before you started. Which command does this?
Not quite. Try another option.
Answer: git merge --abort
git merge --abort aborts the in-progress merge and restores the pre-merge state. --continue proceeds, --theirs picks one side, and a soft reset does not undo the conflicted working-tree state.
That's unit 2
Answer a few questions and your score shows up here.
Nearly through. Did unit 2 of INT331 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 2 of INT331 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.