Docsity

First Contribution Practice Exam, Exams of Technology

Toggle sidebar
bg1
First Contribution Practice Exam
**Question 1.** Which file typically contains the high‑level description of a project's purpose,
installation steps, and basic usage?
A) CONTRIBUTING.md
B) CODE_OF_CONDUCT.md
C) README.md
D) CHANGELOG.md
Answer: C
Explanation: The README.md is the primary document that outlines the project's mission, how
to install it, and how to get started.
**Question 2.** In a typical open‑source project, where would you find the rules for naming
branches and formatting commit messages?
A) LICENSE file
B) CONTRIBUTING.md
C) .gitignore
D) package.json
Answer: B
Explanation: CONTRIBUTING.md usually details contribution guidelines, including branch
naming conventions and commit message standards.
**Question 3.** When cloning a repository, which Git command creates a local copy of the
remote repository?
A) git fork
B) git pull
C) git clone
D) git init
Answer: C
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
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57

Partial preview of the text

Download First Contribution Practice Exam and more Exams Technology in PDF only on Docsity!

Question 1. Which file typically contains the high‑level description of a project's purpose, installation steps, and basic usage? A) CONTRIBUTING.md B) CODE_OF_CONDUCT.md C) README.md D) CHANGELOG.md Answer: C Explanation: The README.md is the primary document that outlines the project's mission, how to install it, and how to get started. Question 2. In a typical open‑source project, where would you find the rules for naming branches and formatting commit messages? A) LICENSE file B) CONTRIBUTING.md C) .gitignore D) package.json Answer: B Explanation: CONTRIBUTING.md usually details contribution guidelines, including branch naming conventions and commit message standards. Question 3. When cloning a repository, which Git command creates a local copy of the remote repository? A) git fork B) git pull C) git clone D) git init Answer: C

Explanation: git clone <url> copies the remote repository to your local machine, including its history. Question 4. After cloning, which command installs project dependencies listed in a Node.js project's package.json? A) npm install B) git install C) pip install D) composer install Answer: A Explanation: npm install reads package.json and installs all Node.js dependencies. Question 5. Which of the following is NOT a typical error when setting up a development environment? A) Missing runtime version B) Path variable misconfiguration C) Incorrect branch name in Git D) Unsatisfied peer dependency Answer: C Explanation: An incorrect branch name is a Git workflow issue, not a setup error; the others directly affect environment configuration. Question 6. In Git terminology, which area holds files that have been modified but not yet staged for commit? A) Staging Area B) Working Directory C) Local Repository

C) git merge feature/login main D) git pull feature/login main Answer: B Explanation: git checkout - b <new‑branch> <base> creates and checks out the new branch. Question 10. Which commit message format is recommended for many open‑source projects? A) All caps, no punctuation B) Short imperative summary, blank line, detailed description C) Long paragraph without line breaks D) Emoji‑only message Answer: B Explanation: The conventional format uses an imperative subject line (≤50 characters), a blank line, and a longer body explaining the change. Question 11. After committing locally, which command uploads your branch to the remote repository named origin? A) git push origin HEAD B) git push origin <branch‑name> C) git upload origin <branch‑name> D) git send origin <branch‑name> Answer: B Explanation: git push origin <branch‑name> sends the specified branch to the remote called origin. Question 12. If a merge conflict occurs, which marker indicates the start of the incoming change?

A) <<<<<<< HEAD

B) =======

C) >>>>>>> feature/login D) <<<<<<< feature/login Answer: A Explanation: <<<<<<< HEAD marks the beginning of the current branch's version; ======= separates the two versions, and >>>>>>> marks the incoming change. Question 13. Which Git command reverts a single commit without altering later history? A) git reset --hard B) git revert C) git checkout D) git rebase - i Answer: B Explanation: git revert creates a new commit that undoes the changes introduced by the specified commit. Question 14. In issue trackers, which label most often indicates a task suitable for a newcomer? A) bug B) enhancement C) good first issue D) high priority Answer: C Explanation: Projects tag easy, introductory tasks with “good first issue” to help new contributors.

