Docsity

GitHub Foundations Certification Practice Exam Questions And Correct Answers, Exams of Computer Science

Toggle sidebar
bg1
GitHub Foundations Certification
Practice Exam Questions And Correct
Answers (Verified Answers) Plus
Rationales 2026 Q&A | Instant
Download Pdf
1. What is the primary purpose of GitHub?
a) Social media platform for developers
b) Version control and collaboration platform using Git
c) Cloud computing service
d) Database management system
b) Version control and collaboration platform using Git
Rationale: GitHub is a web-based platform that provides hosting for software
development and version control using Git. It facilitates collaboration among
developers by allowing them to track changes, manage repositories, and work
together on projects.
2. Which Git command is used to create a copy of a remote repository locally?
a) git push
b) git clone
c) git fork
d) git pull
b) git clone
Rationale: The git clone command creates a local copy of a remote repository,
including all of its files, branches, and commit history. This is the standard way
to start working on an existing repository.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21

Partial preview of the text

Download GitHub Foundations Certification Practice Exam Questions And Correct Answers and more Exams Computer Science in PDF only on Docsity!

GitHub Foundations Certification

Practice Exam Questions And Correct

Answers (Verified Answers) Plus

Rationales 2026 Q&A | Instant

Download Pdf

1. What is the primary purpose of GitHub? a) Social media platform for developers b) Version control and collaboration platform using Git c) Cloud computing service d) Database management system b) Version control and collaboration platform using Git Rationale: GitHub is a web-based platform that provides hosting for software development and version control using Git. It facilitates collaboration among developers by allowing them to track changes, manage repositories, and work together on projects. 2. Which Git command is used to create a copy of a remote repository locally? a) git push b) git clone c) git fork d) git pull b) git clone Rationale: The git clone command creates a local copy of a remote repository, including all of its files, branches, and commit history. This is the standard way to start working on an existing repository.

3. What is a GitHub repository? a) A storage location for files and their revision history b) A social media profile c) A type of database d) A programming language a) A storage location for files and their revision history Rationale: A GitHub repository (or "repo") is a storage space where project files and their version history are stored. It can contain folders, files, images, videos, spreadsheets, and data sets, along with the revision history of all changes. 4. Which of the following is a valid GitHub branch naming convention? a) feature/new-login b) new feature c) Feature/New Login d) new-feature! a) feature/new-login Rationale: GitHub branch naming conventions typically use lowercase letters, hyphens or slashes for separation, and avoid spaces and special characters. The format "feature/new-login" follows best practices for branch naming. 5. What does the "git commit - m" command do? a) Creates a new branch b) Saves changes to the local repository with a message c) Pushes changes to remote repository d) Deletes the repository b) Saves changes to the local repository with a message Rationale: The "git commit - m" command saves staged changes to the local repository along with a descriptive message (-m flag) that explains what changes were made. This creates a new commit in the repository's history. 6. What is a pull request in GitHub? a) A request to download code b) A mechanism to propose and review changes before merging

a) A personal copy of another user's repository Rationale: A fork is a personal copy of another user's repository that exists under your GitHub account. Forks allow you to freely experiment with changes without affecting the original repository, and they enable contribution to open-source projects.

10. What command is used to update your local branch with changes from a remote repository? a) git push b) git fetch or git pull c) git clone d) git merge b) git fetch or git pull Rationale: Both git fetch and git pull are used to retrieve changes from a remote repository. git fetch downloads changes without merging, while git pull downloads and merges changes into your current branch. 11. What is a README.md file? a) A file that contains build instructions b) A file that provides documentation and information about the repository c) A configuration file d) A binary file b) A file that provides documentation and information about the repository Rationale: The README.md file is a markdown file that typically contains information about the project, including its purpose, installation instructions, usage examples, and contribution guidelines. It's often the first thing visitors see when viewing a repository. 12. Which GitHub feature allows you to automate workflows based on events? a) GitHub Pages b) GitHub Actions c) GitHub Packages d) GitHub Issues

