MCQ

Git MCQs – Multiple Choice Questions and Answers – Part 2

Multiple choice questions and answers (MCQs) on Git to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as pushing the code, pulling the code, versioning, git commands, and more. This quiz will easily prepare anyone to pass their online test.
 

1. How do I add a message to a commit?

A $ git message "Fix error in xxxx"

B $ git add "Fix error in xxxx"

C $ git commit "Fix error in xxxx"

D $ git commit -m "Fix error in xxxx"

D

 

 

2. What is the correct syntax for committing all changes with a message?

A $ git message -am "Fix error in xxxx"

B $ git add -a "Fix error in xxxx"

C $ git commit -a "Fix error in xxxx"

D $ git commit -am "Fix error in xxxx"

D

 

 

3. Which comes first _____?

A $ git add

B $ git commit

A

 

 

4. You can type “git status” at any time in a directory controlled by git to check the status of your files.

A True

B False

A

 

 

5. We have just created a new file called “home.html”. Which of the following will add this file so that we can commit it in git?

A $ git add home.html

B $ git add new

C $ git add -a home.html

D $ git git commit home.html

A

 

 

6. Which of the following commands used to show all parameters in git?

A $ git config --list

B $ git config -a

C $ git config --all

D $ git config --parameters --list

A

 

 

7. Which of the following commands used to return to the master branch?

A $ git checkout origin

B $ git checkout -b master

C $ git checkout master

D $ git checkout branche

C

 

 

8. Which of the following commands used to undo a commit?

A $ git reset <commit>

B $ git revert <commit>

C $ git reset --hard origin/master

D $ git init

B

 

 

9. Which of the following commands used to permanently cancel a commit?

A $ git reset <commit>

B $ git revert <commit>

C $ git reset --hard origin/master

D $ git init

A

 

 

10. How to create a new branch and switch to it directly?

A $ git checkout <branch-name>

B $ git branch <branch-name>

C $ git checkout -b <branch-name>

D $ git branch -new <branch-name>

C

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

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