Question 18. Which coding convention is most likely to be enforced by a Python project’s style guide? A) CamelCase for variable names B) snake_case for functions and variables C) ALL_CAPS for classes D) kebab-case for modules Answer: B Explanation: PEP 8 recommends snake_case for functions and variable names in Python. Question 19. In a JavaScript project using ESLint, which command typically runs the linter and automatically fixes fixable issues? A) npm test B) npm run lint -- --fix C) npm start D) npm build Answer: B Explanation: The --fix flag tells ESLint to apply automatic fixes where possible. Question 20. What is the primary purpose of unit tests? A) Verify that the entire application works end‑to‑end B) Test individual functions or methods in isolation C) Measure code coverage percentages only D) Replace manual testing entirely Answer: B Explanation: Unit tests focus on small, isolated pieces of code to ensure they behave correctly.

Question 21. Which of the following commands runs the existing test suite in a typical Node.js project? A) npm run lint B) npm test C) npm start D) npm build Answer: B Explanation: npm test executes the script defined for testing in package.json. Question 22. When adding a new feature, why might you create an additional test case? A) To increase the repository size B) To verify that the new functionality works and does not break existing code C) To satisfy the CI pipeline’s test count requirement only D) To replace documentation Answer: B Explanation: New tests confirm that the added feature behaves as expected and helps prevent regressions. Question 23. Which file should never be committed to a repository because it contains user‑specific settings? A) .gitignore B) .env.example C) .vscode/settings.json D) package.json Answer: C Explanation: IDE configuration files like .vscode/settings.json are often user‑specific and should be ignored.

Explanation: Updating the same branch keeps the discussion context and signals that the PR is ready for another look. Question 27. What does “squash and merge” do to the commit history of a PR? A) Keeps every individual commit as separate entries B) Creates a single new commit that combines all changes C) Rewrites the remote repository’s history arbitrarily D) Deletes the PR’s commits entirely Answer: B Explanation: Squash‑and‑merge condenses all commits in the PR into one, producing a cleaner history. Question 28. After a PR is merged, what is the typical next step regarding the original issue? A) Reopen the issue to keep it open B) Close the issue, referencing the merged PR C) Delete the issue permanently D) Convert the issue to a pull request Answer: B Explanation: Closing the issue signals that the work is complete, often with a link to the merged PR for traceability. Question 29. Which command lists all remote branches available in the origin remote? A) git branch - a B) git remote show origin C) git branch - r D) git ls-remote --heads origin

Answer: C Explanation: git branch - r shows remote‑tracking branches. Question 30. If you realize you committed a file to the wrong branch, which sequence correctly moves it to the intended branch? A) git checkout wrong‑branch; git reset HEAD~1; git checkout correct‑branch; git cherry-pick B) git merge wrong‑branch into correct‑branch C) git rebase wrong‑branch onto correct‑branch D) git push wrong‑branch to origin Answer: A Explanation: Reset removes the commit from the wrong branch, then cherry‑pick applies it to the correct branch. Question 31. Which of the following is a common convention for naming feature branches? A) feature/<short‑description> B) bugfix‑ C) hotfix‑ D) dev‑ Answer: A Explanation: feature/ prefixes clearly indicate the purpose of the branch. Question 32. In a monorepo with separate frontend and backend directories, where would you most likely find the API documentation? A) /frontend/README.md B) /backend/docs/api.md C) /docs/architecture.png

C) git fetch upstream; git rebase upstream/main D) git cherry-pick upstream/main Answer: C Explanation: Fetch retrieves the latest upstream commits; rebase reapplies your local commits on top of them. Question 36. Which of the following best describes a “continuous integration” (CI) system? A) A tool that automatically merges PRs without review B) A service that runs automated builds and tests on each push/PR C) A documentation generator for APIs D) A version control system alternative to Git Answer: B Explanation: CI runs builds and test suites automatically to catch errors early. Question 37. If a CI pipeline fails because of linting errors, what is the most appropriate action? A) Ignore the failure and merge anyway B) Fix the linting issues locally, commit, and push the changes C) Delete the CI configuration file D) Ask the maintainer to disable linting Answer: B Explanation: Linting errors must be resolved to pass CI; fixing them locally ensures compliance. Question 38. Which command shows the differences between the staged version of a file and the last commit? A) git diff --staged B) git diff