b) GitHub Actions Rationale: GitHub Actions is a CI/CD (Continuous Integration/Continuous Deployment) feature that allows you to automate workflows based on events such as pushes, pull requests, or scheduled times. It can build, test, and deploy your code automatically.

13. What is a branch in Git? a) A snapshot of the repository b) A pointer to a commit c) A type of file d) A tag b) A pointer to a commit Rationale: In Git, a branch is essentially a lightweight movable pointer to a commit. It allows developers to work on different features or fixes in isolation without affecting the main codebase. Each branch represents an independent line of development. 14. What is a merge conflict? a) When two branches have diverged and cannot be automatically merged b) When a repository is deleted c) When a pull request is approved d) When a commit fails a) When two branches have diverged and cannot be automatically merged Rationale: A merge conflict occurs when Git is unable to automatically reconcile differences between two branches. This typically happens when changes are made to the same line in a file or when one branch deletes a file that another branch has modified. 15. What is GitHub Issues used for? a) Tracking bugs, feature requests, and tasks b) Storing code c) Deploying applications d) Managing packages

permanent identifier that allows you to reference and retrieve the commit's contents.

19. What is GitHub Actions workflow? a) A set of instructions for testing b) A configurable automated process that runs one or more jobs c) A deployment script d) A type of repository b) A configurable automated process that runs one or more jobs Rationale: A GitHub Actions workflow is a YAML file that defines one or more jobs that run in response to events. Workflows can include steps for checking out code, installing dependencies, running tests, and deploying applications. 20. What does the "git log" command display? a) The commit history b) The current branch c) The file contents d) The remote URL a) The commit history Rationale: The git log command displays the commit history of the current branch, showing information such as commit hashes, author names, dates, and commit messages. It's used to review the sequence of changes made to the repository. 21. Which GitHub feature is used for hosting static websites directly from a repository? a) GitHub Actions b) GitHub Pages c) GitHub Packages d) GitHub Discussions b) GitHub Pages Rationale: GitHub Pages is a static site hosting service that takes HTML, CSS, and

JavaScript files directly from a repository and publishes them as a website. It's commonly used for project documentation, portfolios, and personal blogs.

22. What is a tag in Git? a) A specific version of the code b) A type of branch c) A commit message d) A file type a) A specific version of the code Rationale: A tag in Git is a reference to a specific commit that marks a particular point in the repository's history, such as a release version (v1.0, v2.0). Tags are typically used to mark release points and are different from branches as they don't move. 23. What is the purpose of a .gitattributes file? a) To define attributes for paths in the repository b) To ignore files c) To configure user settings d) To store secrets a) To define attributes for paths in the repository Rationale: The .gitattributes file is used to define attributes for specific paths in the repository. It can control things like line ending normalization, diff and merge strategies, and which files are considered binary vs. text. 24. Which command pushes local commits to a remote repository? a) git fetch b) git push c) git pull d) git clone b) git push Rationale: The git push command uploads local commit history to a remote repository, updating the remote branch with your local changes. This is how you share your commits with others.

c) The commit history d) The branch differences a) The current branch and changes to be committed Rationale: The git status command displays the state of the working directory and staging area. It shows which changes have been staged, which haven't, and which files are being tracked by Git.

29. What is the difference between a public and private repository on GitHub? a) Public repositories are free, private repositories cost money b) Public repositories are visible to everyone, private repositories are only visible to you and invited collaborators c) There is no difference d) Private repositories can only be accessed from GitHub Enterprise b) Public repositories are visible to everyone, private repositories are only visible to you and invited collaborators Rationale: Public repositories are accessible to anyone on the internet, allowing anyone to view, fork, and contribute to the code. Private repositories require specific access permissions and are only visible to the owner and explicitly invited collaborators. 30. Which file contains GitHub workflow definitions? a) .github/workflows/.yml b) .github/workflows c) workflow.yml d) actions.yml a) .github/workflows/.yml Rationale: GitHub workflow definitions are stored as YAML files in the .github/workflows directory of a repository. These files define the automated processes that run in response to GitHub events. 31. What is the purpose of GitHub Discussions? a) To have conversations and share ideas with the community b) To report bugs

