Unit 3: Basic Git - Practice Quiz

INT331 — Fundamentals Of Devops 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 What is Git primarily classified as?

A. Local Version Control System
B. Centralized Version Control System
C. Relational Database Management System
D. Distributed Version Control System

2 Who originally created Git?

A. Dennis Ritchie
B. Guido van Rossum
C. Linus Torvalds
D. James Gosling

3 In Git, what is the purpose of the .git directory?

A. It stores all the version control metadata and the object database.
B. It stores the production build artifacts.
C. It is a temporary folder for deleted files.
D. It contains the user's manual for Git.

4 Which command allows you to configure your username globally in Git?

A. git global user "Name"
B. git config --global user.name "Name"
C. git init user.name "Name"
D. git set user.name "Name"

5 What are the three main states that files can reside in within Git?

A. Modified, Staged, Committed
B. Created, Updated, Deleted
C. Local, Remote, Upstream
D. Active, Passive, Archived

6 Which command moves a file from the 'Modified' state to the 'Staged' state?

A. git commit
B. git push
C. git add
D. git move

7 What functionality does git clone provide?

A. It duplicates a branch within the same repository.
B. It creates a new empty repository locally.
C. It copies the latest commit only.
D. It creates a copy of an existing remote repository into a new directory.

8 What is the function of git status?

A. It displays the state of the working directory and the staging area.
B. It shows the difference between file versions.
C. It lists the commit history.
D. It shows the status of the remote server connectivity.

9 Which command captures a snapshot of the project's currently staged changes?

A. git record
B. git snap
C. git commit
D. git save

10 How does Git identify the integrity of the objects (commits, files, etc.) stored in its database?

A. Using a SHA-1 hash
B. Using file names
C. Using timestamps
D. Using sequential integers (1, 2, 3...)

11 Which command is used to view the commit history?

A. git past
B. git log
C. git review
D. git history

12 What is the default name of the master branch in modern Git installations (standardized to be more inclusive)?

A. main
B. base
C. root
D. trunk

13 Which file is used to specify intentionally untracked files to ignore?

A. .gitignore
B. config.ignore
C. ignore.git
D. .gitremove

14 What command creates a new branch named 'feature-x'?

A. git branch feature-x
B. git checkout feature-x
C. git create feature-x
D. git new feature-x

15 Which command is used to switch to an existing branch?

A. git branch
B. git move
C. git checkout
D. git switch-to

16 How do you create a new branch and switch to it in a single command?

A. git switch -n <branch_name>
B. git branch -c <branch_name>
C. git checkout -b <branch_name>
D. git checkout --new <branch_name>

17 Which command merges the specified branch's history into the current branch?

A. git combine
B. git merge
C. git fuse
D. git join

18 What is a 'Fast-forward' merge?

A. A merge that happens automatically every hour.
B. A merge where the branch pointer simply moves forward because there is no divergent work.
C. A merge performed on a remote server only.
D. A merge that skips conflict resolution.

19 What is 'HEAD' in Git?

A. The first commit of the repository.
B. The administrator of the repository.
C. A pointer to the local branch/commit you are currently on.
D. The remote server address.

20 Which command removes a file from the working directory and the staging area?

A. git delete
B. git rm
C. git remove
D. rm

21 If you want to view the changes between the working directory and the staging area, which command should you use?

A. git diff
B. git diff --staged
C. git status
D. git log

22 Which command lists all configured remote repositories?

A. git remote list
B. git remote show
C. git config --list-remotes
D. git remote -v

23 What is the default name Git gives to the server you cloned from?

A. origin
B. remote
C. master
D. upstream

24 Which command downloads changes from a remote repository but does NOT merge them into your current work?

A. git clone
B. git update
C. git fetch
D. git pull

25 The command git pull is effectively a combination of which two commands?

A. git fetch and git rebase
B. git clone and git merge
C. git fetch and git merge
D. git add and git commit

26 Which command is used to upload local branch commits to the remote repository?

A. git upload
B. git fetch
C. git push
D. git send

27 How do you add a new remote repository named 'upstream'?

