27th
Mar
GIT MCQ

GIT MCQ

  • Admin
  • 27th Mar, 2021
  • 924 Followers

GIT MCQ Quiz

Following are mostly asked Git MCQ test that are designed for professionals like you to crack you interviews. You can take this Git online test before appearing to you real interview. This Git quiz there are around 30+ multiple choice questions on Git with four options.

1) Which Command is used to show limited number of commits?

  • A. git status
  • B. git config
  • C. git log -n
  • D. git fetch

2) Which command defines the author email to be used for all commits by the current user:

  • A. git config --global user.email
  • B. git email--amend
  • C. git merge --no-ff
  • D. git clean -f

3) ........ command is useful for getting a high-level overview of the project history:

  • A. git reset --hard
  • B. git rebase
  • C. git log --oneline
  • D. git log --author=""

4) Command to download all the objects and references from a specified repository:

  • A. git log -n
  • B. git config --list
  • C. git help
  • D. git fetch

5) Which Git command displays the patch representing each commit:

  • A. git branch
  • B. git log -p
  • C. git log
  • D. git remote -v
Download Free : GIT MCQ PDF

6) Which of the following git command that downloads your repository from GitHub to your computer?

  • A. git clone
  • B. git commit
  • C. git fork
  • D. git push

7) Which of the following shortcut to staging all the changes you have?

  • A. git add
  • B. git commit
  • C. git commit add
  • D. git push -am "Message"

8) What is full form of VCS?

  • A. Version Configuration Solutions
  • B. Version Configuration System
  • C. Version Control System
  • D. Version Consolidated Solutions

9) Git is a;

  • A. Localized version control system
  • B. Distributed version control system
  • C. Centralized version control system
  • D. None

10) Which of the following is true about Centralized version control system?

  • A. It is victim to single point of failure
  • B. It does not rely on the central server
  • C. It rely on the central server
  • D. Both A and C

11) The files that can be committed are always present in git:

  • A. staging area
  • B. unstaged area
  • C. working directory
  • D. none

12) Git can be used for which project?

  • A. .Net project
  • B. File version management
  • C. Java enterprise project
  • D. All of the above

13) Which of the following terminology is not related to git?

  • A. branch
  • B. stem
  • C. fork
  • D. staging area

14) Which of the following is not true about git?

  • A. Pull operation copies the changes from a local repository to remote repository
  • B. By default Git has a master branch
  • C. Git clone operation creates the instance of the repository.
  • D. none

15) Which of the following git command can be used to check the stored stashes?

  • A. git stash
  • B. git stash map
  • C. git stash list
  • D. git stash set

16) Which of the following option is not valid with git stash command?

  • A. git stash list pop
  • B. git stash list clear
  • C. git stash list push
  • D. git stash changes

17) Which of the following statement is true about git ignore file?

  • A. We can create multiple ignore files in a different directory.
  • B. The .gitignore file contains all the formats and files that should be ignored while commit
  • C. Both of the above.
  • D. None

18) Which command helps us to see the tracked, untracked files and changes but does not show any commit records?

  • A. git diff
  • B. git status
  • C. git log
  • D. None of these

19) Git log command contains following data:

  • A. commit date metadata
  • B. commit hash
  • C. commit author metadata
  • D. All of the above

20) git log --oneline command will display:

  • A. the first seven characters of the SHA
  • B. one commit per line
  • C. the commit message
  • D. Only A, B & C

21) The reference to the remote repository from where a project was initially cloned is called :

  • A. tag
  • B. index
  • C. head
  • D. origin

22) Tags in git can be:

  • A. heavy-weighted tag
  • B. light-weighted tag
  • C. annotated tag
  • D. Only B & C

23) Which is the correct git command to add files to the repository?

  • A. git add fileName
  • B. git add
  • C. Both of the above.
  • D. None

24) Which of the following is the correct git command to commit changes with proper message?

  • A. git commit -m "message"
  • B. git commit -a "message"
  • C. git commit "message"
  • D. None of these

