Full-Stack Development Quality Control & Assurance 3 — Questions and Answers
Question 1: What does TDD stand for, and what is its core practice?
- Test-Driven Deployment; deploy only after tests pass
- Test-Driven Development; write tests before writing production code (Correct answer)
- Technical Debt Detection; identify code smells first
- Test Data Design; design test datasets before coding
Correct answer: Test-Driven Development; write tests before writing production code
TDD (Test-Driven Development) follows a Red-Green-Refactor cycle: write a failing test, make it pass, then clean up the code.
Question 2: In Jest, what does the `beforeEach` hook do?
- Runs once before all tests in the file
- Runs before every individual test in the describe block (Correct answer)
- Clears all mocks before each test suite
- Defines the test environment setup globally
Correct answer: Runs before every individual test in the describe block
`beforeEach` executes the provided callback function before every single `it`/`test` block within its scope.
Question 3: Which practice involves developers reviewing each other's code before merging to catch defects early?
- Pair programming
- Code review / Pull request review (Correct answer)
- Static analysis
- Rubber duck debugging
Correct answer: Code review / Pull request review
Code reviews (pull request reviews) are a QA practice where peers inspect changes for bugs, style issues, and design problems before merge.
Question 4: What is 'mutation testing' used to evaluate?
- Performance under load spikes
- The effectiveness and quality of a test suite (Correct answer)
- Cross-browser compatibility
- Database schema migrations
Correct answer: The effectiveness and quality of a test suite
Mutation testing deliberately introduces small code changes (mutations) and checks whether existing tests detect (kill) those mutations.
Question 5: A Cypress test clicks a button and the assertion fails intermittently. What is this called?
- A false negative
- A flaky test (Correct answer)
- A regression
- A smoke failure
Correct answer: A flaky test
A flaky test is one that produces inconsistent results (pass/fail) without code changes, often due to timing issues or external dependencies.
Question 6: Which tool is commonly used for static code analysis in JavaScript/TypeScript projects?
- Webpack
- ESLint (Correct answer)
- Babel
- Vite
Correct answer: ESLint
ESLint is a static analysis linter that identifies problematic patterns, style violations, and potential bugs in JS/TS code without running it.
Question 7: What is the main goal of 'shift-left' testing in software development?
- Moving QA engineers to a left-side office layout
- Testing earlier in the development lifecycle to find defects sooner (Correct answer)
- Removing manual testing phases entirely
- Shifting test ownership to operations teams
Correct answer: Testing earlier in the development lifecycle to find defects sooner
Shift-left testing moves quality activities earlier in the SDLC so defects are caught when they are cheapest to fix.
What does TDD stand for, and what is its core practice?