CS FundamentalsHardProduct-company MCQ pattern
main has commits A–B–C. Branch feature was created from B and has commits D–E. On feature you run git rebase main. How many of these statements are true afterwards? 1. feature now reads A–B–C–D′–E′. 2. D′ and E′ have the same commit hashes as D and E. 3. git log main..feature lists exactly 2 commits. 4. Running git merge feature on main now produces a fast-forward.
- A. Only one
- B. Only two
- C. Only three
- D. All four
Correct answer: C. Only three
1, 3 and 4 are true: rebase replays D and E on top of C, so feature is two commits ahead and main can fast-forward. 2 is false: the replayed commits have a new parent, so their hashes change even though the diffs are the same. So three are true.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- How many of the following statements about git reset are correct? 1. git reset --mixed HEAD~1 removes the last commit and leaves its…
- On main you run git merge --squash feature and then git commit. Afterwards you try git branch -d feature. What happens?
- You checked out an old commit by its hash, made two commits, then ran git checkout main. What happened to those two commits?
- A file secrets.env was committed last month. Today you add secrets.env to .gitignore and commit. Why does git status still show changes to…
- Two developers branch from the same commit. In which of these situations will git merge report a conflict? 1. Both changed different…
- Match each SOLID principle with the violation it forbids. P. Single Responsibility Q. Interface Segregation R. Open/Closed S. Dependency…