25) Which of the following git command helps to add multiple changes at the same time?

  • A. git add
  • B. git add ...
  • C. git add -all
  • D. git add . "fileName"

26) What does the below git command indicates? git add *.java

  • A. The above command will exclude all the Java files while staging
  • B. It will give error - "invalid command"
  • C. The above command will commit all the Java files
  • D. The above command will stage all the Java source files

27) Which of the following is git tool?

  • A. GitK
  • B. Git Bash
  • C. Git GUI
  • D. All of the above

28) ........ is a version of the repository that diverges from the main working project:

  • A. master
  • B. fork
  • C. branch
  • D. clone

29) Which of the following are type of reset facility available in git?

  • A. hard
  • B. soft
  • C. mixed

30) Who created Git?

  • A. Dennis Ritchie
  • B. Linus Babbage
  • C. Linus Torvalds
  • D. James Gosling

Git Online Test Questions (Git FAQs)

1) What is Subgit?

Subgit is stress free tool that helps in migration to GIT from SVN. It can be used with the server of Git be it the Gitlab, Github, or even the Bitbucket.

2) How to git remove file from commit?

In order to remove some files from a Git commit, use the "git reset" command with the "–soft" option and specify the commit before HEAD. To remove files from commits, use the "git restore" command, specify the source using the "–source" option and the file to be removed from the repository.

3) Which git command defines the author email to be used for all commits by the current user?

git config --global user.email command defines the author email to be used for all commits by the current user.

4) How to add Multi-line Git commit message from CLI?

To add Multi-line Git commit message from CLI

git commit -m 'message one' -m 'message 2' -m 'message n'

5) How to change the date of a commit in Git?

You can use GIT_COMMITTER_DATE="$(date)" git commit --amend --no-edit --date "$(date)" to change the date of a commit in Git.

6) How to clone a specific branch in git?

For this, you must execute the "git branch" with the "-b" and mention the branch that you would want for cloning.

7) What git commit --allow-empty command do?

It make empty commits on throw away branches so that I can trigger various kinds of things for a variety of different reasons.

git commit --allow-empty -m "Trigger xyz"

8) How to completely overwrite local master with remote?

You can use git reset --hard origin/master to completely overwrite local master with remote

9) What is best way to delete unused local branches in Git?

The Easy way to delete unused local branches in Git is

git checkout master
git branch | xargs git branch -d

10) How to undo a git commit --amend?

What you need to do is to create a new commit with the same details as the current HEAD commit, but with the parent as the previous version of HEAD. git reset --soft will move the branch pointer so that the next commit happens on top of a different commit from where the current branch head is now.

Example

git reset --soft HEAD@{1}
git commit -C HEAD@{1}

11) List some git basic commands?

git add, git status , git branch, git init, git commit, git config, git checkout, git merge are few basic git commands.

12) How to resolve git status "Unmerged paths:"?

Perform following steps to resolve git status "Unmerged paths:"

# if the file in the right place isn't already committed:
git add 

# remove the "both deleted" file from the index:
git rm --cached ../public/images/originals/dog.ai

# commit the merge:
git commit

13) How to display list of files containing conflicts in Git?

With git rebase you can always get the list files with conflicts that shall keep continuing.

14) What is the name of the branch where the deployment-ready code is kept?

It is the central branch which the developers in the team uses and always were in a deployment-ready state. In short the main brand for the project shall have the quality work and also the tested one.

15) Which git command is used to see a repository's history?

It is the Git's basic tool which is a git log command that can help to explore the repository's history. It is what you shall be using when you are looking for some version of the figure or the project that needs to be introduced by blending in the feature branch.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

01st
Dec
Wordpress MCQ
01st
Mar
Xml MCQ
01st
Dec
MongoDB MCQ
01st
Mar
AJAX MCQ
01st
Jan
MSBI MCQ