Skip to main content

Git MCQ

Question : What is Git?

A version control system

A programming language

An operating system

A web browser

Correct Answer :  A version control system 

 

Question : How do you create a new Git repository?

`git init`

`git create`

`git new`

`git repo init`

Correct Answer :  `git init` 

 

Question : How do you clone an existing Git repository?

`git clone <repository_url>`

`git pull <repository_url>`

`git checkout <repository_url>`

`git fetch <repository_url>`

Correct Answer :  `git clone <repository_url>` 

 

Question : How do you stage changes in Git?

`git add .`

`git commit -m 'message'`

`git stage .`

`git push`

Correct Answer :  `git add .` 

 

Question : How do you commit changes in Git?

`git commit -m 'message'`

`git add .`

`git push`

`git commit -a -m 'message'`

Correct Answer :  `git commit -m 'message'` 

 

Question : How do you check the status of your Git repository?

`git status`

`git info`

`git check`

`git show`

Correct Answer :  `git status` 

 

Question : How do you create a new branch in Git?

`git new-branch <branch_name>`

`git create-branch <branch_name>`

`git branch <branch_name>`

`git checkout -b <branch_name>`

Correct Answer :  `git checkout -b <branch_name>` 

 

Question : How do you switch to a different branch in Git?

`git switch <branch_name>`

`git checkout <branch_name>`

`git change-branch <branch_name>`

`git move-to <branch_name>`

Correct Answer :  `git checkout <branch_name>` 

 

Question : How do you merge branches in Git?

`git merge <branch_name>`

`git branch <branch_name>`

`git merge-branch <branch_name>`

`git combine <branch_name>`

Correct Answer :  `git merge <branch_name>` 

 

Question : How do you resolve conflicts in Git?

Manually edit the conflicted files

`git resolve`

`git conflict`

`git fix`

Correct Answer :  Manually edit the conflicted files 

 

Question : How do you view the commit history in Git?

`git log`

`git history`

`git show`

`git commits`

Correct Answer :  `git log` 

 

Question : How do you discard changes in a file and revert to the last commit version in Git?

`git discard <file>`

`git revert <file>`

`git reset <file>`

`git remove <file>`

Correct Answer :  `git reset <file>` 

 

Question : How do you remove a file from a Git repository?

`git remove <file>`

`git delete <file>`

`git rm <file>`

`git erase <file>`

Correct Answer :  `git rm <file>` 

 

Question : How do you rename a file in Git?

`git rename <old_name> <new_name>`

`git mv <old_name> <new_name>`

`git move <old_name> <new_name>`

`git rename-file <old_name> <new_name>`

Correct Answer :  `git mv <old_name> <new_name>` 

 

Question : How do you view the changes made in a specific commit in Git?

`git changes <commit_id>`

`git show <commit_id>`

`git diff <commit_id>`

`git view <commit_id>`

Correct Answer :  `git show <commit_id>` 

 

Question : How do you remove untracked files in Git?

`git remove-untracked`

`git clean`

`git clear`

`git remove --untracked`

Correct Answer :  `git clean` 

 

Question : How do you undo the last commit in Git?

`git undo`

`git revert HEAD`

`git reset --hard HEAD`

`git commit --undo`

Correct Answer :  `git reset --hard HEAD` 

 

Question : How do you create and apply a Git patch?

`git create-patch` and `git apply-patch`

`git patch-create` and `git patch-apply`

`git diff > patch` and `git apply patch`

`git create-diff` and `git apply-diff`

Correct Answer :  `git diff > patch` and `git apply patch` 

 

Question : How do you discard changes in all files and revert to the last commit version in Git?

`git discard-all`

`git reset --hard HEAD`

`git revert-all`

`git remove-all`

Correct Answer :  `git reset --hard HEAD` 

 

Question : How do you remove a branch in Git?

`git remove-branch <branch_name>`

`git branch -d <branch_name>`

`git delete <branch_name>`

`git rm <branch_name>`

Correct Answer :  `git branch -d <branch_name>` 

 

Question : How do you rename a branch in Git?

`git rename-branch <old_name> <new_name>`

`git mv-branch <old_name> <new_name>`

`git branch -m <old_name> <new_name>`

`git move-branch <old_name> <new_name>`

Correct Answer :  `git branch -m <old_name> <new_name>` 

 

