Quiz Details

Sign Up to Download PDF

QZ-20251027-24731

Topics:
GIT
Difficulty: Level 3 - Medium
Questions: 20
Generated: October 27, 2025 at 09:29 AM
Generated by: Guest User

Instructions: Select an answer for each question and click "Check Answer" to see if you're correct. Then view the explanation to learn more!
1 What command is used to create a new branch in Git?
Correct Answer: C
Explanation: The command 'git checkout -b <branch_name>' creates a new branch and switches to it.
2 Which command is used to view the commit history in Git?
Correct Answer: A
Explanation: The command 'git log' displays the commit history of the repository.
3 What does the command 'git status' do?
Correct Answer: C
Explanation: 'git status' provides information about the current branch, changes staged for commit, and the status of the working directory.
4 How do you stage changes for commit in Git?
Correct Answer: B
Explanation: The command 'git add <file_name>' stages changes to the specified file for the next commit.
5 What does a 'merge conflict' in Git indicate?
Correct Answer: B
Explanation: A merge conflict occurs when two branches have competing changes that cannot be automatically reconciled by Git.
6 Which command can be used to revert a commit in Git?
Correct Answer: B
Explanation: The command 'git revert <commit_id>' creates a new commit that undoes the changes made by the specified commit.
7 What is the purpose of 'git pull'?
Correct Answer: D
Explanation: 'git pull' fetches changes from a remote repository and merges them into the current branch.
8 In Git, what does the term 'HEAD' refer to?
Correct Answer: A
Explanation: 'HEAD' refers to the latest commit in the currently checked-out branch.
9 How can you remove a file from the staging area in Git?
Correct Answer: A
Explanation: The command 'git reset <file_name>' removes the specified file from the staging area.
10 What command do you use to create a new remote repository in Git?
Correct Answer: D
Explanation: The command 'git remote add <name> <url>' adds a new remote repository with the specified name and URL.
11 Which command is used to discard local changes in a file?
Correct Answer: C
Explanation: The command 'git checkout -- <file_name>' discards local changes made to the specified file.
12 What does the command 'git stash' do?
Correct Answer: D
Explanation: 'git stash' saves your local modifications away and reverts the working directory to match the HEAD commit.
13 How can you view the differences between your working directory and the last commit?
Correct Answer: C
Explanation: The command 'git diff' shows the differences between the current working directory and the last commit.
14 What does the command 'git cherry-pick <commit_id>' do?
Correct Answer: C
Explanation: 'git cherry-pick <commit_id>' applies the changes from the specified commit to your current branch.
15 Which command is used to rename a branch in Git?
Correct Answer: D
Explanation: The command 'git branch -m <new_name>' renames the current branch to the specified new name.
16 What is the purpose of 'git fetch'?
Correct Answer: C
Explanation: 'git fetch' downloads changes from a remote repository but does not merge them into your current branch.
17 Which command can be used to see the current branch you are on?
Correct Answer: C
Explanation: The command 'git branch' lists all branches and highlights the current branch with an asterisk.
18 What does the command 'git rebase' do?
Correct Answer: D
Explanation: 'git rebase' allows you to apply commits from one branch onto another, effectively rewriting the commit history.
Want to generate another quiz?
Generate New Quiz Browse All Quizzes
Home Quizzes Create Cards Account