AlgoMaster Logo

Working with Files - Quiz

Last Updated: January 3, 2026

Working with Files Exercises

30 quizzes

1
Code Completion

Stage the removal of a tracked file so that its deletion is included in the next commit

shell
1
git old_config.json

Click an option to fill the blank:

2
Code Completion

Force removal of a modified tracked file and stage its deletion

shell
1
git rm - temp.log

Click an option to fill the blank:

3
Code Completion

Remove a directory and all tracked files under it in one command

shell
1
git rm - assets/

Click an option to fill the blank:

4
Code Completion

Rename a tracked file within the repository while staging the change

shell
1
git README.txt README.md

Click an option to fill the blank:

5
Code Completion

Mark a script as executable so collaborators can run it as a program

shell
1
git update-index --chmod=+ scripts/deploy.sh

Click an option to fill the blank:

6
Multiple Choice

What does git rm do by default for a tracked file?

7
Multiple Choice

You accidentally deleted a tracked file using the OS file manager. What is a typical next step before committing?

8
Multiple Choice

Why is git mv generally preferred over using the OS move command followed by git add and git rm?

9
Multiple Choice

Which file permission change is Git able to track natively on most systems?

10
Multiple Choice

A script lost its executable bit in the repository. What is a Git-focused way to make the change visible in history?

11
Sequencing

Order the steps to delete an obsolete tracked file and record the change

Drag and drop to reorder, or use the arrows.

12
Sequencing

Order the steps to move a tracked file into a new subdirectory and share the change

Drag and drop to reorder, or use the arrows.

13
Sequencing

Order the steps to stop tracking a configuration file but keep it locally

Drag and drop to reorder, or use the arrows.

14
Sequencing

Order the steps to make a deployment script executable for all collaborators using Git

Drag and drop to reorder, or use the arrows.

15
Output Prediction

You just ran git rm unused.txt on a tracked file. What will git status show for that file?

1git status --short
16
Output Prediction

You ran git mv src/app.js src/main.js. What will git status --short show for that change?

1git status --short
17
Output Prediction

You made a file executable with git update-index --chmod=+x tools/build.sh. How will git status --short show this change?

1git status --short
18
Output Prediction

A tracked file was deleted using the OS, but you have not staged anything yet. How will it appear in short status?

1git status --short
19
Bug Spotting

Identify the incorrect command in this workflow that tries to rename a file and commit the change

Click on the line(s) that contain the bug.

shell
1
git mv index.html app.html
2
git add index.html
3
git commit -m "Rename index to app"
4
git push origin main
20
Bug Spotting

Identify the incorrect command in this attempt to remove a directory and its tracked contents

Click on the line(s) that contain the bug.

shell
1
git rm src/
2
rm -rf src/
3
git commit -m "Remove src directory"
21
Bug Spotting

Identify the incorrect command in this attempt to make a script executable via Git

Click on the line(s) that contain the bug.

shell
1
chmod +x scripts/run.sh
2
git add scripts/run.sh
3
git commit -m "Make script executable"
4
git push origin main
22
Matching

Match each Git command with its primary effect on files

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

23
Matching

Match each permission representation with its meaning

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

24
Matching

Match each scenario with the most appropriate Git command

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

25
Fill in the Blanks

Complete the commands to remove a tracked build directory but keep it locally ignored going forward

shell
1
echo "build/" >> .gitignore
2
git rm -- build/
3
git -m "Stop tracking build directory"

Click an option to fill blank 1:

26
Fill in the Blanks

Complete the commands to move a script and mark it executable in Git

shell
1
git scripts/run.sh tools/run.sh
2
git update-index --chmod= tools/run.sh

Click an option to fill blank 1:

27
Fill in the Blanks

Complete the commands to delete a tracked file and then verify it is staged for removal

shell
1
git rm notes.txt
2
git --

Click an option to fill blank 1:

28
Hotspot Selection

Select the line that shows a file staged for deletion after using git rm

Click on the line to select.

shell
1
 M src/main.js
2
D  OLD_README.md
3
D  docs/legacy.md
4
D  logs/old.log
29
Hotspot Selection

Select the line indicating a renamed file after using git mv

Click on the line to select.

shell
1
M  src/config.js
2
R  src/app.js -> src/main.js
3
A  src/new-feature.js
30
Hotspot Selection

Select the line where only the executable bit of a script was changed

Click on the line to select.

shell
1
M  README.md
2
M  scripts/deploy.sh
3
A  scripts/setup.sh