Question : How do you view the changes made between two commits in Git?

`git diff <commit1> <commit2>`

`git changes <commit1>..<commit2>`

`git show <commit1>..<commit2>`

`git diff <commit1>..<commit2>`

Correct Answer :  `git diff <commit1> <commit2>` 

 

Question : How do you create an empty commit in Git?

`git commit --empty`

`git commit -e`

`git commit -a`

`git commit --allow-empty`

Correct Answer :  `git commit --allow-empty` 

 

Question : How do you remove a remote branch in Git?

`git remote remove <branch_name>`

`git remove remote <branch_name>`

`git remote delete <branch_name>`

`git push --delete origin <branch_name>`

Correct Answer :  `git push --delete origin <branch_name>` 

 

Question : How do you update your local repository with changes from the remote repository in Git?

`git fetch` followed by `git merge`

`git pull`

`git sync`

`git update`

Correct Answer :  `git pull` 

 

Question : How do you view the list of remote repositories in Git?

`git list-remotes`

`git remote show`

`git remote list`

`git remote -v`

Correct Answer :  `git remote -v` 

 

Question : How do you push a new branch to a remote repository in Git?

`git push <remote> <branch>`

`git push --branch <branch>`

`git push origin <branch>`

`git push -b <branch>`

Correct Answer :  `git push <remote> <branch>` 

 

Question : How do you configure your name and email in Git?

`git set-name <name>` and `git set-email <email>`

`git config user.name <name>` and `git config user.email <email>`

`git name <name>` and `git email <email>`

`git config --name <name>` and `git config --email <email>`

Correct Answer :  `git config user.name <name>` and `git config user.email <email>` 

 

Question : How do you create an annotated tag in Git?

`git tag <tag_name>`

`git create-tag <tag_name>`

`git annotate-tag <tag_name>`

`git tag -a <tag_name>`

Correct Answer :  `git tag -a <tag_name>` 

 

Question : How do you view the list of tags in Git?

`git list-tags`

`git show-tags`

`git tag`

`git tag list`

Correct Answer :  `git tag`

Comments

popular

Privacy policy for Sri Bhagavat Gita

 Privacy Policy for Sri Bhagavad Gita This respects the privacy of its users and is committed to protecting their personal information. This privacy policy outlines the information collected by This and how it is used. Information We Collect : We are not collecting any personal information such as name and email address. This may collect non-personal information such as device type, operating system version, and app usage data to improve the app's functionality and user experience. Sharing of Information This does not sell or share personal information with third parties for marketing purposes. This may share personal information with service providers for the purpose of providing registration or support services to the user. Security of Information This takes reasonable measures to protect user data against unauthorized access, alteration, or destruction. However, This cannot guarantee the security of user data transmitted over the internet. Children's Privacy This does not kn

Privacy policy for BMI calculator

Privacy Policy for BMI Calculator  Effective Date: 5th July 2023 1.1 Personal Information: We do not collect any personally identifiable information (PII) such as your name, address, email, or phone number when you use the App. 1.2 Non-Personal Information: The App may collect certain non-personal information automatically, such as your device's unique identifier (UDID), device type, operating system, language preferences, and anonymous usage statistics. This information is collected to improve the functionality and user experience of the App and is not linked to any personally identifiable information. 2. Use of Information: 2.1 Personal Information: As stated earlier, we do not collect any personal information through the App. Therefore, we do not use or share any personal information. 2.2 Non-Personal Information: The non-personal information collected by the App may be used for the following purposes: - To improve the performance, functionality, and user experience of the App.

privacy policy for Selenium App

 Effective Date: 16 Sep 2023 URL -  https://play.google.com/store/apps/details?id=com.csj.selenium 1. Introduction :   This Privacy Policy outlines how we collect, use, disclose, and safeguard your personal information when you use our Android application ("App"). By accessing or using the App, you agree to the terms and practices described in this Privacy Policy. If you do not agree with our policies and practices, please do not use the App. 2. Information We Collect : - 2.1. Personal Information: We do not collect any personal information from you directly. However, we may collect non-personal information such as device information (e.g., device type, operating system, unique device identifier), and usage data (e.g., pages visited, interactions within the App). 2.2. User-Generated Content: The App allows you to submit questions and answers. Any content you submit will be stored on your local device.  3. How We Use Your Information -We may use non-personal information for an