Git MCQ: Git Multiple Choice Questions and Answers

Git MCQ with answers and explanations for placement tests and job interviews. These solved Git MCQ are useful for the campus placement for all freshers including Engineering Students, MCA students, Computer and IT Engineers, etc.

Our Git MCQ ( Git Multiple Choice Questions and Answer )  focuses on all areas of Git software. We will also regularly update the Git MCQ and the most interesting thing is that questions come in a random sequence. So every time you will feel new questions.

Note: Your score along with correct answers will be visible after answering all of these questions.

So let’s see our Git MCQ (Multiple Choice Questions & Answers on “Git”)

git mcq

Git MCQ: Git Multiple Choice Questions and Answers

1 / 90

What Git workflow is used by teams that collaborate on a single branch and avoid creating long-lived development branches?

2 / 90

You find a bug in your project, but can't locate where it was introduced in the commit history. How would you diagnose this problem?

3 / 90

What is the difference between initializing a normal repo and a bare repo?

4 / 90

Suppose you needed to see a list of all files that had been modified or added to a specific commit over the course of a project. How would you accomplish this?

5 / 90

What Language is used in GIT?

6 / 90

What does refs store?

7 / 90

What is the main issue with using git rebase when working with multiple developers?

8 / 90

What command creates a new branch from the currently checked-out branch?

9 / 90

Which setting determines what pager is used when Git pages output?

10 / 90

What is a remote repository?

11 / 90

While modifying a file, you're unexpectedly assigned an urgent bug fix on another branch. How can you temporarily save your local work without committing?

12 / 90

Where are files stored before they are committed to the local repository?

13 / 90

Your current project has several branches; master, beta, and push-notifications. You've just finished the notification feature in the push-notification branch, and you want to commit it to beta branch. How can you accomplish this?

14 / 90

Which command gets a copy of an existing Git repository?

15 / 90

Which use case is NOT a good candidate for a Git hook?

16 / 90

What is usually the extension of file which has the public key?

17 / 90

How would you configure Git to abort a commit if a smoke test script fails?

18 / 90

Which command will list tags with the 1.4.2 series?

19 / 90

After mistakenly staging a file named myFile to the index, how would you remove it from the index to exclude it from your next commit?

20 / 90

You find that your project has a tag and branch both named push-notifications, which causes confusion when trying to print out given reference. How can you specify which branch you want to look at?

21 / 90

You're in the middle of modifying a file when you're unexpectedly assigned an urgent bug fix on another branch. What would you do to temporarily save the work your doing locally without committing?

22 / 90

While working on a feature branch you try to use "git rerere" to solve a recurring merge conflict but nothing is happening. What could be causing this issue?

23 / 90

After pushing commits to the remote repository for the first time using the command below, what shorthand command can you use in future?

git push -u origin master

24 / 90

Where are files stored before they are committed to the local repository ?

25 / 90

Which Git command begins tracking of a new file?

26 / 90

How could you squash multiple commits together without using git merge --squash?

27 / 90

Which strategy is used by Git for merging two branches?

28 / 90

What does the git stash drop command do?

29 / 90

Which statement is true when you use the git add -A command?

30 / 90

 Which option on the git log command allows you to limit output to commits made after certain data?

31 / 90

Your current repository has three branches: master, beta and push-notifications. You've just finished the notification feature and commit the changes to the push-notifications branch, and you want to include them in the beta branch. How can you accomplish this?

32 / 90

After you make changes to a tracked file, you run the following command. What will this do?

git commit -a -m "Refactor code base"

33 / 90

Why would the following command be used?

git rebase -i HEAD~10

34 / 90

This command is an example of what kind of tag ?

git tag -a v1.4 -m "ABCD v1.5"

35 / 90

After you've successfully merged two branches and committed the changes, what is the next step in keeping your git structure organized?

36 / 90

You want to perform a git reset but cannot recall all of the available options. What command would you use to see a description of them?

37 / 90

How would you create a custom shortcut or command across your git environment?

38 / 90

What is the difference between using the git stash and git stash pop commands?

39 / 90

