Interstellar Git Interview Question-Answer

Q.1 Which option can be used to change the commit message during Git cherry-pick?

       A. -r

       B. -n

       C. -u

       D. -e

Ans : -e

Q.2 A tag in Git context is a _______________.

       A. Search String

       B. Reference to a specific commit

       C. Keyword

Ans : Reference to a specific commit

Q.3 Can a commit be taken from one branch and moved to a different branch in Git?

       A. True

       B. False

Ans : True

Q.4 Is it possible to get merge conflict during Git cherry-pick?

       A. True

       B. False

Ans : True

Q.5 What is the command to store the uncommitted changes temporarily?

       A. git stash

       B. git tempstore

       C. git store

       D. git commit

Ans : git stash

Q.6 Which option is used to remove a single stash entry from a list of stash entries?

       A. delete

       B. drop

       C. clear

       D. remove

Ans : drop

Q.7 On adding a subproject using git submodule add, how many files will be added in the main repository?

       A. 1

       B. 2

       C. 3

       D. 4

Ans : 2

Q.8 Git keeps track of all the submodules and their paths in the project in _____________.

       A. .gitmodule file

       B. .gitmodules file

       C. .git folder

       D. Remote repository

Ans : .gitmodules file

Q.9 The indexed changes in a subproject can be viewed using __________.

       A. git submodule show

       B. git status

       C. git submodule status

       D. git show

Ans : git submodule status

Q.10 The purpose of Git Blame is to find ____________.

       A. Who created the file

       B. The commit and the author of a particular line

       C. When a file was created

       D. Who wrote the feature

Ans : The commit and the author of a particular line

Q.11 Which option in Git Blame is used to filter only the commit hash?

       A. -E

       B. -s

       C. -S

       D. -L

Ans : -s

Q.12 The email address of the author can be got instead of the author’s name in the result using ____________.

       A. git blame -a filename

       B. git blame -E filename

       C. git blame -e filename

       D. git blame filename

Ans : git blame -e filename

Q.13 Developer A found that a button, which was working fine earlier is not working in the project. It is not sure which commit introduced this bug! Which of the following Git commands would you suggest?

       A. Git bisect

       B. Git blame

       C. Git search

       D. Git binary search

Ans : Git bisect

Q.14 Which type of search is used in Git Bisect?

       A. Linear search

       B. Jump search

       C. Binary search

       D. Interpolation search

Ans : Binary search

Q.15 How to declare that a commit is buggy in Git Bisect?

       A. git bisect bad

       B. git error bisect

       C. git bisect error

       D. git bisect bug

Ans : git bisect bad

Q.16 How to declare that a commit is errorless in Git Bisect?

       A. git bisect errorless

       B. git bisect perfect

       C. git good bisect

       D. git bisect good

Ans : git bisect good

Q.17 When you run git commit, which hook(s) is/are called?

       A. post-commit

       B. Both pre and post commits

       C. succeeding-commit

       D. pre-commit

Ans : Both pre and post commits

Q.18 Which scripting language is used in the default sample hook files?

       A. PHP

       B. Python

       C. Shell

       D. Ruby

Ans : Shell

Q.19 Which of the following is a server-side hook?

       A. post-commit

       B. prepare-commit

       C. pre-commit

       D. post-receive

Ans : post-receive

Q.20 Old reflog entries can be cleaned using ________

       A. git reflog remove

       B. git reflog -d

       C. git reflog expire

       D. git reflog clean

Ans : git reflog expire

Q.21 The result of the command git blame filename will have the following, except ___________.

       A. commit hash

       B. updated timestamp

       C. author’s email address

       D. author’s name

Ans : author’s email address

Q.22 Reflog entry has timestamps attached to it.

       A. True

       B. False

Ans : False

Q.23 The reference of the deleted commit can be got using git reflog.

       A. True

       B. False

Ans : True

Q.24 The result of git blame filename will return the original lines of source code in the console.

       A. True

       B. False

Ans : True

Q.25 We can reset Git Bisect using git bisect reset even in the middle of a bisect.

       A. True

       B. False

Ans : True

Q.26 What is the command to store the uncommitted changes temporarily?

       A. git tempstore

       B. git stash

       C. git store

       D. git commit

Ans : git stash

Q.27 Which command is useful to undo a git rebase?

       A. git reflog

       B. git log

       C. git blame

       D. git undo

Ans : git reflog

Q.28 Developer A had initialized a new repo and moved it to the hooks folder. What would be the extension of the files present in it?

       A. .git

       B. .secret

       C. .yml

       D. .sample

Ans : .sample

Leave a Comment

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