C) git log D) git status Answer: A Explanation: git diff --staged (or --cached) displays changes that have been added to the index. Question 39. In a project that uses a dev branch for ongoing development, from which branch should a new feature branch normally be created? A) main B) dev C) feature D) release Answer: B Explanation: When dev is the integration branch, new work starts from dev to keep it up‑to‑date with ongoing changes. Question 40. Which of the following is a recommended practice when writing a PR description? A) Include a long, unrelated story B) Summarize the problem, solution, and testing steps C) Only paste the issue number D) Write in all caps for emphasis Answer: B Explanation: A concise summary of the issue, the implemented changes, and how it was tested helps reviewers understand the contribution quickly. Question 41. When a maintainer requests “rebase onto the latest main,” what should you do?

A) Run the full test suite locally before pushing B) Assume they work because they compile C) Only test the new feature manually D) Skip testing to save time Answer: A Explanation: Running the complete test suite ensures that no regressions are introduced. Question 45. In a repository that uses Prettier for code formatting, which command would you run to format all source files? A) prettier --write. B) npm run lint C) git format‑code D) prettier --check. Answer: A Explanation: prettier --write . rewrites files according to Prettier’s style rules. Question 46. Which Git command can be used to create a temporary “undo” point before attempting a risky operation? A) git stash B) git tag temp C) git branch backup D) git commit --amend Answer: A Explanation: git stash saves the current working state, allowing you to restore it later. Question 47. When reviewing a PR, you notice a function that violates the project’s naming convention. What should you do?

A) Immediately close the PR B) Add a comment suggesting the rename and wait for the author to fix it C) Delete the function yourself without discussion D) Merge the PR anyway Answer: B Explanation: Providing constructive feedback gives the contributor a chance to correct the issue. Question 48. Which of the following is an advantage of writing small, well‑scoped first‑time contributions? A) They take longer to review B) They reduce the risk of introducing bugs C) They require extensive documentation D) They make the repository larger quickly Answer: B Explanation: Small, focused changes are easier to understand, test, and review, lowering the chance of errors. Question 49. In a typical CI configuration file (e.g., .github/workflows/ci.yml), which section defines the steps to execute? A) jobs B) triggers C) environment D) secrets Answer: A Explanation: The jobs key lists the individual tasks (install, test, lint, etc.) that CI runs.

Question 53. When a maintainer asks you to “add unit tests for edge cases,” what does “edge case” refer to? A) The most common usage scenario B) Unusual or extreme input values that might cause failures C) The UI design of the application D) The deployment script Answer: B Explanation: Edge cases test how code behaves under atypical or boundary conditions. Question 54. Which of the following Git commands would you use to permanently delete a branch on the remote named origin? A) git branch - D feature/login B) git push origin :feature/login C) git delete origin/feature/login D) git remove origin feature/login Answer: B Explanation: Pushing an empty ref (:) to the remote deletes the specified branch. Question 55. In a repository that uses semantic versioning, which version bump corresponds to a backward‑compatible bug fix? A) Increment the major version (X.0.0 → X+1.0.0) B) Increment the minor version (X.Y.0 → X.Y+1.0) C) Increment the patch version (X.Y.Z → X.Y.Z+1) D) Add a pre‑release tag Answer: C Explanation: Patch version increments (Z) denote backward‑compatible bug fixes.

Question 56. Which command lists all files that are currently staged for commit? A) git status --short B) git diff --staged --name-only C) git ls-files --others D) git show-index Answer: B Explanation: git diff --staged --name-only prints the paths of staged changes. Question 57. When a PR includes changes to both code and documentation, what is a recommended way to structure the commit history? A) One large commit containing everything B) Separate commits: one for code, one for docs, each with clear messages C) Commit only the code and ignore docs D) Use a merge commit without separate messages Answer: B Explanation: Separate commits keep the history clear, making it easier to review each type of change. Question 58. Which of the following is NOT a typical component of a contribution guideline? A) Branch naming strategy B) Preferred IDE color scheme C) Commit message format D) Pull request template location Answer: B Explanation: IDE color schemes are personal preferences and rarely part of contribution rules.