A. git remote new upstream <url>
B. git add remote upstream <url>
C. git remote add upstream <url>
D. git config remote upstream <url>

28 What feature allows you to save unfinished work without committing it, to clean the working directory?

A. Reverting
B. Stashing
C. Tagging
D. Branching

29 Which command would you use to list the stash stack?

A. git stash list
B. git stash view
C. git stash show
D. git stash log

30 What is the purpose of git tag?

A. To tag a user in a commit message.
B. To highlight syntax in code.
C. To categorize files by type.
D. To mark specific points in history as important (e.g., releases).

31 What does git reset --soft HEAD~1 do?

A. Undoes the last commit but keeps changes in the staging area.
B. Resets the repository to the initial state.
C. Undoes the last commit and keeps changes in the working directory (unstaged).
D. Deletes the last commit and all changes in files.

32 What is a 'merge conflict'?

A. When Git cannot automatically resolve differences in code between two commits.
B. When two users have the same username.
C. When a file is too large to merge.
D. When the remote server is down.

33 Which command creates a new commit that applies the inverse of a specified commit (effectively undoing it history-safe)?

A. git reset
B. git undo
C. git delete
D. git revert

34 What is the output of git log --oneline?

A. A condensed history showing abbreviated hash and subject line.
B. A list of branches.
C. The full commit message and date.
D. A detailed history including diffs.

35 When working with a remote, what does 'tracking branch' mean?

A. A branch that records user activity logs.
B. A local branch that has a direct relationship with a remote branch.
C. A branch used only for bug tracking.
D. A branch that is currently being merged.

36 Which command is used to delete a local branch safely (only if merged)?

A. git branch -d <branch_name>
B. git remove <branch_name>
C. git delete <branch_name>
D. git branch -D <branch_name>

37 What is the area called where Git stores the changes before they are committed?

A. The Staging Area (or Index)
B. The Workspace
C. The Cache
D. The Playground

38 Which command displays who modified each line of a file and when?

A. git blame
B. git inspect
C. git authors
D. git who

39 In the Git workflow, what is the best practice before pushing your changes to a shared remote?

A. Pull the latest changes from the remote to ensure no conflicts.
B. Delete your local repository.
C. Force push your changes.
D. Create a new remote.

40 How do you apply a specific commit from one branch to another without merging the whole branch?

A. git pick
B. git cherry-pick
C. git grab
D. git select

41 What does the command git init do?

A. Installs Git software.
B. Connects to the internet.
C. Initializes the user profile.
D. Initializes a new, empty Git repository.

42 If you modify a file that is already tracked, what is its status before staging?

A. Committed
B. Untracked
C. Modified
D. Stashed

43 Which command would you use to see the commit history of a specific file?

A. git status <filename>
B. git log <filename>
C. git history <filename>
D. git diff <filename>

44 What is the primary difference between git reset --hard and git reset --mixed (default)?

A. --hard changes the commit history, --mixed does not.
B. There is no difference.
C. --hard modifies the working directory, while --mixed keeps working directory changes.
D. --hard creates a backup, --mixed deletes files.

45 In the context of Git, what is a 'fork'?

A. A standard Git command.
B. A server-side copy of a repository (common in GitHub/GitLab workflows).
C. A type of merge conflict.
D. A split in the command line interface.

46 What happens if you try to git push but your local history is behind the remote history?

A. Git will reject the push.
B. Git will create a new branch.
C. Git will overwrite the remote changes.
D. Git will automatically merge the changes.

47 Which command is used to rename a file in a way that Git records the move?

A. git mv
B. git change
C. mv then git add
D. git rename

48 What character is used to separate directories in Git internal paths, regardless of the OS?

A. Forward slash /
B. Colon :
C. Backslash \
D. Pipe |

49 Which command creates a specific tag v1.0 with a message?

A. git label v1.0
B. git tag v1.0
C. git create tag v1.0
D. git tag -a v1.0 -m "Version 1.0"

50 What is the purpose of the git show command?

A. To show the current branch name.
B. To show details about a specific object (commit, tag, etc.).
C. To show the remote URL.
D. To show the help manual.