All Microsoft exams

Free GH-500 practice test: 30 questions with answers

30 original questions for GitHub Advanced Security, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.

Free questions
30
Full bank
100 questions

GH-500 exam guide: topics, cost and format

All 30 GH-500 questions with answers

The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.

Configure and use code scanning (8 questions)

  1. Question 1

    A team wants to find SQL injection and other vulnerabilities in its Python and JavaScript code automatically on every pull request. Which feature should be configured?

    1. ASecret scanning custom patterns defined per repository
    2. BOrganization audit log streaming to a SIEM destination
    3. CDependabot alerts for vulnerable dependency versions
    4. DCode scanning with CodeQL default or advanced setup
    Show answer and explanation
    Correct answer: D

    CodeQL-based code scanning analyzes source code for vulnerabilities and can run on pull requests. Dependabot checks dependencies, secret scanning finds credentials, and audit logs record administrative events.

  2. Question 2

    Which format does code scanning use to upload analysis results from third-party tools to GitHub?

    1. ACSV only
    2. BSARIF
    3. CPDF reports
    4. DJPEG screenshots
    Show answer and explanation
    Correct answer: B

    SARIF is the Static Analysis Results Interchange Format that code scanning accepts from external tools. CSV and PDF are not the upload format, and screenshots carry no structured results.

  3. Question 3

    A CodeQL analysis on a pull request reports an alert, but the developer believes it is a false positive. What is the correct way to handle it?

    1. ADeleting the CodeQL workflow file so the alert no longer appears in the pull request checks
    2. BReviewing the alert and dismissing it with a reason, such as false positive or used in tests, with a comment
    3. CMerging the pull request without addressing the alert, since the check is not a required status
    4. DDisabling code scanning across the organization's repositories until the next release cycle
    Show answer and explanation
    Correct answer: B

    Dismissing an alert with a reason and comment records the decision for audit while keeping the scanning active. Deleting the workflow, merging ignoring the alert and disabling scanning remove oversight.

  4. Question 4

    A repository uses a custom CodeQL query pack for internal coding standards. Where should the custom query be added so it runs in the analysis?

    1. AAdding the query path to the body of the latest commit message
    2. BCreating an issue template that lists the custom query for reviewers to read
    3. CIn the CodeQL configuration referenced by the code scanning workflow
    4. DAdding the query name in the repository README under a Code Scanning heading
    Show answer and explanation
    Correct answer: C

    Custom queries are included through the CodeQL configuration used by the workflow. A README, commit messages and issue templates do not affect the analysis.

  5. Question 5

    A code scanning workflow fails because the analysis cannot access the build outputs of a compiled language. What should the team review first?

    1. AThe number of collaborators who have write access to the repository
    2. BThe license file and the open source terms that apply to the repository
    3. CThe color scheme and theme choices used by the repository dashboard in the browser
    4. DThe build steps in the CodeQL workflow that produce the compiled output for analysis
    Show answer and explanation
    Correct answer: D

    Compiled languages require the build to run inside the analysis, so build steps must be correct. Color schemes, collaborator counts and licenses do not affect the analysis.

  6. Question 6

    Which two practices improve the value of code scanning in a team's workflow? (Choose two.)

    1. ARunning scans on pull requests and the default branch on a schedule
    2. BTriaging alerts with clear dismissal reasons and fixing high-severity issues before merge
    3. CIgnoring warnings because they are usually false positives
    4. DRunning code scanning only once after the first release
    5. EDisabling the workflow when it takes longer than five minutes
    Show answer and explanation
    Correct answer: A, B

    Scanning pull requests and the default branch on a schedule catches issues early and continuously, and disciplined triage improves signal. Ignoring warnings, one-time scans and disabling workflows reduce coverage.

  7. Question 7

    A repository runs CodeQL on pull requests and the default branch. Which setting helps ensure that a failing code scan blocks merging?

    1. AAdding a README status badge that links to the latest workflow run for the default branch
    2. BRequiring the code scanning result as a status check in branch protection
    3. CDisabling required status checks for code scanning so pull requests can merge faster
    4. DSetting the default branch to an archived branch that receives no code scanning runs yet
    Show answer and explanation
    Correct answer: B

    Requiring code scanning as a status check in branch protection prevents merges when the required scan fails or reports blocking results. Disabling checks, badges and archived branches do not enforce gating.

  8. Question 8

    A CodeQL scan of a JavaScript project shows many findings in generated files that the team does not maintain. What is the most effective way to reduce noise?

    1. ADeleting the code scanning workflow file entirely from the repository
    2. BRenaming the generated files to test files with a .spec suffix during CI
    3. CDismissing each finding one by one as a false positive without reviewing them in the alert view
    4. DExcluding the generated paths from the analysis scope in the CodeQL configuration
    Show answer and explanation
    Correct answer: D

    Path exclusions in the CodeQL configuration remove generated code from analysis, which reduces noise without hiding real issues in maintained code. Manual mass dismissal, deleting the workflow and renaming files are poor controls.

