Version Control Questions with Answers

15 practice questions on Version Control (Software Engineering & Testing) with answers and step-by-step solutions. Try 10 samples below, then practise all 15 free in the AptiNest app.

Sample questions

Question 1Easy

Why do teams create branches in version control?

  1. To develop features or fixes in isolation without disturbing the main line
  2. To delete old history
  3. To give each file a separate owner who must approve every change made to it
  4. To compress the repository

Answer: A. To develop features or fixes in isolation without disturbing the main line

Explanation

Branches let work proceed in parallel; changes are merged back once they are reviewed and tested.

Step-by-step solution

  1. A branch is a separate line of work.
  2. Teams use branches to build features or fixes without affecting the main line.
  3. Changes are merged back after review: option A.

Why the other options are wrong

  • B. Branches add history; they do not delete it.
  • C. Branches do not assign per-file owners who must approve every change.
  • D. Branches do not compress the repository.

Tip: Branch = isolated work; merge it back when it is reviewed and tested.

Question 2Easy

Software Configuration Management (SCM) is mainly concerned with:

  1. Writing user manuals
  2. Setting up the server hardware, operating system and network configuration for the production environment
  3. Hiring and managing developers
  4. Identifying, controlling and tracking changes to software artifacts and their versions

Answer: D. Identifying, controlling and tracking changes to software artifacts and their versions

Explanation

SCM covers version control, change control, baselines, build and release management and configuration audits.

Step-by-step solution

  1. Software Configuration Management (SCM) manages the software and its versions.
  2. It covers identifying, controlling and tracking changes to artifacts.
  3. That matches option D.

Why the other options are wrong

  • A. Writing user manuals is documentation, not SCM.
  • B. Server hardware and network setup is infrastructure work, not SCM.
  • C. Hiring and managing developers is people management, not SCM.

Tip: SCM = version control, change control, baselines, builds and releases.

Question 3Easy

What is the key difference between a centralised and a distributed version control system?

  1. Centralised systems keep no history
  2. Distributed systems have no branches
  3. Centralised systems cannot store binary files, so images and documents must be kept in a separate repository
  4. In a distributed system every developer has a full copy of the repository history

Answer: D. In a distributed system every developer has a full copy of the repository history

Explanation

In a centralised system the history lives on one server; in a distributed system each clone holds the full history, so many operations work offline.

Step-by-step solution

  1. A centralised system keeps the history on one server.
  2. A distributed system gives each clone the full repository history.
  3. So in a distributed system every developer has a full copy of the history: option D.

Why the other options are wrong

  • A. Centralised systems do keep history, on the central server.
  • B. Distributed systems have branches; branching is a core feature of Git.
  • C. Centralised systems can store binary files, so this limit is false.

Tip: Distributed = full history on every clone, so most operations work offline.

Question 4Easy

Which of the following is a distributed version control system?

  1. CVS
  2. Subversion (SVN)
  3. Git
  4. Perforce in its classic centralised mode

Answer: C. Git

Explanation

Git and Mercurial are distributed; SVN and CVS use a central server as the single source of history.

Step-by-step solution

  1. Git is a distributed version control system.
  2. CVS and Subversion use one central server as the source of history.
  3. Perforce in centralised mode also depends on the server.
  4. So Git is the answer: option C.

Why the other options are wrong

  • A. CVS is centralised.
  • B. Subversion (SVN) is centralised.
  • D. Perforce in its classic centralised mode is centralised.

Tip: Git and Mercurial are distributed; CVS and SVN are centralised.

Question 5Medium

In semantic versioning (MAJOR.MINOR.PATCH), a library at 2.4.7 releases a backward-compatible bug fix. What is the new version?

  1. 3.0.0
  2. 2.4.8
  3. 2.4.7.1
  4. 2.5.0

Answer: B. 2.4.8

Explanation

PATCH is incremented for backward-compatible bug fixes; MINOR and MAJOR stay the same.

Step-by-step solution

  1. Semantic versioning is MAJOR.MINOR.PATCH.
  2. A backward-compatible bug fix increases PATCH.
  3. 2.4.7 becomes 2.4.8: option B.

Why the other options are wrong

  • A. 3.0.0 is for breaking changes, which a bug fix is not.
  • C. 2.4.7.1 is not a valid semantic version; there are only three parts.
  • D. 2.5.0 is for a new backward-compatible feature, not a bug fix.

Tip: Bug fix = PATCH; new compatible feature = MINOR; breaking change = MAJOR.

Question 6Medium

What is a tag in version control usually used for?

  1. Marking a specific commit, such as a release, with a permanent name
  2. Pointing to the newest commit and moving forward automatically whenever new work is committed
  3. Storing passwords
  4. Locking a file against edits

