Version control basics with git: Practice Questions — Software and Environment Management (NVIDIA-Certified Associate: Accelerated Data Science)
Version Control Basics with Git: Practice Questions Version control is a fundamental skill for data scientists working in accelerated environments....
Version Control Basics with Git: Practice Questions
Version control is a fundamental skill for data scientists working in accelerated environments. Git is the most widely used version control system, enabling collaboration, tracking changes, and maintaining reproducible codebases. Below are practice questions designed to test your understanding of Git basics as relevant to the NVIDIA-Certified Associate: Accelerated Data Science exam.
Which command initializes a new Git repository in your current directory?
- A. git start
- B. git init
- C. git create
- D. git new
Answer: B
Explanation: git init creates a new Git repository in the current directory, setting up the necessary metadata.
What does the command git add . do?
- A. Adds all changes in the current directory to the staging area
- B. Commits all changes to the repository
- C. Removes all files from the repository
- D. Creates a new branch
Answer: A
Explanation: git add . stages all modified and new files in the current directory and its subdirectories for the next commit.
Which command is used to save your staged changes to the repository with a descriptive message?
- A. git commit -m "message"
- B. git push
- C. git save
- D. git stage
Answer: A
Explanation: git commit -m "message" records the staged changes in the repository with the provided commit message.
How do you view the commit history of your Git repository?
- A. git log
- B. git history
- C. git status
- D. git show
Answer: A
Explanation: git log displays a list of commits in the current branch, showing commit IDs, authors, dates, and messages.
What is the purpose of the git clone command?
- A. To create a new branch
- B. To copy an existing remote repository to your local machine
- C. To merge two branches
- D. To delete a repository
Answer: B
Explanation: git clone copies a remote repository and its entire history to your local system for development.
Which command uploads your local commits to a remote repository?
- A. git push
- B. git pull
- C. git fetch
- D. git merge
Answer: A
Explanation: git push transfers your committed changes from the local repository to the remote repository.
What does the git status command show?
- A. The current branch and staged, unstaged, and untracked files
- B. The commit history
- C. The differences between branches
- D. The remote repository URL
Answer: A
Explanation: git status displays the current branch and the state of files: which are staged, unstaged, or untracked.
Which command merges changes from another branch into your current branch?
- A. git merge
- B. git branch
- C. git rebase
- D. git checkout
Answer: A
Explanation: git merge integrates changes from a specified branch into the branch you currently have checked out.
More in this topic
Ready to test your knowledge?
Put what you've learned into practice with a quick quiz and track your progress.
Test your knowledge →