Manage security for an organization (8 questions)

  1. Question 9

    An organization wants all new repositories to have Advanced Security features enabled automatically. Which approach implements this?

    1. AConfiguring code security settings at the organization level with defaults for new repositories
    2. BAsking developers to enable features on new repositories when they remember to do so
    3. CEnabling features manually on each repository after creation via its security settings page
    4. DDisabling features for new repositories by default to reduce configuration overhead
    Show answer and explanation
    Correct answer: A

    Organization-level code security configurations can apply defaults to new repositories, which keeps coverage consistent. Manual or memory-based enabling leaves gaps, and disabling defaults works against the goal.

  2. Question 10

    A security manager wants a single view of alerts across all repositories in the organization to prioritize remediation. Which feature provides this?

    1. AThe organization's logo settings
    2. BThe order of repositories on the profile page
    3. CSecurity overview for the organization
    4. DA repository's README file
    Show answer and explanation
    Correct answer: C

    Security overview aggregates alerts and coverage across repositories, which supports prioritization. The README, logo settings and profile order do not aggregate security data.

  3. Question 11

    A team wants to know which repositories have code scanning and secret scanning enabled. Which view should be used?

    1. AThe personal gist library of each team member's snippets
    2. BThe discussions page of one unrelated repository in the org
    3. CThe GitHub Marketplace listing for the scanning tool
    4. DSecurity coverage views in the organization's security overview
    Show answer and explanation
    Correct answer: D

    Security coverage views show which repositories have each feature enabled. Marketplace, gists and discussions do not report coverage.

  4. Question 12

    Which setting prevents users outside the organization from accessing private repositories through forks or collaboration in ways that conflict with policy?

    1. ARepository and fork policies at the organization level
    2. BA personal avatar upload setting for the profile picture
    3. CThe choice of code font, editor theme and tab width for each user
    4. DThe number of stars and forks shown on each repository page
    Show answer and explanation
    Correct answer: A

    Organization policies for repository visibility and forks control who can access or copy private code. Avatars, fonts and star counts do not control access.

  5. Question 13

    An organization wants to ensure that its security settings are enforced on all repositories, not configured differently per team. Which option is most appropriate?

    1. ATelling each team to choose its own settings for the repositories it maintains
    2. BChanging settings in the test repository while leaving production repositories as they are
    3. CEnterprise or organization-level security policies that apply to repositories
    4. DRelying on memory for settings and reviewing them informally during occasional team meetings
    Show answer and explanation
    Correct answer: C

    Enterprise or organization-level policies apply consistently to repositories, which reduces configuration drift. Team-by-team choices, test-only changes and memory-based controls do not enforce consistency.

  6. Question 14

    Which two items should an organization review to demonstrate that its GitHub Advanced Security coverage is effective? (Choose two.)

    1. AThe average length of commit messages in unrelated projects
    2. BThe number of emoji reactions on issues
    3. CThe percentage of repositories with code scanning and secret scanning enabled
    4. DThe number of open alerts by severity and their age
    5. EThe number of stars received by its public repositories
    Show answer and explanation
    Correct answer: C, D

    Coverage percentages and the open alert backlog by severity and age show whether security is applied and is being resolved. Stars, commit message lengths and emoji reactions do not measure security effectiveness.

  7. Question 15

    An enterprise wants to track changes to GitHub security settings and who made them. Which feature provides this record?

    1. AThe audit log for the enterprise or organization
    2. BThe release notes page for tagged versions
    3. CThe repository's star history graph over time
    4. DThe contributor graph and the insights page
    Show answer and explanation
    Correct answer: A

    The audit log records administrative and security setting changes with actor and time. Star history, release notes and contributor graphs do not record configuration changes.

  8. Question 16

    A security team wants to enforce that only approved GitHub Apps can access organization repositories. Which control should be used?

    1. ARestricting third-party app access and approving apps at the organization level
    2. BMaking the repositories public so apps need no approval and skipping the organization access review
    3. CAllowing each app to access the repositories by default in the organization with write scope
    4. DSharing one personal access token across the repositories with a service account for CI jobs
    Show answer and explanation
    Correct answer: A

    Restricting app access and approving apps at the organization level limits which integrations can act on repositories. Default open access, shared personal tokens and public repositories all weaken control.