What is the operation doing given the Git commands below?
git bisect start
git bisect bad 5d41402abc4b2a76b9719d911017c592
git bisect good 69faab6268350295550de7d587bc323d

40 / 90

Which option to git commit, will modify last commit message?

41 / 90

Which of the following is called dumb protocol?

42 / 90

 What happens if you run this command from your master branch?

git checkout -b beta-test

43 / 90

Describe what the following git commands do to the commit history.

git reset --hard HEAD~5
git merge --squash HEAD@{1}

44 / 90

What is the difference between a soft reset (git reset --soft) and a hard reset (git reset –hard) ?

45 / 90

Which version onwards did Git offer reversing a file back to what it looked like when last committed?

46 / 90

After checking your git status you get the following output, which shows the file beta-notes.js in the commit but also unstaged. How can this situation occur?

Change to be committed:

(use "git reset HEAD <file>..." to unstage)
modified: beta-notes.js
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout --<file>..." to discard changes in working directory)

modified: beta-notes.js

47 / 90

Why would you use a pre-receive hook in your remote repository?

48 / 90

. What is the best way to characterize the git commit structure?

49 / 90

In a situation where you have several commits for a single task, what is the most efficient way to restructure your commit history?

50 / 90

Which command can be used to list the branches that have been merged into the currently checked-out branch?

51 / 90

After modifying some existing files in a repository, you decide to discard the changes. What command can you use?

52 / 90

Which user should be created first during setting up of SSH?

53 / 90

What is the status of the beta-notes.js file in the following output?

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: beta-notes.js

54 / 90

If you cloned an existing git repository, what would happen?

55 / 90

What option can you use to apply git configurations across your entire git environment?

56 / 90

What does the following command do to the git repository?

git reset --soft HEAD^

57 / 90

What types of tags does Git support?

58 / 90

What will the following command print to the Terminal?
git remote -v

59 / 90

Which key press returns a set of suggestions to pick from, when writing a Git command?

60 / 90

Which of these terms best describes Git?

61 / 90

What change will the following command make to the staging area files?

git rm --cached testfile.js

62 / 90

Which of the following is true of the git push command?

63 / 90

Which command correctly creates a lightweight tag?

64 / 90

How does Git think of its data?

65 / 90

What commands would you use to force an overwrite of your local files with the master branch?

66 / 90

What conflicts can occur when forcing a push after rebasing?

67 / 90

. How many ways are present in Git to integrate changes from one branch into another?

68 / 90

How does Git internally manage branches?

69 / 90

. Which option enables inclusion of committer name in custom log format?

70 / 90

How would you delete unreachable objects older than a specified time from your project database?

71 / 90

Which option enables inclusion of author name in custom log format?

72 / 90

Your team lead needs a list of all commits that will be moved before you perform a rebase. Which command can you use to access that information?

73 / 90

After starting to work on a new feature and creating new files in the working directory related to it, the customer determinded the feature was no longer required. What command can be used to remove the untracked files from the working directory ?

74 / 90

What files is this .gitignore programmed to leave out?

#.swift
build/

*.txt
*.metadata

75 / 90

. Which statement is true of the git push command?.

76 / 90

What does commit object contain?

77 / 90

What command would you use to create a new git repository?

78 / 90

If you have several commits for a single feature, what is the most efficient way to restructure your commit history?

79 / 90

Which of the following is true you when you use the following command?

git add -A

80 / 90

Looking at the following commands, describe what is happening.

git checkout feature-user-location
git cherry-pick kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231

81 / 90

How does this command alter the currently checked-out branch?

git reset --soft HEAD^

82 / 90

. After staging a series of changes to the index, which command could you use to review them prior to a commit?

83 / 90

What is the difference between Git and SVN?

84 / 90

Which of the following is an integration manager?

85 / 90

After starting to merge a feature branch into your master branch, you encounter a merge conflict and decide you do not want to perform the merge. How can you stop the merge and restore to the pre-merge state?

86 / 90

What is version control?

87 / 90

How many individual commits can a single repository have?

88 / 90

How can you check your current git version?

89 / 90

What information does the git config file store?

90 / 90

What command would let you modify your previous commit?

 

Recommended Articles for you: