CS FundamentalsVery hardProduct company interview · GATE level
main has commits A-B-C-D-E (E is main's tip). feature was created at C and got commits F and G; then main was merged into feature, creating merge commit H (parents G and E), and one more commit I was made on feature. How many commits does git log main..feature list, and how many does git log feature..main list?
- A. 4 and 2
- B. 4 and 0
- C. 3 and 2
- D. 2 and 0
Correct answer: B. 4 and 0
git log X..Y lists commits reachable from Y but not from X. From feature (I) you reach I, H, G, F and, through H's second parent, E, D, C, B, A. From main (E) you reach E, D, C, B, A. So main..feature is I, H, G, F: 4 commits, including the merge commit. feature..main is empty, because after the merge every commit on main is also reachable from feature - D and E are not 'only on main' any more.
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
- A service runs on 3 identical servers, each 95% available and failing independently; it works when at least 2 of the 3 are up (a majority…
- A system needs all three of its components to work. Their failure times are exponential with MTTFs of 2,000, 5,000 and 10,000 hours. What…
- Two inspectors review the same document independently. Inspector 1 finds 30 defects, inspector 2 finds 24, and 12 defects are found by…
- To estimate remaining defects, 20 artificial defects are seeded into a program. Testing then finds 15 of the seeded defects and 45 genuine…
- In a class hierarchy, B, C and D extend A; E and F extend B; G extends E; H extends C. Using the Chidamber-Kemerer metrics with DIT(A) =…
- A risk has probability 0.4 and would cost ₹50 lakh. Three mitigations are proposed: M1 costs ₹6 lakh and cuts the probability to 0.1; M2…