Configure and use dependency management (7 questions)

  1. Question 17

    A project depends on a library that has a published high-severity vulnerability with a fixed version available. Which GitHub feature alerts maintainers and identifies the fix?

    1. ACode scanning default setup for C++ to flag risky coding patterns
    2. BBranch protection rules with required status checks
    3. CSecret scanning push protection on new commits
    4. DDependabot security alerts for vulnerable dependencies
    Show answer and explanation
    Correct answer: D

    Dependabot security alerts identify vulnerable dependencies and show the patched version when one exists. Secret scanning finds credentials, code scanning analyzes code patterns, and branch protection controls merges.

  2. Question 18

    Dependabot security updates are enabled, but a pull request is needed to upgrade a dependency that is only used in tests. What should the maintainer consider?

    1. AIgnoring the update because it affects test code and does not ship with the production application or its runtime
    2. BWhether the dependency is a development dependency and whether the update still needs review before merge
    3. CMerging updates automatically without checking whether the test suite passes first
    4. DRemoving the dependency entirely from the project manifest so that Dependabot has nothing left to update in the repository
    Show answer and explanation
    Correct answer: B

    Development dependencies still need review and passing checks, and maintainers should confirm the update does not break tests or builds. Ignoring updates, merging without checks and removing all dependencies are not sound.

  3. Question 19

    Which file lets a team schedule regular version updates for dependencies in a repository, with specified ecosystems and intervals?

    1. AA Dependabot configuration file in the .github directory
    2. BA Dockerfile in the root directory listing the container build steps
    3. CA .gitignore file in the root that lists untracked paths
    4. DA LICENSE file in the root that states the terms of use for users
    Show answer and explanation
    Correct answer: A

    The dependabot.yml file in the .github directory configures update ecosystems, schedules and grouping. Gitignore controls tracked files, Dockerfiles define images and LICENSE files state terms.

  4. Question 20

    A pull request introduces a new dependency with a known critical vulnerability. Which feature helps reviewers see this before merging?

    1. ADependency review action or dependency review in the pull request checks
    2. BThe Wiki page last edited date and its full revision history
    3. CThe repository's star count and number of watchers today
    4. DThe number of commits on the default branch since creation
    Show answer and explanation
    Correct answer: A

    Dependency review checks show newly introduced vulnerable or license-problematic dependencies in the pull request before merge. Star counts, commit counts and wiki dates do not indicate vulnerability.

  5. Question 21

    Which information does the dependency graph provide in a repository?

    1. AThe hosting cost of the repository, including storage billed per gigabyte and Actions minutes consumed by each workflow run
    2. BThe packages and versions the repository depends on, including transitive dependencies for supported ecosystems
    3. CThe list of employees who committed code, along with their role and access level in each of the organization's teams
    4. DThe user interface design of the application, including layout, fonts and color palette
    Show answer and explanation
    Correct answer: B

    The dependency graph lists direct and transitive dependencies for supported ecosystems, which underlies alerts and reviews. The other items are not dependency data.

  6. Question 22

    Which two statements about Dependabot are accurate? (Choose two.)

    1. ADependabot alerts are based on advisory data for the dependencies in the repository
    2. BDependabot merges every pull request automatically without any review
    3. CDependabot works only for repositories that have no dependencies
    4. DDependabot can only be enabled by repository owners in personal accounts
    5. EDependabot can open pull requests to update vulnerable dependencies
    Show answer and explanation
    Correct answer: A, E

    Dependabot opens update pull requests and generates alerts based on advisory data for the repository's dependencies. It does not merge automatically by default, it needs dependencies to scan, and it can be enabled by organizations as well.

  7. Question 23

    Dependabot identifies a vulnerable transitive dependency that a direct dependency pulls in. What is the most useful next step?

    1. AIgnoring the alert because it is not a direct dependency of the application manifest
    2. BDeleting the packages from the lock file and regenerating it from scratch with the latest resolved versions on every build
    3. CDisabling the dependency graph for the entire organization's private repositories
    4. DUpdating the direct dependency or using an override so the transitive package moves to a fixed version
    Show answer and explanation
    Correct answer: D

    Updating the parent or applying an override moves the transitive dependency to a fixed version, which resolves the alert. Ignoring it leaves the vulnerability in place, deleting lock files breaks reproducibility, and disabling the graph hides information.

