Unit 3 - Practice Quiz

INT331

1 What is Git primarily classified as?

A. Centralized Version Control System
B. Distributed Version Control System
C. Local Version Control System
D. Relational Database Management 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 the production build artifacts.
B. It stores all the version control metadata and the object database.
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 config --global user.name "Name"
B. git set user.name "Name"
C. git global user "Name"
D. git init user.name "Name"

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

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

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 creates a new empty repository locally.
B. It creates a copy of an existing remote repository into a new directory.
C. It copies the latest commit only.
D. It duplicates a branch within the same repository.

8 What is the function of git status?

A. It shows the difference between file versions.
B. It lists the commit history.
C. It displays the state of the working directory and the staging area.
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 save
B. git commit
C. git snap
D. git record

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

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

11 Which command is used to view the commit history?

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

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

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

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

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

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

A. git checkout feature-x
B. git branch 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 checkout
C. git switch-to
D. git move

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

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

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

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

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 that skips conflict resolution.
D. A merge performed on a remote server only.

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. rm
B. git rm
C. git delete
D. git remove

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 -v
C. git remote show
D. git config --list-remotes

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 pull
B. git fetch
C. git clone
D. git update

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

A. git fetch and git merge
B. git clone and git merge
C. git fetch and git rebase
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 add upstream <url>
B. git remote new upstream <url>
C. git config remote 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. Branching
B. Tagging
C. Stashing
D. Reverting

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

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

30 What is the purpose of git tag?

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

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

A. Deletes the last commit and all changes in files.
B. Undoes the last commit but keeps changes in the staging area.
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 the remote server is down.
B. When Git cannot automatically resolve differences in code between two commits.
C. When two users have the same username.
D. When a file is too large to merge.

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

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

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

A. A detailed history including diffs.
B. The full commit message and date.
C. A condensed history showing abbreviated hash and subject line.
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 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 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 Playground
B. The Staging Area (or Index)
C. The Cache
D. The Workspace

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

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

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

A. Delete your local repository.
B. Pull the latest changes from the remote to ensure no conflicts.
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. Connects to the internet.
B. Initializes a new, empty Git repository.
C. Installs Git software.
D. Initializes the user profile.

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

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

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

A. git log <filename>
B. git history <filename>
C. git status <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. --hard modifies the working directory, while --mixed keeps working directory changes.
C. --hard creates a backup, --mixed deletes files.
D. There is no difference.

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

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

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

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

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

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

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

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

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

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

50 What is the purpose of the git show command?

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