0% found this document useful (0 votes)
5 views4 pages

Git

The document contains a series of multiple-choice questions (MCQs) focused on Git and GitHub at a moderate level. It covers essential commands, concepts, and best practices related to version control and collaboration using Git and GitHub. Each question is followed by the correct answer, providing a useful resource for learning or testing knowledge in this area.

Uploaded by

Gurnandan Singh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Git

The document contains a series of multiple-choice questions (MCQs) focused on Git and GitHub at a moderate level. It covers essential commands, concepts, and best practices related to version control and collaboration using Git and GitHub. Each question is followed by the correct answer, providing a useful resource for learning or testing knowledge in this area.

Uploaded by

Gurnandan Singh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Git & GitHub – Moderate Level MCQs

1. Git is best described as:


A. A cloud storage service
B. A distributed version control system
C. A programming language
D. A web hosting service
Answer: B
2. GitHub is primarily used to:
A. Write code online only
B. Store databases
C. Host Git repositories and enable collaboration
D. Compile programs
Answer: C
3. Which command initializes a new Git repository in a local directory?
A. git start
B. git create
C. git init
D. git new
Answer: C
4. What does the command git add . do?
A. Commits changes
B. Adds files to GitHub
C. Stages all modified files
D. Pushes code to remote
Answer: C
5. Which command records staged changes permanently in the repository?
A. git save
B. git commit
C. git push
D. git stage
Answer: B
6. What is the purpose of git commit -m "message"?
A. To upload files
B. To create a snapshot with description
C. To merge branches
D. To clone a repository
Answer: B
7. What does git push origin main do?
A. Downloads code from GitHub
B. Pushes local changes to remote main branch
C. Creates a new branch
D. Deletes remote repository
Answer: B
8. Which command is used to download updates from a remote repository?
A. git fetch
B. git pull
C. git update
D. git clone
Answer: B
9. In team projects, why should developers run git pull before starting work?
A. To save time
B. To avoid merge conflicts
C. To delete old files
D. To check commit history
Answer: B
10. Which command copies an existing GitHub repository to a local system?
A. git fork
B. git init
C. git clone
D. git copy
Answer: C
11. What is a Git branch mainly used for?
A. Storing backups
B. Running code
C. Working on features independently
D. Uploading files
Answer: C
12. Which command creates and switches to a new branch?
A. git branch new
B. git checkout new
C. git checkout -b new
D. git switch main
Answer: C
13. What is a Pull Request (PR) in GitHub?
A. Request to download repository
B. Request to delete a branch
C. Request to merge changes into another branch
D. Request to fork repository
Answer: C
14. Which GitHub feature allows you to copy someone else’s repository to your
own account?
A. Clone
B. Branch
C. Fork
D. Merge
Answer: C
15. After forking a repository, how do you contribute your changes back?
A. Push directly to original repo
B. Create a Pull Request
C. Merge locally
D. Commit only
Answer: B
16. Which command links a local repository to a GitHub repository?
A. git link origin
B. git remote add origin <url>
C. git connect origin
D. git hub add
Answer: B
17. What does origin represent in Git?
A. Branch name
B. Commit message
C. Default remote repository name
D. Main file
Answer: C
18. Which of the following is TRUE about GitHub?
A. GitHub replaces Git
B. GitHub works without Git
C. GitHub provides a web interface for Git repositories
D. GitHub is mandatory for Git
Answer: C
19. Which action helps prevent code conflicts in collaborative projects?
A. Working directly on main branch
B. Using branches and pull requests
C. Avoiding commits
D. Using only one system
Answer: B
20. A typical daily Git workflow includes:
A. git push → git commit → git add
B. git pull → git add → git commit → git push
C. git clone → git fork → git init
D. git merge → git pull → git init
Answer: B

You might also like