Skip to content
CogniSkill

FREE PRACTICE TEST

Git and GitHub for Scripts and Projects — Course Assessment

Original course questions with explained answers. This assessment is for learning; it does not predict certification exam results.

Free sample questions with explanations

Try these sample questions without an account. Choose your answer, then open the explanation. Sign in below to take the full scored test and save your result.

1. What does a commit record?

  1. The staged snapshot
  2. Every future edit
  3. The screen display
Show answer and explanation for question 1

Correct answer: A. The staged snapshot

Commits use the staged content.

2. Does .gitignore erase tracked secrets from history?

  1. Yes
  2. No
  3. Only after renaming
Show answer and explanation for question 2

Correct answer: B. No

Ignoring is not history removal or credential revocation.

3. Which command inspects staged changes?

  1. git status --short only
  2. git push
  3. git diff --cached
Show answer and explanation for question 3

Correct answer: C. git diff --cached

The cached diff compares the staged snapshot.

4. You stage a repair and then edit the same file again. What does the next ordinary commit contain?

  1. The staged snapshot, not automatically the later unstaged edit.
  2. Every saved change in the working directory.
  3. Only the last edit made in the editor.
Show answer and explanation for question 4

Correct answer: A. The staged snapshot, not automatically the later unstaged edit.

The index is a separate proposed snapshot. Inspect both git diff and git diff --cached, and verify that the tested content matches the intended commit before sharing.

5. You want to unstage capacity.py while retaining its working edit. Which operation fits?

  1. git restore -- capacity.py
  2. git restore --staged -- capacity.py
  3. Delete and recreate the repository.
Show answer and explanation for question 5

Correct answer: B. git restore --staged -- capacity.py

The --staged form changes the index without discarding the working edit. A worktree restore can overwrite that edit. Identify the location and recoverability before using an undo command.

Sign in to take this free practice test and save your result.

Sign in