Computer

Version Control Systems: Git & SVN MCQs with Answers

What is the main purpose of version control systems like Git and SVN?
a) To automate software testing
b) To track changes in source code
c) To compile code
d) To enhance software performance

Answer
b) To track changes in source code

Which of the following is a feature of Git?
a) Centralized version control
b) Distributed version control
c) Manual branching
d) No history tracking

Answer
b) Distributed version control

Which command is used to create a new repository in Git?
a) git commit
b) git init
c) git start
d) git create

Answer
b) git init

Which of the following is a primary difference between Git and SVN?
a) Git is centralized, while SVN is distributed
b) Git is distributed, while SVN is centralized
c) SVN supports branching, but Git does not
d) SVN does not support commit history

Answer
b) Git is distributed, while SVN is centralized

What is a repository in the context of version control systems?
a) A system for tracking bugs
b) A place where code changes are stored
c) A programming language
d) A code testing tool

Answer
b) A place where code changes are stored

What command in Git is used to check the current status of your repository?
a) git commit
b) git push
c) git status
d) git log

Answer
c) git status

Which of the following is true about branches in Git?
a) Git branches are permanent and cannot be deleted
b) A branch in Git represents an independent line of development
c) SVN does not support branching
d) Branching is only used in SVN

Answer
b) A branch in Git represents an independent line of development

What does the Git command ‘git merge’ do?
a) Deletes the repository
b) Combines the changes from one branch into another
c) Pushes changes to the remote repository
d) Displays the commit history

Answer
b) Combines the changes from one branch into another

Which command in Git is used to upload changes to a remote repository?
a) git pull
b) git push
c) git fetch
d) git commit

Answer
b) git push

Which of the following is a benefit of using version control?
a) Reduces code complexity
b) Allows multiple developers to work on the same project without conflict
c) Increases software performance
d) Eliminates the need for testing

Answer
b) Allows multiple developers to work on the same project without conflict

In SVN, what is a “commit”?
a) A local change made to the code
b) A command to push code to a remote server
c) A request to merge two branches
d) A change recorded to the repository

Answer
d) A change recorded to the repository

What is the purpose of the ‘git clone’ command?
a) To create a new branch
b) To make a copy of an existing repository
c) To update a repository
d) To commit changes to a repository

Answer
b) To make a copy of an existing repository

In SVN, what is a “working copy”?
a) A backup of the repository
b) A local copy of files that are checked out from the repository
c) A history of commits
d) A version control configuration file

Answer
b) A local copy of files that are checked out from the repository

Which of the following commands is used to view the commit history in Git?
a) git commit
b) git log
c) git status
d) git push

Answer
b) git log

Which command in Git is used to download changes from a remote repository?
a) git fetch
b) git push
c) git clone
d) git pull

Answer
d) git pull

What does ‘git reset’ do?
a) Creates a new branch
b) Reverts the repository to a previous commit
c) Deletes the local repository
d) Clones the remote repository

Answer
b) Reverts the repository to a previous commit

Which of the following is a disadvantage of using SVN over Git?
a) SVN supports branching better than Git
b) SVN is less flexible in handling large repositories
c) Git is centralized while SVN is decentralized
d) Git has no support for binary files

Answer
b) SVN is less flexible in handling large repositories

In Git, what is a “commit”?
a) A local branch
b) A snapshot of the repository at a specific point in time
c) A remote repository
d) A process to push changes

Answer
b) A snapshot of the repository at a specific point in time

What does the Git command ‘git pull’ do?
a) Pushes changes to the remote repository
b) Downloads and merges changes from a remote repository
c) Deletes the local repository
d) Creates a new branch

Answer
b) Downloads and merges changes from a remote repository

Which of the following tools is used to merge branches in Git?
a) git merge
b) git reset
c) git clone
d) git pull

Answer
a) git merge

What does ‘git rebase’ do in Git?
a) Deletes all commits
b) Combines branches into one
c) Applies changes from one branch to another as if they were made in sequence
d) Creates a new repository

Answer
c) Applies changes from one branch to another as if they were made in sequence

What is a “tag” in Git?
a) A reference to a specific point in Git history
b) A method for pushing changes to the remote repository
c) A branch used for testing
d) A submodule of a repository

Answer
a) A reference to a specific point in Git history

Which of the following is an advantage of using Git over SVN?
a) Git has a centralized version control system
b) Git supports offline commits and local repositories
c) Git does not support branching
d) Git has less version history tracking than SVN

Answer
b) Git supports offline commits and local repositories

What does the ‘git push’ command do?
a) Downloads changes from a remote repository
b) Sends local commits to a remote repository
c) Creates a new branch
d) Deletes a branch

Answer
b) Sends local commits to a remote repository

What is the “conflict” in version control systems?
a) When multiple users commit changes to the same code area, causing incompatibility
b) When a branch is deleted
c) When a new branch is created
d) When there are no changes to commit

Answer
a) When multiple users commit changes to the same code area, causing incompatibility

Which command in Git is used to remove files from the staging area?
a) git reset
b) git remove
c) git delete
d) git clean

Answer
a) git reset

Which file in Git tracks the repositories’ ignored files?
a) .gitignore
b) .gitconfig
c) .gitkeep
d) .gitattributes

Answer
a) .gitignore

What is a “branch” in version control systems?
a) A history of changes in the repository
b) A copy of the repository at a specific point in time
c) A pointer to a commit in Git
d) A separate line of development for features or fixes

Answer
d) A separate line of development for features or fixes

Which of the following SVN commands is used to check for updates in a working copy?
a) svn commit
b) svn update
c) svn status
d) svn log

Answer
b) svn update

What does ‘git fetch’ do in Git?
a) Uploads local changes to the remote repository
b) Downloads updates from the remote repository but doesn’t merge them
c) Deletes remote branches
d) Creates a new branch

Answer
b) Downloads updates from the remote repository but doesn’t merge them

What is a “remote” in Git?
a) A version control repository located locally
b) A branch that is only available on GitHub
c) A repository that is hosted on a different server
d) A backup of the repository

Answer
c) A repository that is hosted on a different server

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button