Answer: A. Marking a specific commit, such as a release, with a permanent name

Explanation

Tags label points in history (for example v2.1.0); unlike branches, they do not move as new commits are added.

Step-by-step solution

  1. A tag gives a fixed name to one specific commit.
  2. Tags such as v2.1.0 mark releases.
  3. Unlike branches, a tag does not move when new commits are added: option A.

Why the other options are wrong

  • B. This describes a branch, not a tag; a tag stays fixed.
  • C. Tags are not used for storing passwords.
  • D. Tags do not lock files; locking is a separate feature.

Tip: Branch moves forward with new commits; tag stays on one commit.

Question 7Medium

In trunk-based development, developers:

  1. Integrate small changes into a single main branch frequently, often at least daily
  2. Never use automated tests
  3. Keep long-lived feature branches for months and merge them all together just before each release
  4. Commit only once per release

Answer: A. Integrate small changes into a single main branch frequently, often at least daily

Explanation

Frequent integration into trunk keeps merges small and pairs naturally with continuous integration and feature flags.

Step-by-step solution

  1. Trunk-based development keeps one main branch, called trunk.
  2. Developers merge small changes into trunk frequently, often daily.
  3. That is option A.

Why the other options are wrong

  • B. Trunk-based development relies on automated tests, so this is false.
  • C. Long-lived feature branches are the opposite of trunk-based development.
  • D. Committing only once per release is the opposite of frequent integration.

Tip: Small, frequent merges to trunk keep conflicts small.

Question 8Medium

Older centralised tools often used a 'lock-modify-unlock' model. What model do most modern tools use instead?

  1. Single-writer queue
  2. Lock-modify-delete
  3. Read-only checkout
  4. Copy-modify-merge

Answer: D. Copy-modify-merge

Explanation

Developers work on their own copies concurrently and merge changes, resolving conflicts when they overlap, which supports parallel work.

Step-by-step solution

  1. Lock-modify-unlock stops other people from editing while one person holds the lock.
  2. Modern tools let each developer copy the code, modify it and merge the changes.
  3. Conflicts are resolved when changes overlap: copy-modify-merge, option D.

Why the other options are wrong

  • A. A single-writer queue is not the modern model; many people work at once.
  • B. Lock-modify-delete is not a standard model.
  • C. Read-only checkout blocks editing, which the modern model allows.

Tip: Copy-modify-merge supports parallel work; lock-modify-unlock serialises it.

Question 9Hard

In a three-way merge, what are the three versions the tool compares?

  1. Three random commits from each branch
  2. The first commit, the last commit and HEAD
  3. The two branch tips and their common ancestor (merge base)
  4. The working copy, the staging area and the remote

Answer: C. The two branch tips and their common ancestor (merge base)

Explanation

Comparing each tip with the merge base shows what each side changed, so non-overlapping changes merge automatically and overlapping ones conflict.

Step-by-step solution

  1. A three-way merge compares the two branch tips.
  2. It also compares both tips with their common ancestor, the merge base.
  3. So the three versions are the two tips and the merge base: option C.

Why the other options are wrong

  • A. Random commits do not give a meaningful comparison.
  • B. The first commit, last commit and HEAD are not the three merge inputs.
  • D. The working copy, staging area and remote are not the three merge inputs.

Tip: Three-way merge = two tips plus their common ancestor.

Question 10Hard

Under semantic versioning precedence rules, which list is in increasing order?

  1. 1.0.0-beta, 1.0.0-alpha, 1.0.0, 1.1.0
  2. 1.1.0, 1.0.0, 1.0.0-beta, 1.0.0-alpha
  3. 1.0.0, 1.0.0-alpha, 1.0.0-beta, 1.1.0
  4. 1.0.0-alpha, 1.0.0-beta, 1.0.0, 1.1.0

Answer: D. 1.0.0-alpha, 1.0.0-beta, 1.0.0, 1.1.0

Explanation

A pre-release version has lower precedence than the normal version it precedes, and pre-release labels are compared alphabetically (alpha before beta).

Step-by-step solution

  1. A pre-release version is lower than the normal version it leads to.
  2. Among pre-releases, alpha comes before beta.
  3. So 1.0.0-alpha < 1.0.0-beta < 1.0.0 < 1.1.0, which is option D.

Why the other options are wrong

  • A. 1.0.0-beta comes before 1.0.0-alpha in this list, which is wrong; alpha is lower.
  • B. The list is in decreasing order, not increasing.
  • C. 1.0.0 is listed before the pre-releases, but a pre-release is lower than 1.0.0.

Tip: Precedence: alpha < beta < normal release < next minor version.

Practise all 15 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Software Engineering & Testing topics · All topics