Software Testing MCQs multiple-choice questions with answers & explanations
All 11 Software Testing quiz questions on one page. Pick an answer in your head, then open Show answer to check it and read why. Want a score and a timer? Take them as a quiz instead.
Official reference: Node.js test runner
- 1.easy
For an inclusive allowed range of 1 to 100, which set best targets boundaries?
- A25, 50, 75
- B1 only
- C0, 1, 100, 101
- D50 repeated four times
Show answer
Answer: C (0, 1, 100, 101)
Values at and just outside each limit exercise boundary acceptance and rejection. Mid-range tests alone miss off-by-one errors.
- 2.easy
What is a regression test intended to detect?
- AA previously working behavior breaking
- BEvery possible security flaw
- COnly syntax mistakes
- DWhether a feature is profitable
Show answer
Answer: A (A previously working behavior breaking)
Regression tests protect existing behavior as code changes. They cannot establish that every possible defect is absent.
- 3.easy
What does 100% line coverage prove?
- AAll inputs were tested
- BEvery executed assertion is correct
- CEvery measured line was executed
- DNo bugs remain
Show answer
Answer: C (Every measured line was executed)
Line coverage measures execution, not the strength of assertions or completeness of edge cases.
- 4.easy
What is a unit test generally intended to exercise?
- AThe entire production infrastructure
- BA focused behavior of a small unit of code
- COnly the visual page layout
- DA manual deployment checklist
Show answer
Answer: B (A focused behavior of a small unit of code)
Unit tests isolate a focused behavior for fast feedback. The precise unit boundary depends on design; smaller is not automatically better if tests become coupled to implementation details.
- 5.easy
Which test is most clearly an integration test?
- ATesting a pure addition function
- BChecking a variable name
- CChecking that a repository writes and reads records in a test database
- DReviewing a screenshot manually
Show answer
Answer: C (Checking that a repository writes and reads records in a test database)
An integration test exercises collaboration across a boundary, such as application code and a database. It can reveal mapping, query and transaction problems that isolated tests miss.
- 6.mid
What is a test oracle?
- AA mechanism for deciding whether observed behavior is correct
- BA random test input
- CA production server
- DA mandatory testing vendor
Show answer
Answer: A (A mechanism for deciding whether observed behavior is correct)
An oracle supplies the expected outcome or property. Examples include a specification, invariant or trusted reference implementation.
- 7.easy
What is equivalence partitioning?
- ARepeating the same case many times
- BTesting only successful inputs
- CComparing two programming languages
- DGrouping inputs expected to behave similarly and testing representatives
Show answer
Answer: D (Grouping inputs expected to behave similarly and testing representatives)
Equivalence classes reduce redundant examples while covering distinct behaviors. Boundary tests remain useful because errors often occur at class edges.
- 8.mid
Which is a property-based test for a correct sorting function?
- AThe output is always empty
- BFor generated inputs, output is ordered and preserves the input multiset
- CThe implementation calls a specific helper
- DOnly one fixed array is checked
Show answer
Answer: B (For generated inputs, output is ordered and preserves the input multiset)
Property-based tests check invariants over generated inputs. Checking both order and element multiplicities catches more defects than checking order alone.
- 9.mid
What does mutation testing help evaluate?
- AWhether tests detect deliberately introduced code changes
- BWhether production data can be edited
- COnly how many lines ran
- DWhether builds use the newest compiler
Show answer
Answer: A (Whether tests detect deliberately introduced code changes)
Mutation testing introduces small changes and checks whether tests fail. Surviving mutants can reveal weak assertions, though some mutations are behaviorally equivalent.
- 10.easy
Which is a negative test for a login form?
- ALogging in with valid credentials
- BOpening the home page
- CSubmitting an invalid password and checking rejection
- DChanging the site theme
Show answer
Answer: C (Submitting an invalid password and checking rejection)
Negative tests verify behavior for invalid inputs or disallowed actions. They should check appropriate rejection without unintended side effects.
- 11.mid
Which practice best reduces order-dependent tests?
- ASharing mutable records across all tests
- BRequiring one test to run first
- CAdding a long sleep to every test
- DCreating and cleaning up each test’s own state
Show answer
Answer: D (Creating and cleaning up each test’s own state)
Independent fixtures prevent earlier tests from changing later outcomes. Arbitrary delays do not resolve shared-state dependencies.
No questions match these filters. Try a different subtopic or clear the filters.