c) To store code d) To deploy applications a) To have conversations and share ideas with the community Rationale: GitHub Discussions provides a dedicated space for developers and community members to engage in conversations, ask questions, share ideas, and provide feedback on a project. It's separate from Issues, which are used for tracking bugs and tasks.

32. Which Git command is used to see the differences between commits? a) git diff b) git compare c) git status d) git changes a) git diff Rationale: The git diff command shows the differences between various states of the repository, including changes between commits, the working directory and staging area, or branches. It's essential for reviewing changes before committing. 33. What is a GitHub Gist? a) A type of repository b) A simple way to share code snippets and pastes c) A branch protection rule d) A package manager b) A simple way to share code snippets and pastes Rationale: GitHub Gist is a service that provides a simple way to share code snippets, notes, and other text content. Each gist is a Git repository that can be cloned, forked, and versioned. Gists can be public or secret. 34. What does CI/CD stand for? a) Continuous Integration / Continuous Deployment b) Code Integration / Code Delivery

b) An integration that can interact with GitHub APIs Rationale: A GitHub App is a type of integration that can interact with GitHub's APIs to perform automated tasks, respond to events, and extend GitHub's functionality. Unlike webhooks or OAuth apps, GitHub Apps operate with more granular permissions.

38. What does "git rebase" do? a) It merges two branches b) It reapplies commits on top of another base tip c) It deletes a branch d) It creates a new commit b) It reapplies commits on top of another base tip Rationale: Git rebase is a command that moves or combines a sequence of commits to a new base commit. It's used to maintain a cleaner, more linear project history by integrating changes from one branch into another. 39. What is the purpose of the .github folder? a) To store GitHub-related configuration files b) To store source code c) To store dependencies d) To store temporary files a) To store GitHub-related configuration files Rationale: The .github folder at the root of a repository is used to store GitHub- specific files, including issue templates, pull request templates, CODEOWNERS, and workflow definitions. It helps standardize and automate repository management. 40. What is a Git remote? a) A reference to a remote repository b) A local branch c) A commit hash d) A file in the repository

a) A reference to a remote repository Rationale: A Git remote is a reference to a repository hosted elsewhere, such as on GitHub. It allows you to push and pull changes between your local repository and the remote version. The default remote is typically named "origin".

41. What is the purpose of GitHub Security Advisories? a) To report security vulnerabilities privately b) To advertise products c) To share code d) To manage team members a) To report security vulnerabilities privately Rationale: GitHub Security Advisories provide a private space for maintainers to discuss and coordinate the resolution of security vulnerabilities. They allow for confidential reporting and collaboration before publicly disclosing the issue. 42. Which command undoes changes in the working directory? a) git checkout -- filename b) git revert filename c) git restore --staged filename d) git reset filename a) git checkout -- filename Rationale: The "git checkout -- filename" command discards changes made to a file in the working directory, restoring it to the state of the last commit. This is a way to revert uncommitted changes. 43. What is GitHub Sponsors? a) A program to sponsor open-source developers b) A crowdfunding platform for startups c) A code hosting service d) A job board a) A program to sponsor open-source developers Rationale: GitHub Sponsors is a program that allows individuals and organizations to financially support open-source developers and projects. It

