Mục lục bài học
- 01 — Requirements, rules và request flow
- 02 — Nghe và phân loại câu hỏi phỏng vấn
- A — Entities → Rules → APIs
- 03 — Registration LLD
- 04 — SQL, indexes, ACID và locking / tiểu mục 04.1
- 04 — SQL, indexes, ACID và locking / tiểu mục 04.2
- 04 — SQL, indexes, ACID và locking / tiểu mục 04.3
- 04 — SQL, indexes, ACID và locking / tiểu mục 04.5
- 04 — SQL, indexes, ACID và locking / tiểu mục 04.6
- 05 — HTTP request, timeout và retry
- Q047 · MECHANISM / WHY · BASE V4
- Q048 · MECHANISM / WHY · BASE V4
- Q049 · FOUNDATION · BASE V4
- Q050 · MECHANISM / WHY · ADD V5
- Q051 · MECHANISM / WHY · ADD V5
- Q052 · FOUNDATION · ADD V5
- Q053 · FOUNDATION · ADD V5
- Q054 · MECHANISM / WHY · ADD V5
- Q055 · MECHANISM / WHY · ADD V5
- Q056 · SCENARIO / FOLLOW-UP · BASE V4
- Q057 · SCENARIO / FOLLOW-UP · BASE V4
- 06 — Threads, shared state và race conditions
- Q058 · MECHANISM / WHY · BASE V4
- Q059 · MECHANISM / WHY · BASE V4
- Q060 · MECHANISM / WHY · BASE V4
- Q061 · FOUNDATION · BASE V4
- Q062 · FOUNDATION · ADD V5
- Q063 · FOUNDATION · ADD V5
- Q064 · MECHANISM / WHY · ADD V5
- Q065 · MECHANISM / WHY · ADD V5
- Q066 · MECHANISM / WHY · ADD V5
- Q067 · FOUNDATION · ADD V5
- Q068 · SCENARIO / FOLLOW-UP · BASE V4
- 07 — Hotel Booking LLD + state machine
- 08 — Testing, Cloud, Security và DSA recap
- Q077 · MECHANISM / WHY · BASE V4
- Q078 · FOUNDATION · BASE V4
- Q079 · MECHANISM / WHY · BASE V4
- Q080 · FOUNDATION · ADD V5
- Q081 · MECHANISM / WHY · ADD V5
- Q082 · MECHANISM / WHY · ADD V5
- Q083 · MECHANISM / WHY · ADD V5
- Q084 · FOUNDATION · ADD V5
- Q085 · MECHANISM / WHY · ADD V5
- Q086 · MECHANISM / WHY · ADD V5
- Q087 · MECHANISM / WHY · ADD V5
- Q088 · FOUNDATION · ADD V5
- Q089 · SCENARIO / FOLLOW-UP · BASE V4
- Q090 · SCENARIO / FOLLOW-UP · BASE V4
- Q091 · SCENARIO / FOLLOW-UP · ADD V5
- 08A — Java Core + OOP / tiểu mục 08A.1
- 08A — Java Core + OOP / tiểu mục 08A.2
- 08A — Java Core + OOP / tiểu mục 08A.3
- 08A — Java Core + OOP / tiểu mục 08A.4
- Q111 · FOUNDATION · ADD V5
- Q112 · MECHANISM / WHY · ADD V5
- Q113 · MECHANISM / WHY · ADD V5
- Q114 · MECHANISM / WHY · ADD V5
- Q115 · MECHANISM / WHY · ADD V5
- Q116 · FOUNDATION · ADD V5
- Q117 · MECHANISM / WHY · ADD V5
- Q118 · MECHANISM / WHY · ADD V5
- Q119 · SCENARIO / FOLLOW-UP · ADD V5
- Q120 · SCENARIO / FOLLOW-UP · ADD V5
- 08A — Java Core + OOP / tiểu mục 08A.5
- 08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.1
- 08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.2
- 08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.3
- Q136 · MECHANISM / WHY · BASE V4
- Q137 · MECHANISM / WHY · BASE V4
- Q138 · MECHANISM / WHY · ADD V5
- Q139 · MECHANISM / WHY · ADD V5
- Q140 · MECHANISM / WHY · ADD V5
- Q141 · MECHANISM / WHY · ADD V5
- Q142 · FOUNDATION · ADD V5
- Q143 · MECHANISM / WHY · ADD V5
- Q144 · MECHANISM / WHY · ADD V5
- Q145 · SCENARIO / FOLLOW-UP · ADD V5
- 08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.4
- 08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.5
- 08C — Java + SQL + English integrated case
- CASE LAB — V-Market
- Q159 · P0 · PROJECT-SPECIFIC V5.1
- Q160 · P0 · PROJECT-SPECIFIC V5.1
- Q161 · P0 · PROJECT-SPECIFIC V5.1
- Q162 · P0 · PROJECT-SPECIFIC V5.1
- Q163 · P0 · PROJECT-SPECIFIC V5.1
- Q164 · P0 · PROJECT-SPECIFIC V5.1
- Q165 · P0 · PROJECT-SPECIFIC V5.1
- Q166 · P0 · PROJECT-SPECIFIC V5.1
- Q167 · P0 · PROJECT-SPECIFIC V5.1
- Q168 · P1 · PROJECT-SPECIFIC V5.1
- Q169 · P1 · PROJECT-SPECIFIC V5.1
- CASE LAB — V-Core
- Q170 · P0 · PROJECT-SPECIFIC V5.1
- Q171 · P0 · PROJECT-SPECIFIC V5.1
- Q172 · P0 · PROJECT-SPECIFIC V5.1
- Q173 · P0 · PROJECT-SPECIFIC V5.1
- Q174 · P0 · PROJECT-SPECIFIC V5.1
- Q175 · P0 · PROJECT-SPECIFIC V5.1
- Q176 · P0 · PROJECT-SPECIFIC V5.1
- Q177 · P0 · PROJECT-SPECIFIC V5.1
- Q178 · P1 · PROJECT-SPECIFIC V5.1
- Q179 · P1 · PROJECT-SPECIFIC V5.1
- Q180 · P1 · PROJECT-SPECIFIC V5.1
- 09 — Basic System Design
- B — Debugging và external integration
- CASE LAB — V-Pulse
- Q196 · P0 · PROJECT-SPECIFIC V5.1
- Q197 · P0 · PROJECT-SPECIFIC V5.1
- Q198 · P0 · PROJECT-SPECIFIC V5.1
- Q199 · P0 · PROJECT-SPECIFIC V5.1
- Q200 · P0 · PROJECT-SPECIFIC V5.1
- Q201 · P0 · PROJECT-SPECIFIC V5.1
- Q202 · P0 · PROJECT-SPECIFIC V5.1
- Q203 · P0 · PROJECT-SPECIFIC V5.1
- Q204 · P0 · PROJECT-SPECIFIC V5.1
- Q205 · P1 · PROJECT-SPECIFIC V5.1
- Q206 · P1 · PROJECT-SPECIFIC V5.1
- 10 — FDE discovery và problem decomposition
- C — FDE cold cases + changing requirements
- 11 — Technical English, project story, DSA explanation
- Q223 · PROJECT TEMPLATE · BASE V4
- Q224 · MECHANISM / WHY · BASE V4
- Q225 · MECHANISM / WHY · BASE V4
- Q226 · PROJECT TEMPLATE · BASE V4
- Q227 · PROJECT TEMPLATE · ADD V5
- Q228 · PROJECT TEMPLATE · ADD V5
- Q229 · PROJECT TEMPLATE · ADD V5
- Q230 · PROJECT TEMPLATE · ADD V5
- Q231 · PROJECT TEMPLATE · ADD V5
- Q232 · PROJECT TEMPLATE · ADD V5
- Q233 · PROJECT TEMPLATE · ADD V5
- Q234 · PROJECT TEMPLATE · ADD V5
- Q235 · SCENARIO / FOLLOW-UP · BASE V4
- Q236 · SCENARIO / FOLLOW-UP · ADD V5
- CASE LAB — Cross-project
- D — Listening blind + unfamiliar Java + on-the-job learning
- 12 — Integrated design cases
- 13 — Mock interview + oral delivery
V5.2 — 261 Question–Answer theo đúng thứ tự học xen kẽ
Cùng 261 Q&A từ V5.1, không thêm/bớt/sửa nội dung chuyên môn. Sắp xếp lại theo vị trí nằm trong giáo trình V5.2. Câu trả lời chỉ dùng sau khi tự nói.
QUY TẮC ĐÁNH SỐ TTS (áp dụng đồng nhất trong hai file): Có 261 cặp Q&A = 522 mục đọc. Mỗi câu hỏi tính là một mục TTS, và toàn bộ câu trả lời tính là một mục TTS, dù câu trả lời có nhiều câu tiếng Anh. Số TTS chạy liên tục từ 001 đến 522 theo đúng thứ tự học. Số lẻ là câu hỏi; số chẵn kế tiếp là đáp án. Ví dụ: TTS 007 (Q) What is a business invariant? và TTS 008 (A) An invariant is a rule that must remain true after every valid operation. For example, one room must not be allocated to two confirmed bookings for the same night. Để tạo giọng đọc, sao chép toàn bộ nội dung sau dấu hai chấm của từng mục TTS, không đọc nhãn số hoặc Q/A. Số cặp Q001–Q261 cũng chạy liên tục và giống nhau giữa hai file.
01 — Requirements, rules và request flow
Q001 · MECHANISM / WHY · BASE V4
TTS 001 · Q: What is the difference between a requirement and a business rule?
Mở đáp án mẫu Q001 — sau khi tự trả lời
TTS 002 · A: A requirement describes what users need. A business rule describes the conditions the system must follow. For example, users can book rooms, but they cannot book an unavailable room.
Q002 · MECHANISM / WHY · BASE V4
TTS 003 · Q: Walk me through a simple booking request.
Mở đáp án mẫu Q002 — sau khi tự trả lời
TTS 004 · A: First, the API receives the booking request. Then the service checks dates and availability. Finally, the database stores the booking, and the API returns the result.
Q003 · FOUNDATION · ADD V5
TTS 005 · Q: What is a functional requirement?
Mở đáp án mẫu Q003 — sau khi tự trả lời
TTS 006 · A: A functional requirement describes what the system must do. For example, customers need to create and cancel bookings.
Q004 · FOUNDATION · ADD V5
TTS 007 · Q: What is a business invariant?
Mở đáp án mẫu Q004 — sau khi tự trả lời
TTS 008 · A: An invariant is a rule that must remain true after every valid operation. For example, one room must not be allocated to two confirmed bookings for the same night.
Q005 · SCENARIO / FOLLOW-UP · BASE V4
TTS 009 · Q: Why would you ask about staff approval before writing code?
Mở đáp án mẫu Q005 — sau khi tự trả lời
TTS 010 · A: Staff approval changes the booking workflow. I need to know whether a booking stays pending and whether it holds a room before approval. This affects states, availability, and tests.
Q006 · SCENARIO / FOLLOW-UP · BASE V4
TTS 011 · Q: What changes if customers can cancel a booking?
Mở đáp án mẫu Q006 — sau khi tự trả lời
TTS 012 · A: I would add a cancellation action and define who can cancel and when. The service should validate the booking state and update availability according to the agreed policy.
Q007 · SCENARIO / FOLLOW-UP · BASE V4
TTS 013 · Q: What would you test before releasing the feature?
Mở đáp án mẫu Q007 — sau khi tự trả lời
TTS 014 · A: I would test invalid dates, unavailable rooms, and successful bookings. I would also test concurrent requests, permissions, and the approval workflow if approval is required.
02 — Nghe và phân loại câu hỏi phỏng vấn
Q008 · MECHANISM / WHY · BASE V4
TTS 015 · Q: What kind of answer does “How does an index work?” require?
Mở đáp án mẫu Q008 — sau khi tự trả lời
TTS 016 · A: It requires a step-by-step explanation, not just a definition. I would explain how an index helps find matching rows, and then mention the extra storage and write cost.
Q009 · MECHANISM / WHY · BASE V4
TTS 017 · Q: Which action is LEAST likely to prevent duplicate bookings? Explain what LEAST changes.
Mở đáp án mẫu Q009 — sau khi tự trả lời
TTS 018 · A: Least means the smallest amount or the lowest effectiveness. So I must choose the action that is least effective at preventing duplicate bookings, not the best action.
Q010 · MECHANISM / WHY · BASE V4
TTS 019 · Q: Could you compare a requirement and an assumption?
Mở đáp án mẫu Q010 — sau khi tự trả lời
TTS 020 · A: A requirement tells us what the system needs to do. An assumption is something we believe is true but still need to confirm. I would check important assumptions with the customer.
Q011 · FOUNDATION · ADD V5
TTS 021 · Q: What does the word EXCEPT mean in a multiple-choice question?
Mở đáp án mẫu Q011 — sau khi tự trả lời
TTS 022 · A: It asks me to find the option that does not satisfy the stated condition. I would read all the options before choosing an answer.
Q012 · SCENARIO / FOLLOW-UP · BASE V4
TTS 023 · Q: What would you say if you did not hear a technical term?
Mở đáp án mẫu Q012 — sau khi tự trả lời
TTS 024 · A: I would say, Could you repeat that technical term, please? If I still do not understand, I would ask the interviewer to explain it in another way.
Q013 · SCENARIO / FOLLOW-UP · BASE V4
TTS 025 · Q: How would you clarify a question about a “best” solution with missing constraints?
Mở đáp án mẫu Q013 — sau khi tự trả lời
TTS 026 · A: I would ask what matters most, such as response time, cost, or consistency. The best solution depends on these constraints, so I would not choose one before clarifying them.
Q014 · SCENARIO / FOLLOW-UP · ADD V5
TTS 027 · Q: What would you say if you did not know the answer to a technical question?
Mở đáp án mẫu Q014 — sau khi tự trả lời
TTS 028 · A: I would explain what I know and make my uncertainty clear. Then I would describe how I would verify the missing detail. I would not claim experience I do not have.
A — Entities → Rules → APIs
Q015 · FOUNDATION · BASE V4
TTS 029 · Q: Design a small course enrollment feature. What are the entities?
Mở đáp án mẫu Q015 — sau khi tự trả lời
TTS 030 · A: I would create Student, Course, and Enrollment entities. Enrollment connects a student to a course and stores its status. The main rule is that active enrollments must not exceed the course capacity.
Q016 · FOUNDATION · BASE V4
TTS 031 · Q: Should the same student be allowed to enroll twice?
Mở đáp án mẫu Q016 — sau khi tự trả lời
TTS 032 · A: Usually, I would prevent duplicate active enrollments for the same student and course. I could enforce this with an appropriate database constraint and test two concurrent enrollment requests.
Q017 · MECHANISM / WHY · ADD V5
TTS 033 · Q: What is the difference between an entity and a service?
Mở đáp án mẫu Q017 — sau khi tự trả lời
TTS 034 · A: An entity represents important domain data and may contain domain behavior. A service coordinates a use case or business operation. For example, a BookingService creates a Booking while enforcing its rules.
Q018 · SCENARIO / FOLLOW-UP · BASE V4
TTS 035 · Q: Two students take the last seat. How do you keep the capacity rule?
Mở đáp án mẫu Q018 — sau khi tự trả lời
TTS 036 · A: I would protect the last seat inside the database using a suitable lock or atomic update. Two requests must not both reserve the same seat. I would verify this with a concurrent test.
Q019 · SCENARIO / FOLLOW-UP · BASE V4
TTS 037 · Q: How would you test unauthorized approval of a leave request?
Mở đáp án mẫu Q019 — sau khi tự trả lời
TTS 038 · A: I would log in as a normal employee and call the approval API. I would expect a forbidden response and no status change. Then I would repeat the test with an authorized team lead.
Q020 · SCENARIO / FOLLOW-UP · BASE V4
TTS 039 · Q: What if a student drops a course?
Mở đáp án mẫu Q020 — sau khi tự trả lời
TTS 040 · A: I would define a drop action and change the enrollment status. If the course uses reserved seats, dropping should release one. I would test that the available capacity is updated correctly.
Q021 · SCENARIO / FOLLOW-UP · ADD V5
TTS 041 · Q: How would you represent the lifecycle of a leave request?
Mở đáp án mẫu Q021 — sau khi tự trả lời
TTS 042 · A: I would define states such as DRAFT, SUBMITTED, APPROVED, and REJECTED. Then I would list allowed transitions and who can perform them. I would test invalid transitions and self-approval.
03 — Registration LLD
Q022 · MECHANISM / WHY · BASE V4
TTS 043 · Q: Explain the responsibilities of a registration controller and service.
Mở đáp án mẫu Q022 — sau khi tự trả lời
TTS 044 · A: The controller receives the HTTP request, validates its structure, and returns a response. The service applies registration rules, hashes the password, and coordinates saving the user and verification token.
Q023 · MECHANISM / WHY · BASE V4
TTS 045 · Q: Why should the email comparison policy be defined explicitly?
Mở đáp án mẫu Q023 — sau khi tự trả lời
TTS 046 · A: Different rules for uppercase letters or spaces can create duplicate accounts or unexpected login behavior. I would define normalization and comparison clearly, then enforce the same rule in the database.
Q024 · MECHANISM / WHY · ADD V5
TTS 047 · Q: Why should passwords be hashed instead of encrypted for storage?
Mở đáp án mẫu Q024 — sau khi tự trả lời
TTS 048 · A: For password verification, I would store a salted, slow password hash rather than a recoverable password. The server can verify a candidate password without storing plaintext. A suitable password-hashing algorithm also makes offline guessing harder.
Q025 · MECHANISM / WHY · ADD V5
TTS 049 · Q: What is the difference between validation and authorization in registration?
Mở đáp án mẫu Q025 — sau khi tự trả lời
TTS 050 · A: Validation checks that the input satisfies format and business constraints. Authorization checks whether a caller may perform an action. Public registration may not require an existing account, but later account changes require access checks.
Q026 · SCENARIO / FOLLOW-UP · BASE V4
TTS 051 · Q: How do you prevent two concurrent registrations with the same email?
Mở đáp án mẫu Q026 — sau khi tự trả lời
TTS 052 · A: I would normalize the email according to a clear policy and enforce uniqueness in the database. A pre-check improves the message, but the unique constraint handles concurrent inserts.
Q027 · SCENARIO / FOLLOW-UP · BASE V4
TTS 053 · Q: What happens if the email provider fails after the user is saved?
Mở đáp án mẫu Q027 — sau khi tự trả lời
TTS 054 · A: The user may already be saved, even if the email could not be delivered. I would record the delivery task and retry it safely. A database rollback cannot automatically undo an external email failure.
Q028 · SCENARIO / FOLLOW-UP · BASE V4
TTS 055 · Q: How would you protect password-reset tokens?
Mở đáp án mẫu Q028 — sau khi tự trả lời
TTS 056 · A: I would store a hash of a strong random token and give it an expiration time. The token should be single-use. I would test expired, reused, and concurrent token requests.
Q029 · SCENARIO / FOLLOW-UP · ADD V5
TTS 057 · Q: How would you handle verification-email delivery reliably?
Mở đáp án mẫu Q029 — sau khi tự trả lời
TTS 058 · A: I would save the user and a durable email-delivery task in one local transaction. A worker can send the email and retry failures. I would also make delivery processing safe when messages are duplicated.
04 — SQL, indexes, ACID và locking / tiểu mục 04.1
Q030 · FOUNDATION · ADD V5
TTS 059 · Q: What is a primary key?
Mở đáp án mẫu Q030 — sau khi tự trả lời
TTS 060 · A: A primary key uniquely identifies each row in a table. Its value must not be null, and the database enforces uniqueness.
Q031 · FOUNDATION · ADD V5
TTS 061 · Q: What is a foreign key?
Mở đáp án mẫu Q031 — sau khi tự trả lời
TTS 062 · A: A foreign key links a row to a key in another table. It helps the database enforce referential integrity between related records.
04 — SQL, indexes, ACID và locking / tiểu mục 04.2
Q032 · MECHANISM / WHY · BASE V4
TTS 063 · Q: Explain INNER JOIN versus LEFT JOIN with customer bookings.
Mở đáp án mẫu Q032 — sau khi tự trả lời
TTS 064 · A: An INNER JOIN returns only customers with matching bookings. A LEFT JOIN keeps every customer, even when no booking exists. The booking fields are null for customers without a match.
Q033 · MECHANISM / WHY · ADD V5
TTS 065 · Q: What is the difference between WHERE and HAVING?
Mở đáp án mẫu Q033 — sau khi tự trả lời
TTS 066 · A: WHERE filters rows before grouping. HAVING filters groups after aggregation. For example, I would use HAVING to keep customers whose total spending exceeds a threshold.
Q034 · MECHANISM / WHY · ADD V5
TTS 067 · Q: What is the difference between COUNT(*) and COUNT(column)?
Mở đáp án mẫu Q034 — sau khi tự trả lời
TTS 068 · A: COUNT(*) counts rows, including rows with null values. COUNT(column) counts only rows where that column is not null.
Q035 · MECHANISM / WHY · ADD V5
TTS 069 · Q: What is the difference between UNION and UNION ALL?
Mở đáp án mẫu Q035 — sau khi tự trả lời
TTS 070 · A: UNION removes duplicate rows from the combined result. UNION ALL keeps duplicates and usually avoids the cost of removing them.
04 — SQL, indexes, ACID và locking / tiểu mục 04.3
Q036 · FOUNDATION · ADD V5
TTS 071 · Q: What is a database index?
Mở đáp án mẫu Q036 — sau khi tự trả lời
TTS 072 · A: An index is a data structure that helps the database find matching rows efficiently. It can improve reads, but it uses storage and requires maintenance during writes.
Q037 · MECHANISM / WHY · ADD V5
TTS 073 · Q: Why can an index slow down INSERT and UPDATE operations?
Mở đáp án mẫu Q037 — sau khi tự trả lời
TTS 074 · A: The database may need to update one or more indexes when a row changes. That extra work can increase the cost of writes. I would add indexes based on measured query needs.
Q038 · SCENARIO / FOLLOW-UP · BASE V4
TTS 075 · Q: Would you add an index on a low-selectivity status column?
Mở đáp án mẫu Q038 — sau khi tự trả lời
TTS 076 · A: Not automatically. If the status column has only a few common values, the index may not help much. I would inspect the execution plan and real query workload first.
Q039 · SCENARIO / FOLLOW-UP · ADD V5
TTS 077 · Q: How would you investigate a slow SQL query that already has an index?
Mở đáp án mẫu Q039 — sau khi tự trả lời
TTS 078 · A: I would inspect the execution plan and measure how many rows the query reads. Then I would check selectivity, join conditions, sorting, and whether the index is actually used.
04 — SQL, indexes, ACID và locking / tiểu mục 04.5
Q040 · MECHANISM / WHY · BASE V4
TTS 079 · Q: What is the difference between atomicity and isolation?
Mở đáp án mẫu Q040 — sau khi tự trả lời
TTS 080 · A: Atomicity means a transaction succeeds or fails as one unit. Isolation describes how concurrent transactions see and affect each other. Both matter, but they solve different problems.
Q041 · FOUNDATION · ADD V5
TTS 081 · Q: What does ACID stand for?
Mở đáp án mẫu Q041 — sau khi tự trả lời
TTS 082 · A: ACID stands for atomicity, consistency, isolation, and durability. These properties describe important guarantees and boundaries of database transactions.
Q042 · MECHANISM / WHY · ADD V5
TTS 083 · Q: What is the difference between a dirty read and a non-repeatable read?
Mở đáp án mẫu Q042 — sau khi tự trả lời
TTS 084 · A: A dirty read sees changes that another transaction has not committed. A non-repeatable read happens when the same row is read twice and its committed value changes between reads.
Q043 · FOUNDATION · ADD V5
TTS 085 · Q: What is a phantom read?
Mở đáp án mẫu Q043 — sau khi tự trả lời
TTS 086 · A: A phantom read happens when repeating a query with the same condition returns a different set of rows because another transaction changed matching rows. The available protections depend on the database and isolation level.
04 — SQL, indexes, ACID và locking / tiểu mục 04.6
Q044 · MECHANISM / WHY · BASE V4
TTS 087 · Q: Why is a transaction not always enough to prevent overselling?
Mở đáp án mẫu Q044 — sau khi tự trả lời
TTS 088 · A: A transaction gives atomic behavior, but two transactions can still pass the same availability check. I would use suitable locking, an atomic update, or a database constraint to protect inventory.
Q045 · MECHANISM / WHY · ADD V5
TTS 089 · Q: What is the difference between optimistic and pessimistic locking?
Mở đáp án mẫu Q045 — sau khi tự trả lời
TTS 090 · A: Optimistic locking detects conflicts when updating, often by checking a version value. Pessimistic locking locks data before a conflicting operation can proceed. I would choose based on contention and the cost of retries.
Q046 · SCENARIO / FOLLOW-UP · BASE V4
TTS 091 · Q: How would you test a lost update with two requests?
Mở đáp án mẫu Q046 — sau khi tự trả lời
TTS 092 · A: I would run two requests that read and update the same record at nearly the same time. Then I would compare the final value with the expected result and verify that no update was lost.
05 — HTTP request, timeout và retry
Q047 · MECHANISM / WHY · BASE V4
TTS 093 · Q: Walk me through an HTTPS request from browser to backend.
Mở đáp án mẫu Q047 — sau khi tự trả lời
TTS 094 · A: First, the browser resolves the domain name and establishes a secure connection. Then it sends an HTTPS request. The backend processes it and returns an HTTP response.
Q048 · MECHANISM / WHY · BASE V4
TTS 095 · Q: What is the difference between HTTP 401 and 403?
Mở đáp án mẫu Q048 — sau khi tự trả lời
TTS 096 · A: HTTP 401 means the request does not have valid authentication. HTTP 403 means the server understands the request but refuses access, even when the user may be authenticated.
Q049 · FOUNDATION · BASE V4
TTS 097 · Q: Should a client automatically retry a booking POST after a timeout?
Mở đáp án mẫu Q049 — sau khi tự trả lời
TTS 098 · A: Not blindly. A timeout does not prove that the operation failed. I would retry only with a safe strategy, such as an idempotency key, and check the booking status.
Q050 · MECHANISM / WHY · ADD V5
TTS 099 · Q: What is the difference between GET and POST?
Mở đáp án mẫu Q050 — sau khi tự trả lời
TTS 100 · A: GET is intended to retrieve a representation without causing requested business side effects. POST submits data for processing and can create or change server state. A POST is not automatically safe to retry.
Q051 · MECHANISM / WHY · ADD V5
TTS 101 · Q: What is the difference between PUT and PATCH?
Mở đáp án mẫu Q051 — sau khi tự trả lời
TTS 102 · A: PUT generally replaces the target resource representation according to the API contract. PATCH applies a partial change. I would check the API's documented semantics instead of assuming every update is idempotent.
Q052 · FOUNDATION · ADD V5
TTS 103 · Q: What do HTTP 200, 201, and 204 mean?
Mở đáp án mẫu Q052 — sau khi tự trả lời
TTS 104 · A: 200 means the request succeeded and usually includes a response representation. 201 indicates a resource was created. 204 means the request succeeded without response content.
Q053 · FOUNDATION · ADD V5
TTS 105 · Q: What do HTTP 400, 404, 409, and 500 mean?
Mở đáp án mẫu Q053 — sau khi tự trả lời
TTS 106 · A: 400 means the request is invalid, and 404 means the resource was not found. 409 indicates a conflict with the current resource state. 500 indicates an unexpected server-side error.
Q054 · MECHANISM / WHY · ADD V5
TTS 107 · Q: What is the difference between a timeout and a connection refusal?
Mở đáp án mẫu Q054 — sau khi tự trả lời
TTS 108 · A: A timeout means the expected operation or response did not complete within the allowed time. A connection refusal means the connection attempt was actively rejected. Neither result alone proves whether an earlier request committed.
Q055 · MECHANISM / WHY · ADD V5
TTS 109 · Q: Why is an idempotency key useful for a payment or booking API?
Mở đáp án mẫu Q055 — sau khi tự trả lời
TTS 110 · A: A client can reuse the same key when retrying one logical operation. The server can recognize the request and return its earlier result without repeating the side effect. This requires a reliable server-side implementation.
Q056 · SCENARIO / FOLLOW-UP · BASE V4
TTS 111 · Q: What if the first response is lost after a successful commit?
Mở đáp án mẫu Q056 — sau khi tự trả lời
TTS 112 · A: The server may have committed the booking even though the client saw a timeout. I would use the same idempotency key or operation ID to retrieve the earlier result and avoid duplicates.
Q057 · SCENARIO / FOLLOW-UP · BASE V4
TTS 113 · Q: How would you expose the status of an uncertain operation?
Mở đáp án mẫu Q057 — sau khi tự trả lời
TTS 114 · A: I would return a stable operation ID and expose a status endpoint. The client could check whether the operation is pending, successful, failed, or still unknown.
06 — Threads, shared state và race conditions
Q058 · MECHANISM / WHY · BASE V4
TTS 115 · Q: What is the difference between a process and a thread?
Mở đáp án mẫu Q058 — sau khi tự trả lời
TTS 116 · A: A process has its own address space and resources. Threads within one process share heap objects, but each thread has its own execution stack. This makes communication easier but creates shared-state risks.
Q059 · MECHANISM / WHY · BASE V4
TTS 117 · Q: Why can count++ lose increments under concurrent requests?
Mở đáp án mẫu Q059 — sau khi tự trả lời
TTS 118 · A: The increment is a read, an addition, and a write. Two threads may read the same old value and write the same new value. This can lose one increment.
Q060 · MECHANISM / WHY · BASE V4
TTS 119 · Q: Why might synchronized be insufficient in a multi-instance backend?
Mở đáp án mẫu Q060 — sau khi tự trả lời
TTS 120 · A: Synchronized protects threads sharing the same lock inside one application instance. Two backend instances do not share that Java lock. I would protect shared database state at the database level.
Q061 · FOUNDATION · BASE V4
TTS 121 · Q: Does volatile make count++ atomic?
Mở đáp án mẫu Q061 — sau khi tự trả lời
TTS 122 · A: No. Volatile helps with visibility, but count plus plus is still a compound operation. I would use an atomic counter or proper synchronization for an in-memory value.
Q062 · FOUNDATION · ADD V5
TTS 123 · Q: What is a race condition?
Mở đáp án mẫu Q062 — sau khi tự trả lời
TTS 124 · A: A race condition happens when the result depends on the timing of concurrent operations. For example, two threads may read the same stock value and both attempt to sell the last item.
Q063 · FOUNDATION · ADD V5
TTS 125 · Q: What is a deadlock?
Mở đáp án mẫu Q063 — sau khi tự trả lời
TTS 126 · A: A deadlock happens when operations wait for resources held by one another and none can progress. I would reduce inconsistent lock ordering and use suitable timeouts or deadlock detection.
Q064 · MECHANISM / WHY · ADD V5
TTS 127 · Q: What is the difference between concurrency and parallelism?
Mở đáp án mẫu Q064 — sau khi tự trả lời
TTS 128 · A: Concurrency means several tasks make progress during overlapping periods. Parallelism means tasks execute at the same time on different processing resources.
Q065 · MECHANISM / WHY · ADD V5
TTS 129 · Q: What is the difference between a thread's stack and the JVM heap?
Mở đáp án mẫu Q065 — sau khi tự trả lời
TTS 130 · A: Each Java thread has its own execution stack for frames and local execution state. Objects are generally allocated on the heap, which threads may share. Shared mutable objects need careful coordination.
Q066 · MECHANISM / WHY · ADD V5
TTS 131 · Q: What is the difference between synchronized and ReentrantLock?
Mở đáp án mẫu Q066 — sau khi tự trả lời
TTS 132 · A: Both can protect critical sections inside one JVM. ReentrantLock offers features such as timed lock attempts and interruptible lock acquisition. Neither automatically coordinates separate backend instances.
Q067 · FOUNDATION · ADD V5
TTS 133 · Q: What can cause memory leaks in a Java application even with garbage collection?
Mở đáp án mẫu Q067 — sau khi tự trả lời
TTS 134 · A: An application can keep references to objects that are no longer needed. For example, an unbounded cache or a static collection may keep growing. Garbage collection cannot reclaim objects that remain reachable.
Q068 · SCENARIO / FOLLOW-UP · BASE V4
TTS 135 · Q: When would you choose an atomic SQL update over an in-memory lock?
Mở đáp án mẫu Q068 — sau khi tự trả lời
TTS 136 · A: I would choose an atomic SQL update when multiple application instances change the same database record. A local Java lock cannot coordinate all those instances.
07 — Hotel Booking LLD + state machine
Q069 · FOUNDATION · BASE V4
TTS 137 · Q: Design a booking module where staff must approve requests.
Mở đáp án mẫu Q069 — sau khi tự trả lời
TTS 138 · A: I would model Customer, Room, Booking, and nightly inventory. A new booking can start in PENDING and move to CONFIRMED after staff approval. I would validate permissions and state transitions.
Q070 · MECHANISM / WHY · BASE V4
TTS 139 · Q: Should pending bookings hold inventory? What is the trade-off?
Mở đáp án mẫu Q070 — sau khi tự trả lời
TTS 140 · A: It depends on the business policy. Holding inventory protects pending requests but can block other customers. Not holding it improves availability but means approval may fail later.
Q071 · FOUNDATION · ADD V5
TTS 141 · Q: What is a state transition in a booking system?
Mở đáp án mẫu Q071 — sau khi tự trả lời
TTS 142 · A: A state transition changes a booking from one allowed state to another. For example, staff approval may move PENDING to CONFIRMED. I would reject transitions that violate the agreed business policy.
Q072 · SCENARIO / FOLLOW-UP · BASE V4
TTS 143 · Q: How do you handle two requests for the same room and night?
Mở đáp án mẫu Q072 — sau khi tự trả lời
TTS 144 · A: I would protect room-night allocation in the database, not just with an application pre-check. A constraint or suitable transaction and lock should prevent overlapping allocations. I would test concurrent requests.
Q073 · SCENARIO / FOLLOW-UP · BASE V4
TTS 145 · Q: What changes if a customer can cancel before check-in?
Mở đáp án mẫu Q073 — sau khi tự trả lời
TTS 146 · A: I would clarify the cancellation deadline and refund policy. Then I would allow valid state transitions and release reserved nights when the business rules require it.
Q074 · SCENARIO / FOLLOW-UP · BASE V4
TTS 147 · Q: What if a booking contains multiple nights and allocation fails halfway through?
Mở đáp án mẫu Q074 — sau khi tự trả lời
TTS 148 · A: I would keep allocation for all required nights in one suitable database transaction when possible. If any night fails, I would roll back the local allocation and return a conflict.
Q075 · SCENARIO / FOLLOW-UP · ADD V5
TTS 149 · Q: How would you prevent double booking for overlapping date ranges?
Mở đáp án mẫu Q075 — sau khi tự trả lời
TTS 150 · A: I would define precisely which bookings reserve inventory and which dates are included. Then I would use a database allocation model and suitable constraints or locking. I would test overlapping and adjacent date ranges concurrently.
Q076 · SCENARIO / FOLLOW-UP · ADD V5
TTS 151 · Q: What happens if an external hotel provider confirms a room but our database update fails?
Mở đáp án mẫu Q076 — sau khi tự trả lời
TTS 152 · A: I would treat the operation as inconsistent until its status is reconciled. A local transaction cannot undo the provider's confirmation automatically. I would record operation identifiers and use an agreed compensation or support workflow.
08 — Testing, Cloud, Security và DSA recap
Q077 · MECHANISM / WHY · BASE V4
TTS 153 · Q: How do unit tests differ from integration tests?
Mở đáp án mẫu Q077 — sau khi tự trả lời
TTS 154 · A: A unit test checks a small piece of logic in isolation. An integration test checks how real components work together. For example, it can verify a service using a real test database.
Q078 · FOUNDATION · BASE V4
TTS 155 · Q: Does high test coverage guarantee there are no bugs?
Mở đáp án mẫu Q078 — sau khi tự trả lời
TTS 156 · A: No. High coverage means many lines or branches were executed. It does not prove that the assertions are correct or that all important edge cases were tested.
Q079 · MECHANISM / WHY · BASE V4
TTS 157 · Q: What is the difference between authentication and authorization?
Mở đáp án mẫu Q079 — sau khi tự trả lời
TTS 158 · A: Authentication checks who the user is. Authorization checks what that user can do. For example, a customer may be logged in but still cannot approve a booking.
Q080 · FOUNDATION · ADD V5
TTS 159 · Q: What is mocking in unit testing?
Mở đáp án mẫu Q080 — sau khi tự trả lời
TTS 160 · A: Mocking replaces a dependency with a controlled test double. It can verify interactions or simulate failures. I would still use integration tests to check real database behavior.
Q081 · MECHANISM / WHY · ADD V5
TTS 161 · Q: What is the difference between authentication and role-based authorization?
Mở đáp án mẫu Q081 — sau khi tự trả lời
TTS 162 · A: Authentication establishes who the caller is. Role-based authorization uses roles or permissions to decide what actions that caller may perform. Object ownership can require extra checks beyond the role.
Q082 · MECHANISM / WHY · ADD V5
TTS 163 · Q: What is the difference between symmetric and asymmetric encryption?
Mở đáp án mẫu Q082 — sau khi tự trả lời
TTS 164 · A: Symmetric encryption uses a shared secret key for encryption and decryption. Asymmetric encryption uses a related public and private key pair. The right choice depends on the protocol and security goal.
Q083 · MECHANISM / WHY · ADD V5
TTS 165 · Q: What is the difference between a virtual machine and a container?
Mở đáp án mẫu Q083 — sau khi tự trả lời
TTS 166 · A: A virtual machine runs its own guest operating system on virtualized hardware. A container normally shares the host kernel while isolating application processes. Containers are often lighter, but isolation and security still need configuration.
Q084 · FOUNDATION · ADD V5
TTS 167 · Q: What does Big O notation describe?
Mở đáp án mẫu Q084 — sau khi tự trả lời
TTS 168 · A: Big O describes how an algorithm’s resource usage grows as the input size increases. I use it to compare growth rates, such as O(n) and O(n²), while stating the assumptions.
Q085 · MECHANISM / WHY · ADD V5
TTS 169 · Q: What is the difference between a stack and a queue?
Mở đáp án mẫu Q085 — sau khi tự trả lời
TTS 170 · A: A stack uses last in, first out order. A queue uses first in, first out order. For example, DFS can use a stack, while BFS commonly uses a queue.
Q086 · MECHANISM / WHY · ADD V5
TTS 171 · Q: What is the difference between BFS and DFS?
Mở đáp án mẫu Q086 — sau khi tự trả lời
TTS 172 · A: Breadth-first search explores nodes level by level, commonly using a queue. Depth-first search explores a path deeply before backtracking, using a stack or recursion. With an adjacency list, both run in O(V + E) time.
Q087 · MECHANISM / WHY · ADD V5
TTS 173 · Q: Why can Quick Sort be O(n²) in the worst case while Merge Sort stays O(n log n)?
Mở đáp án mẫu Q087 — sau khi tự trả lời
TTS 174 · A: Quick Sort can create very unbalanced partitions, leading to quadratic work. Merge Sort repeatedly splits the input and merges sorted halves, giving O(n log n) time in the usual implementation. Their memory trade-offs are different.
Q088 · FOUNDATION · ADD V5
TTS 175 · Q: How can you prevent SQL injection in a Java backend?
Mở đáp án mẫu Q088 — sau khi tự trả lời
TTS 176 · A: I would use parameterized queries or safely bound ORM parameters, not build SQL by concatenating untrusted input. I would also validate inputs and limit database permissions. Validation alone is not a replacement for parameter binding.
Q089 · SCENARIO / FOLLOW-UP · BASE V4
TTS 177 · Q: How would you test that only staff can approve a booking?
Mở đáp án mẫu Q089 — sau khi tự trả lời
TTS 178 · A: I would test the approval API with a staff account and expect success. Then I would use a customer account and expect a forbidden response with no booking state change.
Q090 · SCENARIO / FOLLOW-UP · BASE V4
TTS 179 · Q: An application is slow. Would you add more servers immediately?
Mở đáp án mẫu Q090 — sau khi tự trả lời
TTS 180 · A: No. I would first measure latency and check logs, slow SQL queries, and resource usage. More servers will not necessarily fix a slow database query.
Q091 · SCENARIO / FOLLOW-UP · ADD V5
TTS 181 · Q: How would you explain the time complexity of binary search?
Mở đáp án mẫu Q091 — sau khi tự trả lời
TTS 182 · A: Binary search repeatedly halves a sorted search range. Its time complexity is O(log n), and an iterative implementation can use O(1) extra space. The input must satisfy the sorted-order assumption.
08A — Java Core + OOP / tiểu mục 08A.1
Q092 · MECHANISM / WHY · BASE V4
TTS 183 · Q: Does static imply thread safety? Why not?
Mở đáp án mẫu Q092 — sau khi tự trả lời
TTS 184 · A: No. Static means a field or method belongs to the class rather than one object. Multiple threads can still access a shared static field and cause a race condition.
Q093 · FOUNDATION · ADD V5
TTS 185 · Q: What does static mean, and does it imply thread safety?
Mở đáp án mẫu Q093 — sau khi tự trả lời
TTS 186 · A: Static means a member belongs to a class rather than a particular object. A static mutable field can still be accessed by multiple threads. It does not guarantee atomic or thread-safe updates.
Q094 · MECHANISM / WHY · ADD V5
TTS 187 · Q: What happens when you invoke a static method through a superclass reference to a subclass object?
Mở đáp án mẫu Q094 — sau khi tự trả lời
TTS 188 · A: Static methods are hidden, not overridden polymorphically. The method selected depends on the compile-time reference type, not the runtime object type. I prefer calling static methods through the class name.
Q095 · MECHANISM / WHY · ADD V5
TTS 189 · Q: What is the difference between final, finally, and finalize?
Mở đáp án mẫu Q095 — sau khi tự trả lời
TTS 190 · A: Final restricts reassignment, overriding, or inheritance depending on where it is used. Finally is a block that normally runs when a try statement completes. Finalize is an obsolete cleanup mechanism that should not be relied on.
08A — Java Core + OOP / tiểu mục 08A.2
Q096 · MECHANISM / WHY · BASE V4
TTS 191 · Q: What is the difference between == and equals for objects?
Mở đáp án mẫu Q096 — sau khi tự trả lời
TTS 192 · A: For object references, double equals compares whether they point to the same object. The equals method can compare logical values. For example, two different String objects may have equal text.
Q097 · MECHANISM / WHY · BASE V4
TTS 193 · Q: Why can mutable HashMap keys cause problems?
Mở đáp án mẫu Q097 — sau khi tự trả lời
TTS 194 · A: A mutable key may change its hash code after insertion. Then HashMap may search the wrong bucket and fail to find the key. I would prefer immutable keys.
Q098 · MECHANISM / WHY · BASE V4
TTS 195 · Q: What does Java pass when you pass an object to a method?
Mở đáp án mẫu Q098 — sau khi tự trả lời
TTS 196 · A: Java is always pass-by-value. When I pass an object, the method receives a copy of the reference value. It can change the object, but reassigning the parameter does not replace the caller’s reference.
Q099 · MECHANISM / WHY · ADD V5
TTS 197 · Q: Why do HashMap keys need a stable hashCode and equals contract?
Mở đáp án mẫu Q099 — sau khi tự trả lời
TTS 198 · A: HashMap uses hash codes to locate candidate entries and equals to identify a matching key. Equal keys must have equal hash codes. Changing a key's equality-related fields after insertion can break lookup.
Q100 · MECHANISM / WHY · ADD V5
TTS 199 · Q: Why doesn't changing a method's object parameter reference replace the caller's reference?
Mở đáp án mẫu Q100 — sau khi tự trả lời
TTS 200 · A: Java passes a copy of the reference value to the method. Reassigning that local copy does not change the caller's variable. Mutating the referenced object can still be visible to the caller.
Q101 · MECHANISM / WHY · ADD V5
TTS 201 · Q: What is the difference between String, StringBuilder, and StringBuffer?
Mở đáp án mẫu Q101 — sau khi tự trả lời
TTS 202 · A: String is immutable. StringBuilder is a mutable text builder without synchronized methods. StringBuffer synchronizes many operations, but that does not automatically make a multi-step workflow atomic.
Q102 · MECHANISM / WHY · ADD V5
TTS 203 · Q: What is the difference between stack memory and heap memory in Java?
Mở đáp án mẫu Q102 — sau khi tự trả lời
TTS 204 · A: A thread's stack stores call frames and execution state. The heap typically stores objects shared by reference across code and threads. The precise runtime optimizations are managed by the JVM.
Q103 · MECHANISM / WHY · ADD V5
TTS 205 · Q: What is the difference between equals and hashCode contracts?
Mở đáp án mẫu Q103 — sau khi tự trả lời
TTS 206 · A: Equals determines whether two objects are logically equal according to a class's implementation. If two objects are equal, their hash codes must match. The reverse is not guaranteed because hash collisions are possible.
08A — Java Core + OOP / tiểu mục 08A.3
Q104 · MECHANISM / WHY · ADD V5
TTS 207 · Q: What's the difference between interface and abstract class?
Mở đáp án mẫu Q104 — sau khi tự trả lời
TTS 208 · A: An interface defines a contract that classes can implement. An abstract class can provide shared state, constructors, and common implementation. I would choose based on the relationship and design needs.
Q105 · MECHANISM / WHY · ADD V5
TTS 209 · Q: What's the difference between an overloaded and an overridden method?
Mở đáp án mẫu Q105 — sau khi tự trả lời
TTS 210 · A: Overloading uses the same method name with different parameter lists, and selection is based mainly on compile-time types. Overriding provides a new implementation of an inherited instance method, selected by runtime dispatch.
Q106 · FOUNDATION · ADD V5
TTS 211 · Q: What is encapsulation in object-oriented programming?
Mở đáp án mẫu Q106 — sau khi tự trả lời
TTS 212 · A: Encapsulation groups data with behavior and controls access to internal state. For example, a Booking object can expose an approve method instead of allowing arbitrary status changes.
Q107 · MECHANISM / WHY · ADD V5
TTS 213 · Q: What is inheritance, and when could composition be better?
Mở đáp án mẫu Q107 — sau khi tự trả lời
TTS 214 · A: Inheritance models an is-a relationship between types. Composition builds behavior by combining objects. I prefer composition when I need to change policies without creating a fragile class hierarchy.
Q108 · FOUNDATION · ADD V5
TTS 215 · Q: What is polymorphism in Java?
Mở đáp án mẫu Q108 — sau khi tự trả lời
TTS 216 · A: Polymorphism lets code use a common type while different implementations provide different behavior. For example, a CheckoutService can call a DiscountPolicy interface without knowing the specific discount algorithm.
Q109 · FOUNDATION · ADD V5
TTS 217 · Q: What is abstraction in OOP?
Mở đáp án mẫu Q109 — sau khi tự trả lời
TTS 218 · A: Abstraction exposes the important contract while hiding implementation details. For example, a PaymentGateway interface can describe a charge operation without exposing the provider's HTTP calls.
Q110 · SCENARIO / FOLLOW-UP · BASE V4
TTS 219 · Q: When would you use an interface rather than an abstract class?
Mở đáp án mẫu Q110 — sau khi tự trả lời
TTS 220 · A: I would use an interface to define a contract that different classes can implement. I would use an abstract class when related classes need shared state or common implementation.
08A — Java Core + OOP / tiểu mục 08A.4
Q111 · FOUNDATION · ADD V5
TTS 221 · Q: Can garbage collection replace closing a database connection?
Mở đáp án mẫu Q111 — sau khi tự trả lời
TTS 222 · A: No. Garbage collection manages reclaimable Java objects, not timely release of every external resource. I would close connections and streams appropriately, often with try-with-resources or a managed framework.
Q112 · MECHANISM / WHY · ADD V5
TTS 223 · Q: What is the difference between checked and unchecked exceptions?
Mở đáp án mẫu Q112 — sau khi tự trả lời
TTS 224 · A: Checked exceptions generally must be caught or declared by the compiler. Unchecked exceptions are RuntimeException types and their subclasses. I choose handling based on whether callers can meaningfully recover.
Q113 · MECHANISM / WHY · ADD V5
TTS 225 · Q: What is the difference between List, Set, and Map?
Mở đáp án mẫu Q113 — sau khi tự trả lời
TTS 226 · A: List is an ordered collection that can contain duplicates. Set stores unique elements according to its equality rules. Map associates keys with values and requires unique keys.
Q114 · MECHANISM / WHY · ADD V5
TTS 227 · Q: What is the difference between HashMap and ConcurrentHashMap?
Mở đáp án mẫu Q114 — sau khi tự trả lời
TTS 228 · A: HashMap is not safe for unsynchronized concurrent modifications. ConcurrentHashMap supports concurrent access with its own concurrency guarantees. For compound operations, I would still choose the appropriate atomic map method.
Q115 · MECHANISM / WHY · ADD V5
TTS 229 · Q: What is the difference between HashSet and TreeSet?
Mở đáp án mẫu Q115 — sau khi tự trả lời
TTS 230 · A: HashSet uses hashing and does not guarantee sorted iteration order. TreeSet maintains a sorted order using natural ordering or a comparator. Their performance and element requirements differ.
Q116 · FOUNDATION · ADD V5
TTS 231 · Q: What is a generic type in Java?
Mở đáp án mẫu Q116 — sau khi tự trả lời
TTS 232 · A: Generics let me express type constraints, such as List
Q117 · MECHANISM / WHY · ADD V5
TTS 233 · Q: What is the difference between Comparable and Comparator?
Mở đáp án mẫu Q117 — sau khi tự trả lời
TTS 234 · A: Comparable defines an object's natural ordering. Comparator defines an external ordering strategy. I can use different comparators to sort the same objects in different ways.
Q118 · MECHANISM / WHY · ADD V5
TTS 235 · Q: What is the difference between map and filter in Java Streams?
Mở đáp án mẫu Q118 — sau khi tự trả lời
TTS 236 · A: Map transforms each element into another value. Filter keeps only elements that satisfy a predicate. Neither operation changes the original collection by itself.
Q119 · SCENARIO / FOLLOW-UP · ADD V5
TTS 237 · Q: When would you choose ArrayList instead of LinkedList?
Mở đáp án mẫu Q119 — sau khi tự trả lời
TTS 238 · A: I usually choose ArrayList for indexed access and efficient iteration. LinkedList may help with some insertions when I already hold the node position, but searching and memory overhead matter. I would measure before switching.
Q120 · SCENARIO / FOLLOW-UP · ADD V5
TTS 239 · Q: When would you use Optional rather than returning null?
Mở đáp án mẫu Q120 — sau khi tự trả lời
TTS 240 · A: Optional can make the possible absence of a result explicit in a return type. For example, a repository lookup may return Optional
08A — Java Core + OOP / tiểu mục 08A.5
Q121 · SCENARIO / FOLLOW-UP · ADD V5
TTS 241 · Q: Two requests increment a shared counter. What can go wrong?
Mở đáp án mẫu Q121 — sau khi tự trả lời
TTS 242 · A: Both requests may read the same old value and overwrite each other's update. This is a lost-update race. I would use an atomic operation or suitable synchronization for in-memory state.
08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.1
Q122 · MECHANISM / WHY · ADD V5
TTS 243 · Q: What is the difference between Spring and Spring Boot?
Mở đáp án mẫu Q122 — sau khi tự trả lời
TTS 244 · A: Spring is a framework and ecosystem for building applications. Spring Boot provides conventions, auto-configuration, and starter dependencies to simplify setup and deployment.
Q123 · MECHANISM / WHY · ADD V5
TTS 245 · Q: What is a bean, and how does constructor injection work?
Mở đáp án mẫu Q123 — sau khi tự trả lời
TTS 246 · A: A bean is an object managed by the Spring container. With constructor injection, Spring supplies the required dependencies when the object is created. It makes required dependencies explicit.
Q124 · MECHANISM / WHY · ADD V5
TTS 247 · Q: What's the difference between @Component, @Service, and @Repository?
Mở đáp án mẫu Q124 — sau khi tự trả lời
TTS 248 · A: All three can identify components for Spring to manage. Service communicates a business-layer role, while Repository communicates a persistence-layer role and can enable persistence exception translation. Component is a general stereotype.
Q125 · FOUNDATION · ADD V5
TTS 249 · Q: What is inversion of control in Spring?
Mở đáp án mẫu Q125 — sau khi tự trả lời
TTS 250 · A: Inversion of control means the framework manages object creation and wiring rather than application code creating every dependency. Dependency injection is a common way to implement it.
Q126 · MECHANISM / WHY · ADD V5
TTS 251 · Q: Why is constructor injection often preferred over field injection?
Mở đáp án mẫu Q126 — sau khi tự trả lời
TTS 252 · A: Constructor injection exposes required dependencies and makes them easier to provide in tests. It also supports immutable dependency fields. I would avoid injecting a long list of unrelated services into one class.
Q127 · FOUNDATION · ADD V5
TTS 253 · Q: What is Spring Boot auto-configuration?
Mở đáp án mẫu Q127 — sau khi tự trả lời
TTS 254 · A: Auto-configuration registers useful beans based on the dependencies, properties, and other beans available. It reduces manual configuration while still allowing explicit customization.
Q128 · SCENARIO / FOLLOW-UP · ADD V5
TTS 255 · Q: What happens if two beans have the same type?
Mở đáp án mẫu Q128 — sau khi tự trả lời
TTS 256 · A: Injection by type may be ambiguous when several beans qualify. I can use a qualifier or select a primary bean to make the dependency clear.
08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.2
Q129 · MECHANISM / WHY · BASE V4
TTS 257 · Q: Walk me through Controller → Service → Repository in Spring Boot.
Mở đáp án mẫu Q129 — sau khi tự trả lời
TTS 258 · A: The controller handles the HTTP request and input validation. The service applies business rules. The repository reads and writes data. Spring manages these components and injects their dependencies.
Q130 · FOUNDATION · BASE V4
TTS 259 · Q: Can @Valid enforce uniqueness across concurrent requests?
Mở đáp án mẫu Q130 — sau khi tự trả lời
TTS 260 · A: No. Validation annotations do not reliably enforce uniqueness across concurrent requests. I would use a database unique constraint and handle its violation.
Q131 · FOUNDATION · ADD V5
TTS 261 · Q: Can @Valid prevent two users from registering the same email concurrently?
Mở đáp án mẫu Q131 — sau khi tự trả lời
TTS 262 · A: No. Validation can check request data, but it cannot reliably protect against a race between two inserts. I would enforce email uniqueness in the database and handle constraint violations.
Q132 · FOUNDATION · ADD V5
TTS 263 · Q: What does @RestController do?
Mở đáp án mẫu Q132 — sau khi tự trả lời
TTS 264 · A: RestController combines controller behavior with response-body serialization for request handlers. Its methods commonly return objects that Spring converts to JSON according to the configured converters.
Q133 · MECHANISM / WHY · ADD V5
TTS 265 · Q: What is the difference between @RequestParam, @PathVariable, and @RequestBody?
Mở đáp án mẫu Q133 — sau khi tự trả lời
TTS 266 · A: RequestParam reads values from request parameters. PathVariable binds values from the URL path. RequestBody reads and converts the HTTP request body.
Q134 · MECHANISM / WHY · ADD V5
TTS 267 · Q: How does validation work with @Valid in a Spring controller?
Mở đáp án mẫu Q134 — sau khi tự trả lời
TTS 268 · A: Spring can validate a request DTO when it is bound to a validated method parameter. I would define constraints such as not blank and positive values. Business invariants still need service and database protection.
Q135 · SCENARIO / FOLLOW-UP · ADD V5
TTS 269 · Q: How would you secure a Spring REST endpoint?
Mở đáp án mẫu Q135 — sau khi tự trả lời
TTS 270 · A: I would authenticate the caller and then enforce the required permission or resource ownership. I would also validate inputs and test both authorized and forbidden requests. Authentication alone is not enough.
08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.3
Q136 · MECHANISM / WHY · BASE V4
TTS 271 · Q: What is the difference between flush and commit in JPA?
Mở đáp án mẫu Q136 — sau khi tự trả lời
TTS 272 · A: Flush sends pending SQL changes to the database, but the transaction may still be open. Commit makes the transaction complete and its changes durable according to the database guarantees.
Q137 · MECHANISM / WHY · BASE V4
TTS 273 · Q: Why can an ORM loop cause an N+1 query problem?
Mở đáp án mẫu Q137 — sau khi tự trả lời
TTS 274 · A: An N plus one problem happens when one query loads a list and extra queries load related data for each item. I would inspect SQL logs and use a suitable fetch plan or projection.
Q138 · MECHANISM / WHY · ADD V5
TTS 275 · Q: What is the difference between JPA and Hibernate?
Mở đáp án mẫu Q138 — sau khi tự trả lời
TTS 276 · A: JPA, now under Jakarta Persistence, defines an API and specification for persistence. Hibernate is an implementation of that specification and provides additional features.
Q139 · MECHANISM / WHY · ADD V5
TTS 277 · Q: What happens when you modify a managed JPA entity inside a transaction?
Mở đáp án mẫu Q139 — sau khi tự trả lời
TTS 278 · A: The persistence provider can detect changes to a managed entity and write them during flush. If the transaction commits successfully, those database changes can persist without an explicit save call for every field change.
Q140 · MECHANISM / WHY · ADD V5
TTS 279 · Q: What is lazy loading, and when can it fail?
Mở đáp án mẫu Q140 — sau khi tự trả lời
TTS 280 · A: Lazy loading fetches related data when the application accesses it. It can fail when the required persistence context is no longer available. I would plan the fetch strategy for each use case.
Q141 · MECHANISM / WHY · ADD V5
TTS 281 · Q: What is the difference between a JPA entity and a DTO?
Mở đáp án mẫu Q141 — sau khi tự trả lời
TTS 282 · A: An entity represents a persistence-managed domain object. A DTO is shaped for transferring data between boundaries. I usually avoid returning entities directly when it could expose fields or trigger unwanted lazy loading.
Q142 · FOUNDATION · ADD V5
TTS 283 · Q: What is the persistence context in JPA?
Mở đáp án mẫu Q142 — sau khi tự trả lời
TTS 284 · A: The persistence context tracks managed entities and their identities within a unit of work. It can reuse already managed objects and detect changes before a flush.
Q143 · MECHANISM / WHY · ADD V5
TTS 285 · Q: What is the difference between persist and merge in JPA?
Mở đáp án mẫu Q143 — sau khi tự trả lời
TTS 286 · A: Persist makes a new entity managed so it can be inserted. Merge copies state from a detached entity into a managed instance and returns that managed instance. I would not assume merge reattaches the original object.
Q144 · MECHANISM / WHY · ADD V5
TTS 287 · Q: What is the difference between LAZY and EAGER fetching?
Mở đáp án mẫu Q144 — sau khi tự trả lời
TTS 288 · A: Lazy fetching defers loading an association until needed. Eager fetching requires the association to be available, but it does not promise one SQL query. I would choose fetch plans based on the use case.
Q145 · SCENARIO / FOLLOW-UP · ADD V5
TTS 289 · Q: When would you use a fetch join or an EntityGraph?
Mở đáp án mẫu Q145 — sau khi tự trả lời
TTS 290 · A: I would use them when one query needs selected related entities and extra lazy loads are costly. I would be careful with paging queries that join large collections. A DTO projection may be simpler for list views.
08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.4
Q146 · FOUNDATION · BASE V4
TTS 291 · Q: Does @Transactional automatically prevent all inventory races?
Mở đáp án mẫu Q146 — sau khi tự trả lời
TTS 292 · A: No. Transactional does not automatically protect every check-then-insert race. I would choose a suitable isolation level, lock, constraint, or atomic update and test concurrent requests.
Q147 · FOUNDATION · ADD V5
TTS 293 · Q: What is the default rollback behavior of @Transactional?
Mở đáp án mẫu Q147 — sau khi tự trả lời
TTS 294 · A: By default, Spring rolls back for RuntimeException and Error. Checked exceptions do not trigger rollback by default. I can configure rollback rules when business behavior requires it.
Q148 · SCENARIO / FOLLOW-UP · ADD V5
TTS 295 · Q: Does @Transactional guarantee that two requests won't oversell inventory?
Mở đáp án mẫu Q148 — sau khi tự trả lời
TTS 296 · A: No. Transaction boundaries alone do not prevent every read-check-write race. I would use appropriate database protection, such as an atomic update, lock, or constraint, and verify the outcome with a concurrent test.
Q149 · SCENARIO / FOLLOW-UP · ADD V5
TTS 297 · Q: Why might @Transactional not work on a method called from within the same class?
Mở đáp án mẫu Q149 — sau khi tự trả lời
TTS 298 · A: In common proxy-based Spring transaction management, a call within the same object bypasses the transactional proxy. The expected transaction advice may not run. I would restructure the boundary or use the appropriate configuration.
08B — Spring Boot + JPA/Hibernate / tiểu mục 08B.5
Q150 · SCENARIO / FOLLOW-UP · ADD V5
TTS 299 · Q: What is the N+1 query problem and how would you detect it?
Mở đáp án mẫu Q150 — sau khi tự trả lời
TTS 300 · A: N plus one happens when one query loads a list and additional queries fetch related data item by item. I would inspect SQL logs, query counts, and endpoint performance. Then I would choose a projection or an appropriate fetch strategy.
Q151 · SCENARIO / FOLLOW-UP · ADD V5
TTS 301 · Q: How would you test a service that uses DB transactions and external APIs?
Mở đáp án mẫu Q151 — sau khi tự trả lời
TTS 302 · A: I would use integration tests with a real test database for transaction behavior. I would simulate external API success, timeout, and duplicate responses. Then I would verify both database state and recovery behavior.
08C — Java + SQL + English integrated case
Q152 · MECHANISM / WHY · BASE V4
TTS 303 · Q: Explain the main bug you found in the LAB 08C code.
Mở đáp án mẫu Q152 — sau khi tự trả lời
TTS 304 · A: Two booking requests can check the same available room before either saves a booking. Both may then return success. The bug is a read-check-write race that can cause overbooking.
Q153 · FOUNDATION · BASE V4
TTS 305 · Q: What SQL query or constraint would support your fix?
Mở đáp án mẫu Q153 — sau khi tự trả lời
TTS 306 · A: I could use an atomic conditional inventory update and check the affected row count. Another option is a database constraint or row lock with a suitable transaction. The choice depends on the schema.
Q154 · FOUNDATION · BASE V4
TTS 307 · Q: Which part of your fix is guaranteed by a database transaction, and which part is not?
Mở đáp án mẫu Q154 — sau khi tự trả lời
TTS 308 · A: A transaction can make the local database changes atomic. It does not automatically make a separate external API call atomic or prevent every concurrency race without the right database protection.
Q155 · MECHANISM / WHY · ADD V5
TTS 309 · Q: How do you explain a concurrent inventory bug in one minute?
Mở đáp án mẫu Q155 — sau khi tự trả lời
TTS 310 · A: Two requests read the last available item before either update becomes visible. Both may believe they can reserve it. I would move the critical check and update into a protected database operation and test two concurrent requests.
Q156 · FOUNDATION · ADD V5
TTS 311 · Q: What should a database integration test assert after two simultaneous bookings?
Mở đáp án mẫu Q156 — sau khi tự trả lời
TTS 312 · A: It should verify that the business invariant still holds in stored data. For one available room-night, at most one conflicting allocation should succeed. I would also check the returned statuses and any retry records.
Q157 · SCENARIO / FOLLOW-UP · BASE V4
TTS 313 · Q: How would you explain the solution to a teammate in under one minute?
Mở đáp án mẫu Q157 — sau khi tự trả lời
TTS 314 · A: Two requests were able to reserve the same inventory because the availability check was not protected. I would enforce the rule in the database and run a concurrent test to confirm that only one request succeeds.
Q158 · SCENARIO / FOLLOW-UP · BASE V4
TTS 315 · Q: What happens if a retry arrives with the same operation ID?
Mở đáp án mẫu Q158 — sau khi tự trả lời
TTS 316 · A: If the system stores operation IDs and their results, it should return the original result instead of repeating the action. The behavior must be supported by a persistent idempotency mechanism.
CASE LAB — V-Market
Q159 · P0 · PROJECT-SPECIFIC V5.1
TTS 317 · Q: What problem does V-Market solve?
Mở đáp án mẫu Q159 — sau khi tự trả lời
TTS 318 · A: V-Market is a Java and Spring Boot commerce project with a product catalog, guest checkout, and CSV imports. Its main backend challenges are keeping stock correct and handling repeated checkout requests safely. The project does not claim real payment gateway integration.
Q160 · P0 · PROJECT-SPECIFIC V5.1
TTS 319 · Q: Walk me through a V-Market checkout request.
Mở đáp án mẫu Q160 — sau khi tự trả lời
TTS 320 · A: The browser sends a request through the Next.js backend-for-frontend to the Java API. Inside a database transaction, the service checks the operation key, locks stock rows, and validates the current price and quantity. It saves the order, inventory changes, movements, and audit together before returning the result.
Q161 · P0 · PROJECT-SPECIFIC V5.1
TTS 321 · Q: Two customers each buy twenty items when only twenty-seven are in stock. What happens?
Mở đáp án mẫu Q161 — sau khi tự trả lời
TTS 322 · A: The first checkout locks the relevant stock row and may purchase twenty items. The second checkout waits and then reads the updated stock of seven. It must reject a request for twenty items, so the database never commits negative stock in this case.
Q162 · P0 · PROJECT-SPECIFIC V5.1
TTS 323 · Q: Why does V-Market need both an operation-key lock and stock locks?
Mở đáp án mẫu Q162 — sau khi tự trả lời
TTS 324 · A: The operation-key lock prevents the same checkout operation from creating another order. Stock locks protect inventory when different operations compete for the same products. They solve different concurrency problems.
Q163 · P0 · PROJECT-SPECIFIC V5.1
TTS 325 · Q: How does V-Market handle a repeated checkout with the same key?
Mở đáp án mẫu Q163 — sau khi tự trả lời
TTS 326 · A: The backend compares the guest scope, operation key, and request fingerprint. The same operation and payload can return the existing order during the replay window. Reusing the key with different quantities or customer data causes a conflict.
Q164 · P0 · PROJECT-SPECIFIC V5.1
TTS 327 · Q: The client times out after checkout. Should it create a new request key?
Mở đáp án mẫu Q164 — sau khi tự trả lời
TTS 328 · A: No. A timeout does not prove the order was not committed. The client keeps the operation key and guest capability, and uses the recovery endpoint to check the result. It should not start a new operation blindly.
Q165 · P0 · PROJECT-SPECIFIC V5.1
TTS 329 · Q: Why does V-Market use Redis, and can the cache cause overselling?
Mở đáp án mẫu Q165 — sau khi tự trả lời
TTS 330 · A: Redis caches catalog metadata, not the authoritative stock count. The displayed availability is a snapshot, and checkout checks the database again under a lock. Cache freshness may affect displayed metadata, but cached availability is not trusted to commit an order.
Q166 · P0 · PROJECT-SPECIFIC V5.1
TTS 331 · Q: What happens if a database error occurs while creating an order?
Mở đáp án mẫu Q166 — sau khi tự trả lời
TTS 332 · A: The order, order items, stock changes, inventory movements, and audit are written in one transaction. A rollback prevents those related database changes from being committed only partially. This does not mean external payment or delivery operations are covered by the transaction.
Q167 · P0 · PROJECT-SPECIFIC V5.1
TTS 333 · Q: What evidence and limitations can you discuss for V-Market?
Mở đáp án mẫu Q167 — sau khi tự trả lời
TTS 334 · A: The repository describes Testcontainers integration tests for overselling, simultaneous duplicates, and rejected key reuse. These tests check order counts, inventory changes, and database records, not just HTTP responses. They do not prove production reliability or that I personally ran the tests.
Q168 · P1 · PROJECT-SPECIFIC V5.1
TTS 335 · Q: How does V-Market validate Japanese legacy CSV imports?
Mở đáp án mẫu Q168 — sau khi tự trả lời
TTS 336 · A: It accepts UTF-8 and CP932 or Windows-31J with strict decoding. It checks the file structure, headers, columns, SKU values, and row data. Structural errors may reject the file, while invalid business rows can be stored for review.
Q169 · P1 · PROJECT-SPECIFIC V5.1
TTS 337 · Q: Why can't an old CSV stock snapshot restore inventory that has already been sold?
Mở đáp án mẫu Q169 — sau khi tự trả lời
TTS 338 · A: Unversioned legacy feeds can update metadata but not authoritative stock. A versioned stock snapshot must match the current stock version after the database lock is acquired. This prevents an old snapshot from silently overwriting a newer inventory state.
CASE LAB — V-Core
Q170 · P0 · PROJECT-SPECIFIC V5.1
TTS 339 · Q: What problem does V-Core solve?
Mở đáp án mẫu Q170 — sau khi tự trả lời
TTS 340 · A: V-Core is a Kanban collaboration project using Java, Spring Boot, PostgreSQL, and a React frontend. Its backend manages workspace permissions and concurrent task changes. A key rule is that moving tasks must not exceed a column's work-in-progress limit.
Q171 · P0 · PROJECT-SPECIFIC V5.1
TTS 341 · Q: Walk me through a task move in V-Core.
Mở đáp án mẫu Q171 — sau khi tự trả lời
TTS 342 · A: The client sends the target column, the task version, and an idempotency key through a BFF. The service checks access, locks the target column, and validates the task version and WIP limit inside a transaction. It then saves the task change, activity, outbox record, and idempotency result.
Q172 · P0 · PROJECT-SPECIFIC V5.1
TTS 343 · Q: Why does V-Core use both a column lock and a task version?
Mở đáp án mẫu Q172 — sau khi tự trả lời
TTS 344 · A: The column lock protects the shared WIP limit across different tasks. The task version prevents a stale update to one task. Two different tasks have different versions, so version checking alone cannot protect the column's capacity.
Q173 · P0 · PROJECT-SPECIFIC V5.1
TTS 345 · Q: Two users move tasks into the last free slot. How does V-Core prevent overflow?
Mở đáp án mẫu Q173 — sau khi tự trả lời
TTS 346 · A: Both operations need the target column lock before checking occupancy. One move fills the final slot and commits. The waiting request checks occupancy again and is rejected if the column is now full.
Q174 · P0 · PROJECT-SPECIFIC V5.1
TTS 347 · Q: What does V-Core do when the same task move request is retried?
Mở đáp án mẫu Q174 — sau khi tự trả lời
TTS 348 · A: The backend stores an idempotency key and a request hash scoped to the workspace. A matching retry can receive the saved response without applying the move again. Reusing the key with different content causes a conflict.
Q175 · P0 · PROJECT-SPECIFIC V5.1
TTS 349 · Q: What does the task-move transaction guarantee, and what does it not guarantee?
Mở đáp án mẫu Q175 — sau khi tự trả lời
TTS 350 · A: The task change, activity record, outbox entry, and idempotency result are committed together. If the transaction rolls back, those database changes roll back together. The transaction does not guarantee that an SSE notification reaches every browser.
Q176 · P0 · PROJECT-SPECIFIC V5.1
TTS 351 · Q: How does V-Core prevent a user from changing tasks in another workspace?
Mở đáp án mẫu Q176 — sau khi tự trả lời
TTS 352 · A: The service checks the current session and workspace membership or role in PostgreSQL. It also scopes task queries to the requested workspace and project. A trusted BFF secret is not the same as user authorization, and a public viewer cannot perform writes.
Q177 · P0 · PROJECT-SPECIFIC V5.1
TTS 353 · Q: How would you verify V-Core's WIP concurrency rule?
Mở đáp án mẫu Q177 — sau khi tự trả lời
TTS 354 · A: The repository includes an integration test that starts two competing moves for one remaining slot. The test checks both the responses and the final number of tasks in the column. I would explain the test from the code and avoid claiming that I personally ran it unless I did.
Q178 · P1 · PROJECT-SPECIFIC V5.1
TTS 355 · Q: What is the purpose of SSE in V-Core, and is delivery guaranteed?
Mở đáp án mẫu Q178 — sau khi tự trả lời
TTS 356 · A: SSE tells the user interface that workspace data may have changed. The interface then fetches current data from the database-backed API. The current feed can lose notifications, so SSE is a refresh hint, not a durable exactly-once event stream.
Q179 · P1 · PROJECT-SPECIFIC V5.1
TTS 357 · Q: What happens to an existing SSE stream when a user's access is revoked?
Mở đáp án mẫu Q179 — sau khi tự trả lời
TTS 358 · A: The backend rechecks the original session, account, and workspace membership before events or heartbeats. If access cannot be verified, the stream is closed. This does not undo events already sent or promise instantaneous revocation at every moment.
Q180 · P1 · PROJECT-SPECIFIC V5.1
TTS 359 · Q: Can an administrator lower a WIP limit below the current task count?
Mở đáp án mẫu Q180 — sau khi tự trả lời
TTS 360 · A: No. The current implementation locks the column and checks its version and occupancy. It rejects a new limit that is below the number of existing tasks. It does not automatically delete or move tasks to satisfy the limit.
09 — Basic System Design
Q181 · FOUNDATION · BASE V4
TTS 361 · Q: Design a simple booking service for an MVP.
Mở đáp án mẫu Q181 — sau khi tự trả lời
TTS 362 · A: For an MVP, I would build one Spring Boot backend with a relational database. The service handles booking rules, and the database stores bookings and inventory. I would add monitoring and test failures before adding more components.
Q182 · MECHANISM / WHY · BASE V4
TTS 363 · Q: When might you add Redis caching, and what should not rely on a stale cache?
Mở đáp án mẫu Q182 — sau khi tự trả lời
TTS 364 · A: I would consider Redis if repeated reads put too much load on the database. But final room allocation must not trust a possibly stale cache. The database should enforce the inventory rule.
Q183 · FOUNDATION · ADD V5
TTS 365 · Q: What is a load balancer?
Mở đáp án mẫu Q183 — sau khi tự trả lời
TTS 366 · A: A load balancer distributes incoming requests across available backend instances. It can improve availability and capacity, but the instances must handle shared state correctly.
Q184 · FOUNDATION · ADD V5
TTS 367 · Q: What is eventual consistency?
Mở đáp án mẫu Q184 — sau khi tự trả lời
TTS 368 · A: Eventual consistency allows replicas or components to temporarily disagree. If updates stop and the system converges as designed, they eventually reach consistent state. I would clarify whether that delay is acceptable for the business rule.
Q185 · SCENARIO / FOLLOW-UP · BASE V4
TTS 369 · Q: Why would you choose a modular monolith before microservices?
Mở đáp án mẫu Q185 — sau khi tự trả lời
TTS 370 · A: A modular monolith is easier to develop, test, and deploy for a small product. It avoids early distributed-system complexity. The trade-off is less independent scaling and deployment.
Q186 · SCENARIO / FOLLOW-UP · BASE V4
TTS 371 · Q: What changes if an external provider is frequently slow?
Mở đáp án mẫu Q186 — sau khi tự trả lời
TTS 372 · A: I would set appropriate timeouts and identify whether the operation is safe to retry. I would track uncertain results and use a fallback or reconciliation workflow when the provider is unavailable.
Q187 · SCENARIO / FOLLOW-UP · BASE V4
TTS 373 · Q: How would you measure whether scaling actually helped?
Mở đáp án mẫu Q187 — sau khi tự trả lời
TTS 374 · A: I would compare latency, error rate, and throughput before and after scaling under similar load. I would also check database load and costs to make sure the change actually helped.
B — Debugging và external integration
Q188 · FOUNDATION · BASE V4
TTS 375 · Q: Which evidence would tell you that a retry is safe?
Mở đáp án mẫu Q188 — sau khi tự trả lời
TTS 376 · A: I would look for an idempotency contract and a way to check the original operation status. If I cannot confirm that repeating the request is safe, I would not retry it blindly.
Q189 · SCENARIO / FOLLOW-UP · BASE V4
TTS 377 · Q: An API returns 504, but an order exists in the database. What do you do first?
Mở đáp án mẫu Q189 — sau khi tự trả lời
TTS 378 · A: I would not assume the order failed. First, I would find the request ID and compare application logs with database records. Then I would check whether the order committed before the gateway timed out.
Q190 · SCENARIO / FOLLOW-UP · BASE V4
TTS 379 · Q: How would you investigate duplicate product imports?
Mở đáp án mẫu Q190 — sau khi tự trả lời
TTS 380 · A: I would reproduce the import with a small dataset and inspect duplicate records, request IDs, and retry behavior. Then I would identify the root cause and consider a stable external ID or database constraint.
Q191 · SCENARIO / FOLLOW-UP · BASE V4
TTS 381 · Q: What if logs show the same request ID twice?
Mở đáp án mẫu Q191 — sau khi tự trả lời
TTS 382 · A: That could be a retry, duplicate log entry, or another processing issue. I would compare timestamps, handlers, and database effects before concluding that the business action ran twice.
Q192 · SCENARIO / FOLLOW-UP · BASE V4
TTS 383 · Q: How would you design a regression test for the root cause?
Mở đáp án mẫu Q192 — sau khi tự trả lời
TTS 384 · A: I would reproduce the original failure, then test the corrected behavior. For a duplicate-order bug, I would send two requests with the same operation ID and verify there is only one order.
Q193 · SCENARIO / FOLLOW-UP · ADD V5
TTS 385 · Q: How would you trace an HTTP request across multiple services?
Mở đáp án mẫu Q193 — sau khi tự trả lời
TTS 386 · A: I would attach or propagate a correlation identifier and inspect logs or traces for that identifier. Then I would compare timestamps, error boundaries, and database effects.
Q194 · SCENARIO / FOLLOW-UP · ADD V5
TTS 387 · Q: What would you do if an external API returned an unfamiliar error?
Mở đáp án mẫu Q194 — sau khi tự trả lời
TTS 388 · A: I would check the API contract, log the safe diagnostic details, and reproduce the request if appropriate. I would separate permanent validation failures from transient failures before deciding whether to retry.
Q195 · SCENARIO / FOLLOW-UP · ADD V5
TTS 389 · Q: How would you prevent duplicate records during a CSV import?
Mở đáp án mẫu Q195 — sau khi tự trả lời
TTS 390 · A: I would identify a stable business key for each imported record. Then I would use an appropriate unique constraint or upsert strategy. I would also test duplicate rows and repeated file uploads.
CASE LAB — V-Pulse
Q196 · P0 · PROJECT-SPECIFIC V5.1
TTS 391 · Q: What is V-Pulse, and does it connect to real banks?
Mở đáp án mẫu Q196 — sau khi tự trả lời
TTS 392 · A: V-Pulse is a payment-reliability demo built with Java, Spring Boot, PostgreSQL, Redis, and React. It uses simulated payment rails, not real bank integrations. The main learning problem is handling uncertain payment outcomes safely.
Q197 · P0 · PROJECT-SPECIFIC V5.1
TTS 393 · Q: Walk me through creating a payment instruction in V-Pulse.
Mở đáp án mẫu Q197 — sau khi tự trả lời
TTS 394 · A: The browser sends a stable operation key and payload through the BFF. The Java service validates the request and stores a processing instruction and its identity in a short transaction. It calls the simulated gateway outside that transaction, then finalizes the result in another transaction.
Q198 · P0 · PROJECT-SPECIFIC V5.1
TTS 395 · Q: Does a gateway timeout mean that the payment failed?
Mở đáp án mẫu Q198 — sau khi tự trả lời
TTS 396 · A: No. A timeout means the caller did not confirm the result in time. A real provider might already have processed the request. V-Pulse parks uncertain work instead of blindly authorizing the payment again.
Q199 · P0 · PROJECT-SPECIFIC V5.1
TTS 397 · Q: What is the difference between duplicate create and replaying a payment attempt?
Mở đáp án mẫu Q199 — sau khi tự trả lời
TTS 398 · A: Duplicate create uses the same merchant, key, and payload to retrieve the existing instruction. Replay means making another attempt to send an already known instruction to the gateway. A safe duplicate create does not automatically authorize a new gateway attempt.
Q200 · P0 · PROJECT-SPECIFIC V5.1
TTS 399 · Q: When is a parked instruction allowed to replay in V-Pulse?
Mở đáp án mẫu Q200 — sau khi tự trả lời
TTS 400 · A: Replay needs explicit evidence that the previous attempt did not execute, such as a definite rejection or a call blocked before sending. A timeout or unknown outcome does not give that permission. The backend rejects unsafe replay even if the rail appears healthy now.
Q201 · P0 · PROJECT-SPECIFIC V5.1
TTS 401 · Q: Explain timeout, circuit breaker, bulkhead, and rate limit in V-Pulse.
Mở đáp án mẫu Q201 — sau khi tự trả lời
TTS 402 · A: A timeout limits how long we wait for a result. A circuit breaker stops calling a rail that repeatedly fails, while a bulkhead limits concurrent calls. A Redis rate limit controls how many new requests one merchant can make in a time window.
Q202 · P0 · PROJECT-SPECIFIC V5.1
TTS 403 · Q: Why does V-Pulse call the gateway outside its database transaction?
Mở đáp án mẫu Q202 — sau khi tự trả lời
TTS 404 · A: Waiting for an external gateway inside a database transaction could hold locks for too long. V-Pulse commits instruction identity first, calls the gateway, and finalizes the result separately. This design requires explicit handling of crashes and uncertain outcomes between those steps.
Q203 · P0 · PROJECT-SPECIFIC V5.1
TTS 405 · Q: How would you test V-Pulse's timeout and retry behavior?
Mở đáp án mẫu Q203 — sau khi tự trả lời
TTS 406 · A: The repository includes integration tests that assert instruction state and simulated gateway call counts. One test confirms that a timed-out instruction cannot be replayed just because the rail recovers. Another verifies that a late result cannot overwrite a recovered database state.
Q204 · P0 · PROJECT-SPECIFIC V5.1
TTS 407 · Q: What are the most important limitations of V-Pulse?
Mở đáp án mẫu Q204 — sau khi tự trả lời
TTS 408 · A: Its rails are simulators, so the tests do not prove real payment settlement behavior. Local deduplication and version checks do not guarantee exactly-once payments at a real provider. Reliable real-provider integration would need a provider contract for references, deduplication, status lookup, and reconciliation.
Q205 · P1 · PROJECT-SPECIFIC V5.1
TTS 409 · Q: What happens if an old gateway result arrives after recovery?
Mở đáp án mẫu Q205 — sau khi tự trả lời
TTS 410 · A: Finalization checks that the instruction is still processing and has the expected version. A stale worker cannot overwrite a database state already changed by recovery. This database guard cannot undo an external provider side effect.
Q206 · P1 · PROJECT-SPECIFIC V5.1
TTS 411 · Q: What happens when Redis rate limiting fails in V-Pulse?
Mở đáp án mẫu Q206 — sau khi tự trả lời
TTS 412 · A: The current limiter fails open: it allows requests to continue and records a metric. That favors availability, but it temporarily loses the quota protection. Merchant IDs are normalized for the budget, but choosing an ID is not proof of ownership.
10 — FDE discovery và problem decomposition
Q207 · FOUNDATION · BASE V4
TTS 413 · Q: What makes an acceptance criterion testable?
Mở đáp án mẫu Q207 — sau khi tự trả lời
TTS 414 · A: A testable acceptance criterion has a clear action, condition, and expected result. For example, a valid booking request should return a confirmed result within an agreed target under a defined test load.
Q208 · MECHANISM / WHY · ADD V5
TTS 415 · Q: What is the difference between a business outcome and a technical output?
Mở đáp án mẫu Q208 — sau khi tự trả lời
TTS 416 · A: A technical output is something we build, such as an API or dashboard. A business outcome is the effect, such as fewer manual errors or faster processing. I would define a metric for the outcome.
Q209 · SCENARIO / FOLLOW-UP · BASE V4
TTS 417 · Q: A customer says their booking system is slow. What do you ask first?
Mở đáp án mẫu Q209 — sau khi tự trả lời
TTS 418 · A: I would ask which workflow is slow, when the problem happens, and how many users are affected. Then I would inspect latency metrics, logs, and the business impact before proposing a fix.
Q210 · SCENARIO / FOLLOW-UP · BASE V4
TTS 419 · Q: How would you distinguish symptoms from actual business goals?
Mở đáp án mẫu Q210 — sau khi tự trả lời
TTS 420 · A: A symptom is what users notice, such as a slow screen. The business goal may be faster check-in or fewer staff errors. I would ask what outcome matters and how it will be measured.
Q211 · SCENARIO / FOLLOW-UP · BASE V4
TTS 421 · Q: What if the customer wants to automate everything in the first release?
Mở đáp án mẫu Q211 — sau khi tự trả lời
TTS 422 · A: I would ask the customer to rank the workflows by value and risk. Then I would propose a small MVP that solves the most important problem first and leaves lower-priority automation for later.
Q212 · SCENARIO / FOLLOW-UP · BASE V4
TTS 423 · Q: How would you respond if the assumed root cause is disproved?
Mở đáp án mẫu Q212 — sau khi tự trả lời
TTS 424 · A: I would show the new evidence and revise my hypothesis. Then I would investigate other causes and update the plan. I should not defend an assumption after the data disproves it.
Q213 · SCENARIO / FOLLOW-UP · ADD V5
TTS 425 · Q: How would you start a discovery meeting with a nontechnical client?
Mở đáp án mẫu Q213 — sau khi tự trả lời
TTS 426 · A: I would ask them to walk me through the current process and the main pain point. Then I would clarify who uses the process, how often it fails, and what improvement would matter.
Q214 · SCENARIO / FOLLOW-UP · ADD V5
TTS 427 · Q: How would you define acceptance criteria for a small MVP?
Mở đáp án mẫu Q214 — sau khi tự trả lời
TTS 428 · A: I would write scenarios with clear inputs, conditions, and expected results. I would include at least one failure case and an agreed measure of success. The client should confirm these criteria before delivery.
C — FDE cold cases + changing requirements
Q215 · MECHANISM / WHY · BASE V4
TTS 429 · Q: Choose one cold case from LAB C and explain your first three discovery questions.
Mở đáp án mẫu Q215 — sau khi tự trả lời
TTS 430 · A: I would first ask who uses the workflow and what problem they face. Second, I would ask where the data comes from and which source is trusted. Third, I would ask how we measure success.
Q216 · MECHANISM / WHY · BASE V4
TTS 431 · Q: How do you decide what belongs in an MVP?
Mở đáp án mẫu Q216 — sau khi tự trả lời
TTS 432 · A: I would choose the smallest workflow that delivers measurable value. It needs clear assumptions, a testable result, and a realistic scope. I would defer nonessential features.
Q217 · FOUNDATION · BASE V4
TTS 433 · Q: What is your fallback if the customer data source is unavailable?
Mở đáp án mẫu Q217 — sau khi tự trả lời
TTS 434 · A: I would clarify whether we can use cached data, pause processing, or ask for manual review. I would not silently accept stale or unverified data when correctness matters.
Q218 · FOUNDATION · BASE V4
TTS 435 · Q: Which metric would show business value after deployment?
Mở đáp án mẫu Q218 — sau khi tự trả lời
TTS 436 · A: I would choose a metric linked to the customer’s goal, such as processing time, error rate, or manual work hours. I would measure it before and after deployment under comparable conditions.
Q219 · SCENARIO / FOLLOW-UP · BASE V4
TTS 437 · Q: The interviewer changes one business rule. How do you update the design?
Mở đáp án mẫu Q219 — sau khi tự trả lời
TTS 438 · A: I would restate the new rule and identify which entities, states, APIs, and tests it affects. Then I would update the design and explain any extra cost or risk.
Q220 · SCENARIO / FOLLOW-UP · ADD V5
TTS 439 · Q: The customer changes the source of truth during the interview. What do you do?
Mở đáp án mẫu Q220 — sau khi tự trả lời
TTS 440 · A: I would clarify which source is authoritative and whether it can be delayed or incorrect. Then I would update the data flow, conflict rules, and tests. I would explain the new trade-off before continuing.
Q221 · SCENARIO / FOLLOW-UP · ADD V5
TTS 441 · Q: What if the customer needs a working demo next week?
Mở đáp án mẫu Q221 — sau khi tự trả lời
TTS 442 · A: I would reduce scope to one high-value workflow and reuse reliable existing components. I would identify the riskiest integration early and agree on what the demo must prove.
Q222 · SCENARIO / FOLLOW-UP · ADD V5
TTS 443 · Q: How would you prioritize two competing customer requests?
Mở đáp án mẫu Q222 — sau khi tự trả lời
TTS 444 · A: I would compare their business impact, urgency, implementation cost, and dependencies. If priorities still conflict, I would ask the customer to decide based on explicit trade-offs.
11 — Technical English, project story, DSA explanation
Q223 · PROJECT TEMPLATE · BASE V4
TTS 445 · Q: Tell me about one backend project in 60 seconds.
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q223 — sau khi tự trả lời
TTS 446 · A: For practice, I would describe a Java backend project that handles business requests. I would explain the user problem, the main API flow, and one technical decision. I would only claim work that I actually did.
Q224 · MECHANISM / WHY · BASE V4
TTS 447 · Q: Explain one bug and how you verified the fix.
Mở đáp án mẫu Q224 — sau khi tự trả lời
TTS 448 · A: I would explain how I reproduced the bug, what caused it, and what I changed. Then I would describe the test and its actual result. I would not claim the fix worked without evidence.
Q225 · MECHANISM / WHY · BASE V4
TTS 449 · Q: Walk me through one DSA solution and its time complexity.
Mở đáp án mẫu Q225 — sau khi tự trả lời
TTS 450 · A: First, I would explain the input and expected output. Then I would describe the main steps and data structure. Finally, I would give the time and space complexity and explain why.
Q226 · PROJECT TEMPLATE · BASE V4
TTS 451 · Q: Which parts did you personally implement?
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q226 — sau khi tự trả lời
TTS 452 · A: I would name the classes, features, and tests I personally worked on. For everything else, I would say that I reviewed or learned from it rather than claiming ownership.
Q227 · PROJECT TEMPLATE · ADD V5
TTS 453 · Q: What problem does your project solve?
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q227 — sau khi tự trả lời
TTS 454 · A: I would start with the user problem and the workflow the project supports. Then I would name the main backend responsibility and a result I can actually demonstrate. I would replace this practice outline with facts from my own project.
Q228 · PROJECT TEMPLATE · ADD V5
TTS 455 · Q: How can you prove which parts you personally implemented?
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q228 — sau khi tự trả lời
TTS 456 · A: I would name the endpoints, services, queries, or tests I wrote myself. I would separate my work from team contributions. I would be ready to open the relevant code and explain one decision.
Q229 · PROJECT TEMPLATE · ADD V5
TTS 457 · Q: Walk me through one important request from UI to database.
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q229 — sau khi tự trả lời
TTS 458 · A: First, the client sends a request to an endpoint. The controller validates the input, and the service applies business rules. The repository accesses the database, and the API returns a result. For my real project, I must describe the actual classes and flow.
Q230 · PROJECT TEMPLATE · ADD V5
TTS 459 · Q: Why did you choose this database/cache/framework?
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q230 — sau khi tự trả lời
TTS 460 · A: I would connect the choice to a requirement such as relational consistency or read performance. Then I would explain one alternative and one trade-off. I would only say I chose a tool if I actually participated in that decision.
Q231 · PROJECT TEMPLATE · ADD V5
TTS 461 · Q: What happens if an external API times out?
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q231 — sau khi tự trả lời
TTS 462 · A: A timeout may leave the operation's result unknown. I would describe the actual error handling, retries, and status checks implemented in my code. If those protections are missing, I would state that honestly as a limitation.
Q232 · PROJECT TEMPLATE · ADD V5
TTS 463 · Q: How do you protect against duplicate or concurrent operations?
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q232 — sau khi tự trả lời
TTS 464 · A: I would identify the business invariant and show where the system enforces it. Possible mechanisms include a unique constraint, an atomic update, or persistent idempotency handling. I would describe only the mechanism that exists in my project.
Q233 · PROJECT TEMPLATE · ADD V5
TTS 465 · Q: What is one difficult bug you encountered? How did you debug it?
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q233 — sau khi tự trả lời
TTS 466 · A: I would explain the symptom, how I reproduced it, and what evidence revealed the cause. Then I would describe the fix and the test that prevented a regression. I need a real example rather than an invented story.
Q234 · PROJECT TEMPLATE · ADD V5
TTS 467 · Q: If you were to build it again, what would you improve?
Cần cá nhân hóa: Câu trả lời sau chỉ là khung học từ vựng/cách triển khai ý, không mô tả kinh nghiệm có thật.
Mở đáp án mẫu Q234 — sau khi tự trả lời
TTS 468 · A: I would choose one concrete limitation supported by the current code. Then I would propose a small improvement and explain its benefit and cost. I would avoid promising a complete redesign without evidence.
Q235 · SCENARIO / FOLLOW-UP · BASE V4
TTS 469 · Q: If you had one more week, what would you improve and why?
Mở đáp án mẫu Q235 — sau khi tự trả lời
TTS 470 · A: I would improve the highest-risk part first, based on evidence from tests or measurements. I would explain why that change matters and how I would verify it.
Q236 · SCENARIO / FOLLOW-UP · ADD V5
TTS 471 · Q: How would you explain Two Sum and its time complexity?
Mở đáp án mẫu Q236 — sau khi tự trả lời
TTS 472 · A: The goal is to find two indices whose values add up to a target. A hash map lets us look up the needed complement in expected O(n) time with O(n) extra space. I would test duplicate values and negative numbers.
CASE LAB — Cross-project
Q237 · P0 · CROSS-PROJECT V5.1
TTS 473 · Q: How is the concurrency problem different in V-Market and V-Core?
Mở đáp án mẫu Q237 — sau khi tự trả lời
TTS 474 · A: V-Market locks inventory so two different checkouts cannot oversell stock. V-Core locks a column so task moves cannot exceed its WIP limit, while task versions detect stale edits. Both protect shared business invariants at the database boundary.
Q238 · P0 · CROSS-PROJECT V5.1
TTS 475 · Q: How are retries different between V-Market checkout and V-Pulse payment attempts?
Mở đáp án mẫu Q238 — sau khi tự trả lời
TTS 476 · A: V-Market reuses the checkout operation key to recover an existing order without deducting stock again. V-Pulse also deduplicates create requests, but a new gateway attempt needs separate permission. A payment timeout can leave the external outcome unknown, so blind replay is unsafe.
Q239 · P0 · CROSS-PROJECT V5.1
TTS 477 · Q: Which project would you discuss for Java Backend concurrency versus FDE integration?
Mở đáp án mẫu Q239 — sau khi tự trả lời
TTS 478 · A: For Java Backend concurrency, I would use V-Market's stock-locking checkout or V-Core's WIP rule. For FDE integration and uncertain downstream outcomes, I would use V-Pulse's simulated gateway workflow. I would choose the example I can explain from code and tests, without overstating my personal contribution.
D — Listening blind + unfamiliar Java + on-the-job learning
Q240 · MECHANISM / WHY · BASE V4
TTS 479 · Q: Look at a Java method you have never seen. How do you understand it?
Mở đáp án mẫu Q240 — sau khi tự trả lời
TTS 480 · A: First, I would read the method name, parameters, and return type. Then I would trace the main branches and dependencies. Finally, I would run or write small tests to confirm my understanding.
Q241 · MECHANISM / WHY · BASE V4
TTS 481 · Q: How do you distinguish a missing requirement from a bug?
Mở đáp án mẫu Q241 — sau khi tự trả lời
TTS 482 · A: A missing requirement means the expected behavior was not clearly defined. A bug means the implementation does not meet an agreed requirement. I would confirm the expected behavior with the team.
Q242 · SCENARIO / FOLLOW-UP · BASE V4
TTS 483 · Q: What would you ask before integrating an unfamiliar API?
Mở đáp án mẫu Q242 — sau khi tự trả lời
TTS 484 · A: I would ask about authentication, request and response formats, errors, rate limits, and retry rules. I would also confirm whether repeated calls can create duplicate side effects.
Q243 · SCENARIO / FOLLOW-UP · BASE V4
TTS 485 · Q: What if the API documentation contradicts actual behavior?
Mở đáp án mẫu Q243 — sau khi tự trả lời
TTS 486 · A: I would reproduce the actual behavior with a small request and record the evidence. Then I would ask the provider to clarify the contract and make our integration handle the verified behavior safely.
Q244 · SCENARIO / FOLLOW-UP · BASE V4
TTS 487 · Q: What test would you write before refactoring the method?
Mở đáp án mẫu Q244 — sau khi tự trả lời
TTS 488 · A: I would write a characterization test for the current behavior, including important edge cases. Then I would refactor and run the tests again to check that behavior did not change unexpectedly.
Q245 · SCENARIO / FOLLOW-UP · ADD V5
TTS 489 · Q: The interviewer speaks too quickly. What would you say?
Mở đáp án mẫu Q245 — sau khi tự trả lời
TTS 490 · A: Could you repeat the last part a little more slowly, please? I want to make sure I understood the requirement before answering.
Q246 · SCENARIO / FOLLOW-UP · ADD V5
TTS 491 · Q: How would you explain unfamiliar Java code before changing it?
Mở đáp án mẫu Q246 — sau khi tự trả lời
TTS 492 · A: I would identify the inputs, outputs, main branches, and side effects. Then I would run a small example and check edge cases. I would change one behavior at a time and rerun tests.
Q247 · SCENARIO / FOLLOW-UP · ADD V5
TTS 493 · Q: How would you learn a new backend library for an urgent task?
Mở đáp án mẫu Q247 — sau khi tự trả lời
TTS 494 · A: I would start with official documentation and a small working example. Then I would integrate the minimum required feature and write tests for important behavior. I would ask for review where the risk is high.
12 — Integrated design cases
Q248 · MECHANISM / WHY · BASE V4
TTS 495 · Q: Choose one integrated case: explain your assumptions and design.
Mở đáp án mẫu Q248 — sau khi tự trả lời
TTS 496 · A: I would clarify the actors, main entities, and one important business rule. Then I would describe the API, database flow, and an error case. I would test the basic flow before adding more complexity.
Q249 · FOUNDATION · BASE V4
TTS 497 · Q: Which business invariant is most important in your solution?
Mở đáp án mẫu Q249 — sau khi tự trả lời
TTS 498 · A: The most important invariant depends on the case. For a booking system, the same room must not be allocated to two active bookings for the same night. I would enforce this at the database boundary.
Q250 · SCENARIO / FOLLOW-UP · BASE V4
TTS 499 · Q: What would you change if the interviewer added an external system?
Mở đáp án mẫu Q250 — sau khi tự trả lời
TTS 500 · A: I would clarify the external API contract and failure behavior. Then I would add a separate integration component, timeouts, and a way to check uncertain results without creating duplicates.
Q251 · SCENARIO / FOLLOW-UP · BASE V4
TTS 501 · Q: Where would you enforce data consistency?
Mở đáp án mẫu Q251 — sau khi tự trả lời
TTS 502 · A: I would enforce important local invariants in the database through suitable constraints or atomic operations. The service also validates business rules, but application checks alone may not handle concurrency.
Q252 · SCENARIO / FOLLOW-UP · BASE V4
TTS 503 · Q: How would you show the solution works without claiming zero bugs?
Mở đáp án mẫu Q252 — sau khi tự trả lời
TTS 504 · A: I would show tests for normal requests, invalid inputs, and concurrent conflicts. I would also report observed results and limitations. Tests provide evidence, but they cannot prove the absence of all bugs.
Q253 · SCENARIO / FOLLOW-UP · ADD V5
TTS 505 · Q: How would you design a simple course enrollment API from scratch?
Mở đáp án mẫu Q253 — sau khi tự trả lời
TTS 506 · A: I would clarify the actors, the capacity rule, and whether students may enroll twice. Then I would model Enrollment, define an endpoint, and protect capacity in the database. I would test two students competing for the last seat.
Q254 · SCENARIO / FOLLOW-UP · ADD V5
TTS 507 · Q: What do you do if two services cannot commit atomically?
Mở đáp án mẫu Q254 — sau khi tự trả lời
TTS 508 · A: I would not assume one local transaction covers both services. I would define the required consistency level and use an appropriate workflow with status tracking and compensation or reconciliation. Then I would test partial failures.
13 — Mock interview + oral delivery
Q255 · MECHANISM / WHY · BASE V4
TTS 509 · Q: Explain a technical concept from a randomly selected module in 45 seconds.
Mở đáp án mẫu Q255 — sau khi tự trả lời
TTS 510 · A: A database transaction groups related operations into one logical unit. It can make local changes succeed or fail together. For example, booking creation and inventory updates should remain consistent.
Q256 · MECHANISM / WHY · BASE V4
TTS 511 · Q: Defend a design choice and name one trade-off.
Mở đáp án mẫu Q256 — sau khi tự trả lời
TTS 512 · A: I would use a modular monolith for a small MVP because it is easier to build and deploy. The trade-off is that individual components are harder to scale or deploy independently.
Q257 · FOUNDATION · BASE V4
TTS 513 · Q: Handle one unexpected follow-up without looking at notes.
Mở đáp án mẫu Q257 — sau khi tự trả lời
TTS 514 · A: I would clarify the changed requirement before answering. Then I would explain what part of the design changes, why it changes, and which new test I would add.
Q258 · FOUNDATION · BASE V4
TTS 515 · Q: What evidence would change your decision?
Mở đáp án mẫu Q258 — sau khi tự trả lời
TTS 516 · A: I would change my decision if measurements showed a different bottleneck or if business requirements changed. For example, very high independent load might justify separating one service.
Q259 · MECHANISM / WHY · BASE V4
TTS 517 · Q: Could you explain the same answer in simpler English for a non-engineer?
Mở đáp án mẫu Q259 — sau khi tự trả lời
TTS 518 · A: I would explain that the system first checks whether a room is free, then saves the reservation. It must prevent two customers from getting the same room for the same night.
Q260 · SCENARIO / FOLLOW-UP · ADD V5
TTS 519 · Q: How would you answer a question whose assumptions are incomplete?
Mở đáp án mẫu Q260 — sau khi tự trả lời
TTS 520 · A: I would state the missing information and ask one focused clarification. If no answer is available, I would make a reasonable assumption and label it. Then I would explain how the design changes if the assumption is wrong.
Q261 · SCENARIO / FOLLOW-UP · ADD V5
TTS 521 · Q: How would you respond when an interviewer challenges your design choice?
Mở đáp án mẫu Q261 — sau khi tự trả lời
TTS 522 · A: I would listen to the new constraint and compare it with my original assumption. Then I would explain whether I would keep or change the design and what trade-off follows. I would not defend a choice simply because I made it first. ---