Software Engineer Quiz
Questions: 16 · 10 minutes
1. A service must run on several interchangeable instances behind a load balancer. Which design most directly supports horizontal scaling?
Keep service instances stateless where practical and place shared state in an appropriate external store
Store uploaded files only on one instance's local disk
Require every request to return to a manually selected server
Keep each user's session only in the memory of the first instance they contact
2. Which design best demonstrates high cohesion?
A utility class handles authentication, invoices, email, and database backups
A module groups closely related invoice-calculation responsibilities
Every function can directly modify every part of the application state
One module changes whenever any feature in the system changes
3. A pull request contains thousands of lines that mix a refactor, a feature, and formatting changes. What would most improve reviewability?
Add more reviewers while keeping all changes in one request
Remove tests so reviewers can focus on production code
Separate it into smaller, focused changes with clear purposes
Merge it first and review the changes afterward
4. A Git merge produces conflicts in a file that two developers edited. What is the most appropriate next step?
Inspect the conflicting sections, choose or combine the intended changes, test the result, and commit the resolution
Delete the file and restore whichever branch was created first
Force-push the local branch so Git selects its version automatically
Rebase repeatedly until the conflict markers disappear without editing
5. A client may repeat the same request after a timeout. Which HTTP operation is intended to replace a resource at a known URI and be idempotent?
CONNECT
POST
PUT
PATCH in every possible implementation
6. A request fails in production after passing through several services. Which observability setup would most help trace the request's path?
A separate unstructured text file on each developer's computer
Only the total number of requests received each day
A dashboard showing the current number of source-code files
Correlated logs or distributed traces carrying the same request identifier across services
7. How should an application generally store user passwords?
As unique salted hashes using a password-specific algorithm such as Argon2 or bcrypt
Encrypted with one reversible key shared across all accounts
As plaintext in a database with restricted table permissions
As unsalted hashes using a fast general-purpose algorithm
8. A test fails unpredictably in continuous integration but usually passes locally. What is the best first engineering response?
Automatically rerun it until it passes and permanently ignore the original failure
Investigate sources of nondeterminism such as timing, shared state, ordering, and uncontrolled dependencies
Mark every failure as an infrastructure problem without investigation
Delete the assertion that fails most often
9. Which characteristic is most important for a reliable unit test?
It checks a small unit of behavior while controlling external dependencies
It exercises the complete deployed system, including live external services
It depends on tests running in a particular order
It verifies several unrelated behaviors in one long scenario
10. Two threads increment the same shared counter, but some increments are lost. What is the most likely cause?
A memory leak caused by the counter having too small a numeric type
A syntax error that the compiler ignored
A race condition because the read-modify-write operation is not synchronized or atomic
A deadlock caused solely by both threads completing
11. A web application builds a SQL query by concatenating text supplied by a user. Which change most directly reduces SQL injection risk?
Hide database error messages from the user interface
Run the query through a faster database connection pool
Escape quotation marks with custom string-replacement code
Use parameterized queries and bind user input as values
12. A business-logic class directly creates a specific database client, making isolated tests difficult. Which redesign best applies dependency inversion?
Make the database client a global variable shared by all classes
Expose the database password so tests can connect directly
Copy the database-access code into each business method
Have the class depend on an abstraction that can be supplied with different implementations
13. A requirement says a dashboard should load “quickly,” but gives no measurable target. What should the team do before treating the requirement as testable?
Assume “quickly” means the fastest response achieved during development
Agree on measurable acceptance criteria, including conditions and a response-time target
Replace the requirement with a preferred programming language
Wait until users complain, then define the expected performance
14. What is the typical time complexity of binary search on a sorted array?
O(n)
O(1)
O(log n)
O(n log n)
15. After adding a cache, users sometimes see old profile information immediately after an update. Which response most directly addresses the consistency problem?
Increase the cache capacity so more old values can be retained
Compress cached values before returning them
Remove database indexes from the profile table
Define an invalidation or refresh policy when profile data changes
16. A client calls an external API that occasionally fails because of brief network interruptions. Which retry strategy is generally most appropriate?
Retry continuously with no delay until the call succeeds
Use a limited number of retries with exponential backoff and jitter for retryable failures
Retry every request immediately, including requests that are not safe to repeat
Disable timeouts so every request can wait indefinitely