47. What is a GitHub Action secret? a) A password stored in the repository b) An encrypted environment variable for workflows c) A private repository d) A branch protection rule b) An encrypted environment variable for workflows Rationale: GitHub Actions secrets are encrypted environment variables that you can create for use in workflows. They allow you to store sensitive information, such as API tokens or deployment credentials, securely without exposing them in your code. 48. What is the purpose of the CONTRIBUTING.md file? a) To provide guidelines for contributing to the project b) To list contributors c) To store code d) To define branch policies a) To provide guidelines for contributing to the project Rationale: The CONTRIBUTING.md file provides guidelines for contributors on how to participate in the project, including coding standards, testing requirements, and submission processes. It helps maintain consistent and high- quality contributions. 49. What does "git cherry-pick" do? a) Applies a specific commit from one branch to another b) Picks the best commit c) Deletes a commit d) Merges all commits a) Applies a specific commit from one branch to another Rationale: Git cherry-pick is a command that takes a specific commit from one branch and applies it to another. It's useful for selectively copying changes without merging entire branches, especially for bug fixes or hotfixes.

50. What is the GitHub API? a) A programming interface for interacting with GitHub programmatically b) A graphical user interface c) A type of repository d) A deployment tool a) A programming interface for interacting with GitHub programmatically Rationale: The GitHub API is a RESTful API that allows developers to programmatically interact with GitHub features and data. It provides endpoints for managing repositories, issues, pull requests, and other GitHub resources, enabling automation and integration with other tools. **Questions 51- 100

  1. What is the difference between git pull and git fetch?** a) git pull downloads changes, git fetch merges them b) git fetch downloads changes, git pull downloads and merges them c) They are the same d) git pull only works on remote branches b) git fetch downloads changes, git pull downloads and merges them Rationale: git fetch downloads changes from the remote repository without integrating them into the current branch. git pull combines the fetch operation with a merge, downloading changes and immediately integrating them. git pull is essentially git fetch followed by git merge. 52. What is a GitHub Team? a) A group of users with shared permissions b) A group of repositories c) A branch protection rule d) A deployment environment a) A group of users with shared permissions Rationale: A GitHub Team is a group of users within an organization that share

like audio, video, or datasets with text pointers while storing the file contents on a remote server. This helps keep Git repositories lightweight and performant.

56. What is the purpose of a GitHub release? a) To package and distribute a specific version of the project b) To deploy code to production c) To create a new branch d) To add collaborators a) To package and distribute a specific version of the project Rationale: GitHub releases allow you to package and distribute specific versions of your software, providing downloadable archives and release notes. They mark important milestones in your project's development and make it easy for users to download stable versions. 57. What does "git reset --hard HEAD~1" do? a) Moves the HEAD pointer back one commit and discards all changes b) Shows the commit history c) Creates a new commit d) Merges two branches a) Moves the HEAD pointer back one commit and discards all changes Rationale: The "git reset --hard HEAD~1" command resets the repository state to the commit before the current HEAD, discarding all changes and commits after that point. This is a destructive operation that permanently removes commits and changes. 58. What is GitHub Advanced Security? a) A security feature suite for code scanning and secret protection b) A two-factor authentication system c) A password manager d) A security training program a) A security feature suite for code scanning and secret protection Rationale: GitHub Advanced Security is a suite of security features that includes code scanning, secret scanning, and dependency review. It helps identify

vulnerabilities in code, detect exposed secrets, and assess dependency security risks.

59. What is a Git submodule? a) A link to an external repository within a repository b) A subset of the repository c) A type of branch d) A commit type a) A link to an external repository within a repository Rationale: Git submodules allow you to include and track another repository as a subdirectory within your main repository. This is useful for managing dependencies or incorporating external libraries while maintaining their independent version control. 60. What is the purpose of GitHub Actions environment variables? a) To customize workflow behavior b) To store code c) To define branches d) To manage permissions a) To customize workflow behavior Rationale: Environment variables in GitHub Actions allow you to customize workflow behavior, pass data between steps, and access context information about the workflow run. They can be set at the workflow, job, or step level and can be either public or secret. 61. Which command switches to an existing branch? a) git checkout branch-name b) git switch branch-name c) Both git checkout branch-name and git switch branch-name d) git branch branch-name c) Both git checkout branch-name and git switch branch-name Rationale: Both git checkout and git switch can be used to switch to an existing