Blog

MCQs

Disclaimer:

Educational Use Only:

The website links provided are to be used strictly for educational and knowledge-gaining purposes only.

No Misuse:

Do not misuse the links or the information contained therein for any commercial, illegal, or unethical activities.

Respect for Websites and Businesses:

Respect the intellectual property and business interests of the websites and their owners. Do not attempt to alter, copy, or redistribute content without proper authorization.

Acknowledge Value of Knowledge:

Recognize and value the knowledge and resources shared by these websites. Use the information responsibly and ethically.

No Endorsement:

The provision of these links does not imply endorsement of the linked sites, their content, or their products and services. Users are responsible for evaluating the suitability and accuracy of the information.

User Responsibility:

By accessing these links, you agree to use the information at your own risk and to comply with all applicable laws and website terms of use.


  1. Which of the following is a primary security risk when using public code repositories?
    a. Code plagiarism
    b. Unintentional exposure of sensitive information
    c. Poor documentation
    d. License conflicts
    Answer: b. Unintentional exposure of sensitive informationsnyk+2
  2. What is the most secure way to manage credentials in code repositories?
    a. Hardcoding in source files
    b. Using environment variables and secret managers
    c. Committing to a separate branch
    d. Adding to the README file
    Answer: b. Using environment variables and secret managersget.assembla+1
  3. Which access control strategy is essential for securing code repositories?
    a. Open access for all contributors
    b. Role-based access control (RBAC)
    c. Anonymous uploads
    d. Universal write permissions
    Answer: b. Role-based access control (RBAC)checkmarx+2
  4. What is the purpose of repository health monitoring in cybersecurity?
    a. To check spelling errors
    b. To identify vulnerabilities and configuration issues
    c. To reduce code complexity
    d. To increase codebase size
    Answer: b. To identify vulnerabilities and configuration issuescheckmarx+1
  5. Which tool is commonly used to scan source code repositories for secrets and sensitive information?
    a. Jenkins
    b. TruffleHog
    c. Nagios
    d. PuTTY
    Answer: b. TruffleHogsnyk+1
  6. Why is it important to set branch protection rules in a shared code repository?
    a. To speed up code pushes
    b. To prevent force pushes and unauthorized merges
    c. To allow experimental features
    d. To improve backup speeds
    Answer: b. To prevent force pushes and unauthorized mergesharness+1
  7. Which of these should NOT be stored in a code repository?
    a. Application source code
    b. API keys and passwords
    c. Documentation
    d. Configuration templates
    Answer: b. API keys and passwordsget.assembla+2
  8. How does multifactor authentication (MFA) protect code repositories?
    a. By encrypting all files
    b. By requiring multiple verification methods for access
    c. By automating code reviews
    d. By optimizing repository size
    Answer: b. By requiring multiple verification methods for accessharness+2
  9. Which version control system is most widely used for secure code management?
    a. CVS
    b. Subversion
    c. Git
    d. Mercurial
    Answer: c. Gitwayground+2
  10. What is the primary purpose of using signed commits in Git repositories?
    a. To allow large file commits
    b. To verify the authenticity of commit authors
    c. To disable merge conflicts
    d. To speed up CI/CD pipelines
    Answer: b. To verify the authenticity of commit authorscheckmarx+2
  11. A common vulnerability caused by improper repository permissions is:
    a. Data compression issues
    b. Unauthorized code modification
    c. Color mismatches
    d. Font inconsistencies
    Answer: b. Unauthorized code modificationncsc+2
  12. Which file is often targeted to extract secrets from a repository accidentally?
    a. README.md
    b. .env
    c. index.html
    d. LICENSE.md
    Answer: b. .envsnyk+1
  13. What is one way to ensure third-party dependencies do not introduce vulnerabilities into the repository?
    a. Ignore dependency updates
    b. Run automated dependency scans
    c. Refuse external contributions
    d. Manually inspect every line of code
    Answer: b. Run automated dependency scansget.assembla+2
  14. Which practice helps prevent supply chain attacks via code repositories?
    a. Allowing open pull requests
    b. Verifying and signing code
    c. Disabling authentication
    d. Removing branch protections
    Answer: b. Verifying and signing codencsc+2
  15. Where should sensitive backup files be kept in relation to a public code repository?
    a. Within the repository
    b. In a separate, secured location
    c. In an open cloud bucket
    d. Attached to issues
    Answer: b. In a separate, secured locationncsc+2
  16. Which statement best describes the “principle of least privilege” in repository management?
    a. Users get full access by default
    b. Only necessary permissions are granted
    c. All users share one account
    d. Privileges are assigned randomly
    Answer: b. Only necessary permissions are grantedcheckmarx+2
  17. What is the recommended action if a private key is accidentally committed to a public repository?
    a. Ignore it
    b. Change the key and delete the commit
    c. Add a comment
    d. Increase repository size
    Answer: b. Change the key and delete the commitsnyk+2
  18. Which of the following is a sign of a compromised code repository?
    a. Increase in commit frequency
    b. Unauthorized access or changes
    c. Fewer code reviewers
    d. Decrease in file size
    Answer: b. Unauthorized access or changesget.assembla+2
  19. What feature does GitHub offer to help enforce mandatory reviews of pull requests?
    a. Forking
    b. Merge queues
    c. Branch protection rules
    d. Issue tracking
    Answer: c. Branch protection rulesharness+1
  20. Which protocol is preferred for secure repository access?
    a. FTP
    b. Telnet
    c. SSH
    d. HTTP
    Answer: c. SSHncsc+2
  21. Insecure 3rd-party GitHub Actions in CI/CD pipelines can result in:
    a. Accelerated build times
    b. Injection of malicious code
    c. Enhanced security by default
    d. Additional linting steps
    Answer: b. Injection of malicious codeharness+1
  22. What is the primary risk of accepting pull requests from unknown contributors?
    a. Code redundancy
    b. Introduction of malicious or vulnerable code
    c. Fast project growth
    d. Excessive documentation
    Answer: b. Introduction of malicious or vulnerable codecheckmarx+2
  23. Repository mirroring is useful for:
    a. Visual enhancements
    b. Redundancy and backup purposes
    c. Decreasing collaboration
    d. Slowing down pushes
    Answer: b. Redundancy and backup purposeswayground+1
  24. What is a CODEOWNERS file used for in GitHub repositories?
    a. Assigning documentation tasks
    b. Specifying who must review certain files or directories
    c. Managing budgets
    d. Color-coding issues
    Answer: b. Specifying who must review certain files or directoriesharness+1
  25. Which scanning technique helps detect potential vulnerabilities in repositories before code is merged?
    a. Dynamic scanning
    b. Static Application Security Testing (SAST)
    c. Manual browsing
    d. Traffic sniffing
    Answer: b. Static Application Security Testing (SAST)snyk+1
  26. What is the benefit of maintaining an audit log for repository access?
    a. Faster loading times
    b. Tracking unauthorized events and activities
    c. Reducing line length
    d. Improving syntax highlighting
    Answer: b. Tracking unauthorized events and activitiesget.assembla+2
  27. Using personal forks for development before submitting pull requests primarily helps:
    a. Increase repository size
    b. Test code privately and limit initial exposure
    c. Slow project merging
    d. Invalidate access controls
    Answer: b. Test code privately and limit initial exposurecheckmarx+1
  28. What risk does overly permissive repository access pose?
    a. Enhanced file viewing
    b. Increased chance of data leaks and unauthorized actions
    c. Streamlined updates
    d. Automated performance boosts
    Answer: b. Increased chance of data leaks and unauthorized actionsncsc+2
  29. Why are software dependencies tracked via lockfiles (like package-lock.json) important for security?
    a. To make files larger
    b. To ensure consistent and secure dependency versions
    c. To block all updates
    d. To limit pull requests
    Answer: b. To ensure consistent and secure dependency versionsget.assembla+2
  30. What is the risk of using outdated dependency versions in code repositories?
    a. Better performance
    b. Potential for known vulnerabilities to exist in project
    c. Reduced code duplication
    d. Smaller repositories
    Answer: b. Potential for known vulnerabilities to exist in projectharness+1
  31. What should always be performed before merging code into the main branch?
    a. Styling review only
    b. Security reviews and automated tests
    c. Increasing repository limits
    d. Archiving old pull requests
    Answer: b. Security reviews and automated testscheckmarx+1
  32. Which configuration is recommended for repository backup security?
    a. No encryption
    b. Encrypted, offsite backups
    c. Unsecured cloud folders
    d. Manual copies
    Answer: b. Encrypted, offsite backupsncsc+2
  33. What precaution can help ensure only authorized users can push to a repository?
    a. Disabling network ingress
    b. Enforcing signed commits and strong authentication
    c. Using open credentials
    d. Posting URLs publicly
    Answer: b. Enforcing signed commits and strong authenticationget.assembla+2
  34. The “CODEOWNERS” file in GitHub is correctly placed in which directory for global rules?
    a. docs/
    b. .github/
    c. src/
    d. test/
    Answer: b. .github/harness+1
  35. A “security.txt” file in repositories is used to:
    a. Store change logs
    b. Define security contact information and guidelines
    c. Add colors
    d. Document API endpoints
    Answer: b. Define security contact information and guidelinesget.assembla+1
  36. Which statement about open source repositories and cybersecurity is true?
    a. Open repositories are always secure
    b. Open source code is subject to both increased scrutiny and increased attack surface
    c. Contributors must be anonymous
    d. Repositories never need monitoring
    Answer: b. Open source code is subject to both increased scrutiny and increased attack surfacecheckmarx+2
  37. What risk do “shadow IT” repositories pose?
    a. Expanding official documentation
    b. Bypassing approved security controls
    c. Speeding up project deadlines
    d. Improving code readability
    Answer: b. Bypassing approved security controlsncsc+2
  38. How can repository admins minimize phishing attacks on contributors?
    a. Enforce email address privacy and educate users
    b. Share credentials openly
    c. Enable public commit signatures
    d. Remove user activity logs
    Answer: a. Enforce email address privacy and educate userscheckmarx+1
  39. What is a good method to detect unauthorized changes in a repository?
    a. Rely only on user trust
    b. Use audit logs and code comparisons
    c. Limit all access
    d. Merge without review
    Answer: b. Use audit logs and code comparisonsncsc+2
  40. A repository’s “contributing.md” file is important for:
    a. Automating security scans
    b. Defining safe contributing processes
    c. Storing logs
    d. Encrypting code
    Answer: b. Defining safe contributing processesharness+1
  41. What is the role of branch naming conventions in repository security?
    a. Reduce risk of confusion and accidental merges
    b. Enable rainbow colors
    c. Increase code duplication
    d. Disable notifications
    Answer: a. Reduce risk of confusion and accidental mergesget.assembla+1
  42. Why must repository URLs never include embedded credentials?
    a. Increases backup efficiency
    b. Prevents accidental exposure if URLs are shared
    c. Simplifies code review
    d. Promotes forks
    Answer: b. Prevents accidental exposure if URLs are sharedsnyk+1
  43. What is the main function of repository “pull request templates”?
    a. Reduce security by adding friction
    b. Standardize checks for security and quality requirements
    c. Delete old branches
    d. Allow anonymous merges
    Answer: b. Standardize checks for security and quality requirementsharness+1
  44. The “default branch” in a repository is usually:
    a. Used for release tagging
    b. The main integration branch
    c. Only for archived code
    d. For binary storage
    Answer: b. The main integration branchexamradar+2
  45. What is the first step after discovering a data breach in a code repository?
    a. Ignore it
    b. Contain the breach and investigate
    c. Announce to all social media
    d. Revert all commits unconditionally
    Answer: b. Contain the breach and investigatencsc+2
  46. What advantage do private repositories have over public ones?
    a. Limited code visibility reduces risk of unauthorized access
    b. Promotes open collaboration
    c. More external pull requests
    d. Fewer required backups
    Answer: a. Limited code visibility reduces risk of unauthorized accesscheckmarx+1
  47. Regular repository security audits are conducted to:
    a. Optimize processor resources
    b. Find and remediate potential threats
    c. Reduce branch count
    d. Randomize permissions
    Answer: b. Find and remediate potential threatsget.assembla+2
  48. Why is reviewing third party code before merging essential?
    a. Reduce bug reports
    b. Prevent introduction of unvetted or malicious changes
    c. Increase repository forks
    d. Decrease code size
    Answer: b. Prevent introduction of unvetted or malicious changesharness+2
  49. Security patches in code repositories should be:
    a. Delayed for major releases
    b. Applied as soon as feasible
    c. Ignored during refactoring
    d. Hidden in old branches
    Answer: b. Applied as soon as feasiblecheckmarx+2
  50. Which is a best practice when offboarding a contributor from a repository?
    a. Send a thank-you note only
    b. Revoke access and update permissions immediately
    c. Allow continued read access
    d. Assign new open issues
    Answer: b. Revoke access and update permissions immediatelyncsc+2

 

  1. https://snyk.io/articles/securing-source-code-repositories/
  2. https://checkmarx.com/supply-chain-security/repository-health-monitoring-part-2-essential-practices-for-secure-repositories/
  3. https://get.assembla.com/blog/source-code-security/
  4. https://www.ncsc.gov.uk/collection/developers-collection/principles/protect-your-code-repository
  5. https://www.harness.io/blog/code-repository-best-practices
  6. https://wayground.com/admin/quiz/64816bec7a7bba7aca384889/version-control-tools-such-as-git-svn-etc-in-information-technology-it-industry
  7. https://examradar.com/version-control-with-git-mcqs/
  8. https://razorops.com/blog/top-50-version-control-systems-interview-question-and-answers/

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!