devHọc Dev

Week 1 - Day 6: Week 1 Review Quiz

Week 1 – Day 6

30 questions0s
See the answer and explanation right after each question
1
In the Git object model, which object type stores the contents of a file (without the filename)?
2
You have two files, src/button.css and components/button.css, with exactly the same content. How does Git store them?
3
git status shows the output below. Which file is "staged for commit"?
M  src/auth.js
 M README.md
?? temp.txt
4
A teammate reviewing your code sees the commit message "fixed stuff". Which Conventional Commits rule does this commit violate?
5
You're editing src/auth.js and want to stage only one specific chunk (hunk) of the file, not the whole file. Which command fits?
6
You just ran git add README.md and git add src/app.js. Now you want to unstage README.md but KEEP the changes in the file. What is the correct command?
7
Look at the graph below. When you run git merge feature/login from main, what kind of merge does Git perform?
A ── B ── C    ← main (HEAD)
          └── D ── E    ← feature/login
8
Look at the graph below. When you run git merge feature/login from main, what kind of merge does Git perform?
A ── B ── C ── F    ← main (HEAD)
          └── D ── E    ← feature/login
9
You want to delete the local branch feature/old. git branch -d feature/old fails. What could be the cause?
10
After git fetch origin, which statement is true?
11
You rebased feature/auth locally and want to update the remote. Which command is the safest?
12
What is the most important difference between git pull --rebase and git pull (default merge)?
13
You just ran git reset --hard HEAD~2 and realize you accidentally removed 2 important commits. How do you get them back?
14
Scenario: you're halfway through a feature and your lead asks you to fix an urgent bug right now. What is the best approach?
15
You pushed a commit to main but it contains a bug. Teammates have already pulled and are working on top of it. What is the right way to undo it?
16
A 3-person team deploys to production continuously, several times a day, with no clear version releases. Which workflow fits best?
17
You're using Git Flow. A new feature has been merged into develop. When do you create the release/1.3.0 branch?
18
Under SemVer, you're at v2.4.1. You add a new, fully backward-compatible feature. What is the next version?
19
The company just pushed a hotfix for a production bug. After the hotfix is merged into main and tagged v1.2.1, what step is mandatory next?
20
Your agency forked the client repository. After setup, what else should you configure for the upstream remote?
21
You're on the feature/my-task branch. The client just pushed 5 new commits to upstream/main. The team requires linear history (no merge commits). What is the correct order to sync?
22
While rebasing a feature branch onto upstream/main, Git reports a conflict in the 2nd of 5 commits. After you resolve it and git add the file, what is the next command?
23
You know feature X worked in v2.0.0 but is broken at HEAD. There are 300 commits in between. Which tool is the most efficient for finding the culprit commit?
24
You need to backport a bug fix from hotfix/2.1.1 to release/1.8 (an older version that is still maintained). hotfix/2.1.1 has 2 commits: abc1234 (bug fix) and def5678 (update CHANGELOG). Which command backports ONLY the bug-fix commit?
25
You're coding feature/dashboard and your lead asks you to review a teammate's feature/auth-refactor branch right away, without stopping your current work. What is the best approach?
26
Select all that apply
(Choose 2) You installed Husky and lint-staged in a Node.js project. When a developer runs git commit, which of the following happen, in the correct order?
27
How does git stash push -u -m "WIP: feature in progress" differ from a plain git stash?
28
You just made a local commit (not pushed) and realize it bundles 2 unrelated changes. You want to drop the commit and keep every change in the working directory unstaged, so you can git add -p and recommit as 2 commits. Which command is correct?
29
You edited src/config.js by mistake (not git added, not committed) and want to discard the changes in that file, returning it to the content of the latest commit. Other files you are still editing must stay untouched. Which command is correct?
30
After a PR is merged into upstream/main, you need to sync the fork. You are on main; local main (and origin/main) has a commit of its own that is not on upstream, and the team requires linear history (no merge commits). Which command sequence is the shortest while still correct and complete (in order)?