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. James Gosling
C. Linus Torvalds
D. Guido van Rossum

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

A. It is a temporary folder for deleted files.
B. It stores the production build artifacts.
C. It stores all the version control metadata and the object database.
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 init user.name "Name"
C. git set user.name "Name"
D. git config --global user.name "Name"

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

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

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

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

7 What functionality does git clone provide?

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

8 What is the function of git status?

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

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

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

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

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

11 Which command is used to view the commit history?

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

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

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

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

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

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

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

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

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

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

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

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

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

18 What is a 'Fast-forward' merge?

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

19 What is 'HEAD' in Git?

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

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

A. rm
B. git remove
C. git delete
D. git 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 status
C. git log
D. git diff --staged

22 Which command lists all configured remote repositories?

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

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

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

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 clone and git merge
B. git add and git commit
C. git fetch and git rebase
D. git fetch and git merge

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

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

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

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

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

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

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

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

30 What is the purpose of git tag?

A. To tag a user in a commit message.
B. To categorize files by type.
C. To highlight syntax in code.
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. Deletes the last commit and all changes in files.
C. Undoes the last commit and keeps changes in the working directory (unstaged).
D. Resets the repository to the initial state.

32 What is a 'merge conflict'?

A. When two users have the same username.
B. When Git cannot automatically resolve differences in code between two commits.
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 revert
B. git delete
C. git reset
D. git undo

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

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

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

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

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

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

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

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

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

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

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

A. Force push your changes.
B. Pull the latest changes from the remote to ensure no conflicts.
C. Delete your local repository.
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 cherry-pick
B. git select
C. git grab
D. git pick

41 What does the command git init do?

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

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

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

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

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

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

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

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

A. A standard Git command.
B. A type of merge conflict.
C. A server-side copy of a repository (common in GitHub/GitLab workflows).
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 overwrite the remote changes.
B. Git will create a new branch.
C. Git will reject the push.
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 rename
C. mv then git add
D. git change

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

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

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

A. git create tag v1.0
B. git tag v1.0
C. git label 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 details about a specific object (commit, tag, etc.).
B. To show the help manual.
C. To show the remote URL.
D. To show the current branch name.