Configure and use secret scanning (7 questions)

  1. Question 24

    A developer accidentally commits an AWS access key to a repository. Which GitHub feature stops the push before the secret reaches the remote?

    1. APush protection in secret scanning
    2. BBranch protection requiring two reviews
    3. CDependabot version updates
    4. DCodeQL default setup
    Show answer and explanation
    Correct answer: A

    Push protection blocks commits that contain detected secrets before they reach the repository. Dependabot and CodeQL analyze dependencies and code after the push, and review rules do not inspect for secrets.

  2. Question 25

    An organization wants alerts for leaked credentials in its repositories, including from partner tokens that GitHub recognizes. Which feature provides this?

    1. ACode scanning results written to SARIF format
    2. BDependency graph exported as a CSV list of packages
    3. CSecret scanning alerts with partner pattern detection enabled
    4. DSecurity advisories published for the organization
    Show answer and explanation
    Correct answer: C

    Secret scanning alerts report detected secrets, including partner patterns that GitHub recognizes. SARIF is a code scanning format, the dependency graph lists packages, and advisories describe vulnerabilities rather than leaked secrets.

  3. Question 26

    A security team wants to find secrets that were committed in the past across all branches, not only new pushes. Which action should be taken?

    1. ARunning secret scanning on the existing repository history
    2. BDeleting the repository and recreating it empty
    3. CWaiting for the next commit to trigger a scan of the default branch
    4. DChanging the repository default branch name to main
    Show answer and explanation
    Correct answer: A

    Secret scanning covers the repository history when enabled, which surfaces older exposed secrets. Waiting for new commits misses existing exposures, and recreating or renaming the repository does not remove history.

  4. Question 27

    A leaked token has been reported in a secret scanning alert. What is the most appropriate response?

    1. AMaking the repository public so the community can help identify and report the leaked token
    2. BIgnoring it because the token is old and was used during an earlier internal test phase
    3. CClosing the alert as a false positive without checking whether the token grants access to the service
    4. DRevoking or rotating the token at the issuing service and then closing the alert with the correct resolution
    Show answer and explanation
    Correct answer: D

    A leaked secret must be revoked or rotated at the issuing service, since removing it from code does not invalidate it. Closing without checking, publicizing the repository and ignoring old tokens all leave the credential usable.

  5. Question 28

    A team wants a custom pattern to detect its internal token format in secret scanning. Which setting should be used?

    1. AA new branch named tokens that stores the regex for internal token formats in the tree
    2. BA custom pattern defined at the repository, organization, or enterprise level
    3. CA label on the repository that marks it as containing internal tokens
    4. DA comment in each source file that lists the internal token pattern to match exactly
    Show answer and explanation
    Correct answer: B

    Custom patterns define the regex for internal token formats and can be scoped to repositories, organizations or enterprises. Branch names, labels and comments do not configure detection.

  6. Question 29

    An alert shows a secret in a commit that has already been merged to the main branch. Which step best removes the exposure from future clones?

    1. AAdding the secret to the README file so teammates can see where the credential is documented and reuse it across services
    2. BMaking the repository private and ignoring the secret alert because the repository is no longer public
    3. CRewriting history to remove the secret and rotating the credential, since removal alone does not invalidate it
    4. DDeleting the commit message from the affected commit while keeping the same file contents and the branch history unchanged
    Show answer and explanation
    Correct answer: C

    Rewriting history removes the secret from future clones, but the credential must still be rotated because copies may already exist. Changing the message, documenting the secret and only changing visibility do not remove exposure.

  7. Question 30

    Which two actions reduce the risk of committing secrets to a repository? (Choose two.)

    1. AHardcoding API keys in source files for convenience
    2. BSharing a single admin token in a README
    3. CDisabling secret scanning alerts to reduce noise
    4. DEnabling push protection to block secrets at push time
    5. EStoring secrets in a secure secrets store and referencing them in workflows
    Show answer and explanation
    Correct answer: D, E

    Push protection prevents secrets from being pushed, and secure stores keep credentials out of code. Hardcoded keys, shared tokens in documents and disabled alerts all increase exposure.

Want more GH-500 questions?

The full bank has 100 questions with answers and explanations, as a PDF, an online practice exam, or both.

Full question bank · 100 questions
$89$124

Both formats together. The best value.

Instant access after payment, with 90 days of updates. Checkout is on our store, AIExamCerts.