JAVA BACKEND / LISTEN & LEARN
Đến TTS 001 ↓
Mục lục bài học

JAVA BACKEND + FDE — INTERVIEW FOUNDATION V5.2: LEARN → BUILD → SPEAK

V5.2, cập nhật 18/10/2026. Giữ các bài kiến thức/code/SQL từ V4 và tổ chức lại 261 cặp Q&A xen ngay từng chủ đề; không dồn 225 + 36 câu xuống cuối.

Nguồn: V4/V5.1 và ba file Project Deep Dive người học cung cấp. Các project là bản mô tả code; chưa xác minh độc lập repository hoặc đóng góp cá nhân.

Giáo trình nền (17/10/2026). Nội dung kỹ thuật V3.2 phía dưới được giữ nguyên để bảo toàn ví dụ, bài code/SQL, đáp án, checklist và phạm vi chuyên môn. V4 bổ sung lớp thực hành Speaking Lab vào 20 mô-đun/lab. Các đoạn hội thoại/mẫu trả lời V4 là bài luyện mới biên soạn theo nội dung V3.2, không phải câu hỏi phỏng vấn chính thức của công ty.

Mục tiêu: (1) hiểu và thực hành Java Backend/FDE; (2) hiểu câu hỏi tiếng Anh nói thành tiếng; (3) tự trả lời rõ ràng không đọc script; (4) xử lý follow-up bất ngờ. Không học tiếng Anh bằng cách thuộc lòng 100 đoạn văn.

ĐÁNH SỐ ĐỂ TẠO TTS — 261 cặp, 522 mục đọc

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.

ĐIỀU HƯỚNG V5.2 — học xen kẽ trong cùng một chủ đề

Nguyên tắc: không đọc hết lý thuyết rồi mới sang tập nói. Mở một bài theo dòng PRETEST → WATCH → COMPLETE/DO → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → FEEDBACK. Đáp án Q&A đều nằm dưới mục mở rộng, không hiện sẵn khi đọc lướt. 261 câu không phải 261 bài phải thuộc lòng.

Cách đọc: phần câu hỏi hiện ra trước; bấm vào dòng Mở đáp án mẫu sau khi đã nói. Ở bản đánh số này, mỗi mục TTS nằm trên một dòng, kể cả khi đáp án có nhiều câu; số thứ tự khớp hoàn toàn với bản Q&A riêng.


HƯỚNG DẪN BẮT ĐẦU — đọc 1 lần, rồi học theo module

A. Học thế nào để không gấp đôi thời gian?

Mỗi buổi học 40–55 phút dùng một bài kỹ thuật bên dưới và Speaking Lab ở CUỐI bài đó. Không phải học xong toàn bộ tài liệu rồi mới học tiếng Anh.

Bước Phút Việc thực hiện Đầu ra quan sát được
1. PRETEST 3–4 Che lời giải; thử hiểu đề và nêu 1–2 ý bằng tiếng Việt Biết chỗ hổng kiến thức
2. WATCH 8–12 Đọc ví dụ từ nguồn V3.2; truy vết logic/code; hiểu vì sao Nói lại được ý bằng tiếng Việt
3. COMPLETE → DO 12–15 Điền thiếu → làm bài biến thể không nhìn đáp án Có output kỹ thuật độc lập
4. LISTEN → SHADOW 4–5 Dùng TTS/Voice đọc 2 câu trong Speaking Lab, nghe không nhìn; bắt chước 2 lần Nhận được âm và nhịp câu
5. SPEAK → REPEAT 8–12 Trả lời câu cold; ghi âm; cùng ý nói lại 2–3 lần Nói không đọc ở 2–4 câu rồi 45–90 giây
6. FEEDBACK + LOG 3–5 Sửa 1 lỗi kiến thức + 1 lỗi diễn đạt nếu có Có câu sửa và lịch ôn

Nếu chỉ có 25 phút: 5' ôn source + 8' DO + 4' nghe/nhại + 6' cold speaking + 2' ghi lỗi. Nếu dư thời gian: luyện hội thoại đời thường 5–10 phút và ôn một bài cũ. Không bỏ DO để chỉ tập nói một đáp án sai.

B. Một thang độ khó cho tất cả chủ đề

Chưa đạt L1 thì không ép nói 4 phút. Với người đang giao tiếp cơ bản: bắt đầu chu kỳ 60 → 45 → 30 giây cho cùng một câu hỏi. Khi đã nói liền mạch, dùng 2 phút → 90 giây → 60 giây; khi đủ khả năng duy trì ý, mới thử 4/3/2. Giảm thời lượng không đồng nghĩa cố nói thật nhanh; phải giữ những ý kỹ thuật thiết yếu.

C. Vòng nói 5 lượt để biến từ vựng thụ động thành phản xạ

  1. LISTEN: che transcript; nghe câu hỏi 1 lượt bằng Voice/TTS; nói bằng tiếng Việt câu hỏi đang muốn gì. Nghe lại nếu cần.
  2. SHADOW: nhìn 1–2 câu mẫu, nghe và bắt chước âm, stress, ngắt cụm 2 lần. Shadowing không thay thế tự trả lời.
  3. RETRIEVE: che tài liệu, tự gọi lại 3–5 từ khóa (transaction, rollback, consistency...), giải thích chúng bằng một câu.
  4. FREE SPEAK: nhấn thu âm, tự nói 30–90 giây theo ý hiểu. Nếu quên từ: dùng câu dễ hơn; đừng chuyển toàn bộ sang tiếng Việt.
  5. FEEDBACK → REPEAT → TRANSFER: mở mẫu sau khi nói, sửa 1–2 điểm, nói lại; trả lời một câu biến thể chưa chuẩn bị. Transfer là phần chống học vẹt.

D. Khung câu ít nhưng đa năng (dùng được trên toàn file)

Interviewer muốn Cấu trúc Mẫu dễ nói
Definition X is... It is used to... For example... A transaction is a group of database operations. It helps keep updates consistent.
Mechanism First... Then... Finally... If... First, the controller validates the request. Then the service applies business rules.
Compare X is... while Y... I would use X when... An interface defines a contract, while an abstract class can share state and implementation.
Design Before designing, I'd clarify... For an MVP, I'd... Before designing, I'd clarify the booking rules. For an MVP, I'd keep one backend service.
Failure The problem is... This can happen when... I'd verify... The problem may be a duplicate retry. I'd verify it with request IDs and database records.
Trade-off I chose... because... The downside is... I'd choose a modular monolith for a small MVP because it is simpler to deploy.
Test I'd test... I would expect... I'd send two concurrent requests. I would expect only one successful reservation.

Câu để câu giờ/hỏi lại: Could you repeat the last part? · Could you rephrase the question? · Do you mean X or Y? · May I take a moment to think? · Let me correct my answer. · I'm not sure about that detail; here's how I would verify it.

E. Cách dùng ChatGPT Voice hoặc một đối tác luyện tập

Dán prompt dưới đây trước một buổi speaking. Không yêu cầu AI đưa đáp án khi bạn chưa nói.

You are my technical English speaking coach. My current level is basic conversational English.
Focus on Java Backend and software-oriented Forward Deployed Engineer interviews.
Today's module: [PASTE MODULE NAME].
Ask ONE question at a time; do not show or read a model answer before I reply.
Start with a simple definition (20–40 seconds), then ask a how/why question,
then ask ONE unpredictable follow-up or change one requirement.
If I do not understand, first rephrase the question in simpler English.
Do not interrupt me for minor errors. After I finish, give feedback in this order:
(1) technical correctness, (2) clarity/organization, (3) two useful language corrections,
(4) one more natural short alternative, (5) ask me to answer again without a script.
Do not invent work experience for me. End with one new transfer question.

Cách làm listening blind: yêu cầu người đọc/AI chỉ đọc câu hỏi, không hiển thị câu hỏi dạng chữ nếu giao diện cho phép; người học nói lại ý yêu cầu trước khi trả lời. TTS có thể đọc với tốc độ vừa phải; tăng tốc dần sau khi hiểu.

F. Cách chấm: tách kỹ thuật khỏi tiếng Anh

Trục 0 1 2 3
K — Technical correctness Sai bản chất Nhớ thuật ngữ nhưng thiếu cơ chế Đúng ý, có ví dụ Đúng + failure/trade-off/test phù hợp
S — Spoken independence Không nói được Đọc mẫu / lệ thuộc câu có sẵn Tự nói 2–4 câu dễ hiểu Tự nói 60–90s và trả lời follow-up
L — Listening Không hiểu cả khi nhắc Hiểu sau khi đọc chữ Nghe được câu rõ/chậm Nghe câu mới, tóm tắt và hỏi lại khi cần

Chỉ chuyển mô-đun khi: K ≥ 2, S ≥ 2, hiểu ít nhất 2/3 câu nghe liên quan (L ≥ 2 nếu tự luyện được audio), và giải được bài DO/biến thể ở tài liệu gốc. Không cần phát âm như người bản ngữ. Nếu K thấp hãy quay lại kiến thức; nếu K tốt mà S thấp hãy tăng lượt trả lời/nhận sửa, không đọc lại cả chương.

Ghi lỗi: term (không hiểu từ), concept (không hiểu kỹ thuật), reasoning (không giải thích được), listening (không bắt âm), retrieval (biết nhưng không nhớ khi nói), fluency (dừng quá lâu), pronunciation (nghe không rõ), grammar (lỗi gây hiểu nhầm). Chỉ sửa tối đa 2–3 lỗi trong một lượt nói.

G. Ôn giãn cách và bài hội thoại đời thường

Các mốc ôn là lịch đề xuất, có thể điều chỉnh theo error log; không phải khoảng cách tối ưu cho mọi người.

H. Ví dụ hoàn chỉnh — đọc 1 lần trước khi dùng Speaking Labs

Tình huống: A user clicks Book twice after a timeout. Could this create two bookings?

  1. Hiểu bằng tiếng Việt: Timeout không chứng minh server thất bại. Retry có thể lặp side effect của POST; cần cơ chế chống trùng và kiểm tra kết quả cũ.
  2. 3 chunks: the response was lost (phản hồi bị mất), retry the request (thử lại), idempotency key (khóa chống lặp hiệu ứng).
  3. Shadow 2 câu: A timeout does not necessarily mean that the server failed. / I would use an idempotency key to prevent duplicate bookings.
  4. Guided speaking: The server may have . If the client , it may create . I would .
  5. Free speaking: trả lời 30–45 giây không nhìn; ghi âm. Sau đó đọc mẫu 1 lần rồi nói lại.
  6. Mẫu tham khảo (mở sau khi tự nói):
Sample response — chỉ mở sau khi tự trả lời

A timeout does not mean the booking failed. The server may have created the booking, but the response did not reach the client. If we blindly retry the request, we might create a duplicate. I would use an idempotency key and let the client check the booking status.

  1. Transfer (câu mới): What changes if the booking service calls an external room provider? Trả lời dựa trên giới hạn của local transaction, không lặp lại nguyên văn mẫu.

KIẾN THỨC GỐC V3.2 + SPEAKING LABS TÍCH HỢP

Tài liệu gốc V3.2 được giữ nguyên bên dưới (ngoại trừ tiêu đề chính được hiển thị như một tiêu đề nội dung). Mỗi mô-đun có SPEAKING LAB V5.2 sát phần lý thuyết; 04, 08A và 08B có thêm MICRO SPEAK sau từng tiểu mục. Mọi đáp án Q&A và mẫu trả lời dài V4 được đặt ngay tại chủ đề, dưới mục có thể mở sau khi tự nói.

JAVA BACKEND + FDE — INTERVIEW FOUNDATION V3.2

Phiên bản mở rộng V3.2, 17/10/2026 (kế thừa V3.1). Dành cho Intern/Fresher/Junior đang đồng thời ứng tuyển Java Backend và Forward Deployed Engineer (thiên về Software Engineering). Giải thích bằng tiếng Việt, giữ câu hỏi phỏng vấn bằng tiếng Anh. Không phải đề chính thức hoặc cam kết vượt phỏng vấn.

Điểm mới từ V3.1 lên V3.2: thêm 08A Java Core/OOP, 08B Spring Boot/JPA và LAB 08C Java–SQL–English theo PRETEST → WATCH → COMPLETE → DO → EXPLAIN; giữ nguyên các mô-đun CS, LLD, FDE và mock cũ.

Điểm mới so với V3: học thành bài nhỏ hơn; ví dụ mẫu → bài điền khuyết → bài biến thể chưa thấy → câu hỏi follow-up; luyện nghe–nói có quy trình; bài đọc/sửa Java/JSON lạ; FDE case đổi yêu cầu; bài mock suy luận khó hơn; có dấu mốc để biết có nên chuyển bài.

START HERE — Mục tiêu và thứ tự học

Bạn không bắt đầu từ số 0 về lập trình: Java Core, Spring Boot, OOP, SQL, DSA Easy đã quen. Nhưng bạn đang học từ cơ bản về design/decomposition và tiếng Anh kỹ thuật chưa thành phản xạ. Vì vậy:

Bản đồ nội dung — đi theo đường học, không theo số môn CS

Thứ tự Mô-đun trong file Bạn ra khỏi mô-đun khi... Vai trò
1 01. Bức tranh hệ thống phân biệt requirement / data / rules / flow Chung
2 02. English: nhận diện câu hỏi hiểu đúng 8/10 prompts mới Chung
3 LAB A — Entities → Rules → API tự tách được một tính năng rất nhỏ Chung
4 03. LLD User Registration tự thiết kế một biến thể không nhìn mẫu Chung
5 04. SQL / Transaction giải thích hai request cạnh tranh và test Chung
6 05. HTTP / Network truy vết một request + timeout/retry Chung
7 06. OS / Concurrency / JVM lý giải race/deadlock ở mức cơ bản Chung
8 07. LLD Booking states, API, consistency và failure Chung
9 08. Testing / Cloud / Java recap làm đề chẩn đoán; chỉ đào sâu câu sai Tham khảo
10 08A. Java Core + OOP Interview [NEW] giải thích static/equality/Collections/OOP/concurrency + code độc lập Java P0
11 08B. Spring Boot + JPA/Hibernate [NEW] tự trace request, phân biệt transaction/locking, xử lý N+1 Java P0
12 LAB 08C. Java–SQL–English [NEW] làm case lạ, code/query và nói ngắn không nhìn đáp án Java P0
13 09. Basic System Design thiết kế MVP + 3 lựa chọn có lý do Chung
14 LAB B — Debug & Integration trace được lỗi, chọn phương án khắc phục Chung
15 10. FDE Decomposition discovery → scope → demo/acceptance FDE
16 LAB C — FDE Cold Cases làm case mới khi interviewer đổi yêu cầu FDE
17 11. Technical English thực chiến nói 60–90 giây, xử lý follow-up Chung
18 LAB D — Learning/Coding/Listening đọc/sửa code lạ, nghe câu hỏi không nhìn trước Chung
19 12. Bài tập tổng hợp độc lập làm case, không cần gợi ý Chung
20 13. Mock cũ + HARD MOCK mới biết chính xác lỗ hổng sau khi làm đề mới Chung

Nếu chỉ còn 2–3 ngày: - JD Java Backend: ưu tiên 02 → 08A (DO/MOCK) → 08B (DO/MOCK) → 04 → V-Market P0 → LAB 08C → LAB D → HARD MOCK. Chỉ mở lại WATCH ở câu sai. - JD FDE: dùng tuyến gốc 02 → LAB A → 03 → 07 → 09 → 10 → LAB C → 11 → LAB D → HARD MOCK; bổ sung 08A/08B theo JD. - DSA coding: file này không thay luyện Medium thực tế; ôn có chọn lọc ngoài file, nhất là trước online assessment.

Lối học ưu tiên cho Java Backend 0–1 năm [V3.2]

Bạn đã biết Java/SQL/Spring ở mức cơ bản nhưng đang yếu technical English, CS/LLD và project. Không cần đọc mọi mô-đun cùng độ sâu:

  1. Mỗi ngày 15–25 phút: Mô-đun 02 + 11/LAB D luyện nghe và trả lời câu kỹ thuật mới bằng tiếng Anh.
  2. Kiến thức nghề P0: Mô-đun 08A → 08B → LAB 08C, trước đó xem lại Mô-đun 04 nếu thiếu SQL/transaction. Học WATCH nếu chưa hiểu; nếu làm DO tốt thì nhảy MOCK.
  3. Một project sâu: V-Market Deep Dive theo one flow → why → failure → test; đọc source thật, bổ sung kinh nghiệm internship đã triển khai. V-Core/V-Pulse chỉ đào sâu theo JD.
  4. CS/LLD ứng dụng: LAB A → Mô-đun 03 → 07 → 09; Mô-đun 05–06 và 08.2/08.3 chỉ đào sâu nếu test cho thấy thiếu.
  5. FDE là nhánh riêng: Mô-đun 10 + LAB C khi ứng tuyển FDE/AI-first; không ép người chỉ phỏng vấn Java học hết nhánh này trước.
  6. DSA Medium có chọn lọc bên ngoài file: duy trì 20–30 phút theo pattern, rồi tập trung bộ bài phù hợp nếu đã có lịch OA; không dựa vào “học tủ chính xác đề”.

Thứ tự luyện trong một buổi: tự thử câu chưa từng xem → nếu bí thì đọc ví dụ → tự code/giải bài biến thể → nói tiếng Anh 30–60 giây → ghi lỗi. Đạt checkpoint thì chuyển, không đọc lại để đủ trang.

Cách học một bài: 35–45 phút, không quá tải

  1. PRETEST (3 phút): che đáp án, thử hai câu đơn giản. Nếu làm được, đọc nhanh ví dụ và chuyển bài thử.
  2. WATCH (8 phút): đọc một lời giải từng bước; sau mỗi bước giải thích "vì sao" bằng tiếng Việt.
  3. COMPLETE (8 phút): bài tương tự nhưng thiếu một số bước; mở gợi ý một nếu bí sau 2–3 phút.
  4. DO (12 phút): đề biến thể hoặc cold question; không dùng AI/đáp án.
  5. EXPLAIN (5 phút): nói tiếng Anh câu trả lời 30–60 giây, ghi âm nếu có thể; đánh giá đúng ý → cấu trúc → dễ hiểu trước khi sửa ngữ pháp.
  6. ERROR LOG (2 phút): sai vì term / concept / reasoning / implementation / English / nerves? Chỉ ôn đúng loại lỗi.

Mức qua bài (tiêu chuẩn tự học, không phải chuẩn công ty): - Recognize: giải thích được nghĩa thuật ngữ khi gặp. - Explain: không nhìn tài liệu, nói được nguyên lý và ví dụ. - Apply: xử lý một đề đã đổi yêu cầu, vẫn giữ được business invariant. - Interview: nêu assumptions, reasoning, trade-off, tests; nói bằng tiếng Anh dễ hiểu.

Với CS rộng chỉ cần Explain; với LLD, decomposition và technical English phải cố đạt Apply/Interview.

Retrieval + spaced practice (ôn mà không đọc lại cả file)

Lúc ôn Chỉ làm gì?
Kết thúc buổi Viết 3 ý chính từ trí nhớ, làm 1 câu mới
Ngày tiếp theo Trả lời lại 2 câu sai; không đọc lý thuyết nếu đúng
Sau khoảng 3 ngày 1 case biến thể + 1 câu giải thích tiếng Anh
Sau khoảng 7 ngày Mini mock ngẫu nhiên từ nhiều mô-đun

Các mốc trên là lịch thực dụng. Nguyên tắc hỗ trợ bởi nghiên cứu về worked examples, retrieval practice, distributed practice; xem mục Tài liệu tham khảo cuối file.

Bài chẩn đoán 8 phút — làm trước khi đọc

Không cần ghi đáp án hoàn hảo. Viết ngắn và đánh dấu chỗ bí:

  1. A user clicks Book twice and receives a timeout. Did the server necessarily fail? Tại sao?
  2. Design an API to borrow one library copy. Bạn cần hỏi lại điều gì trước?
  3. Explain one difference between an entity and a service.
  4. An operator says imports sometimes create duplicated products. Bạn cần hỏi gì trước khi đề xuất sửa?
  5. Walk me through a request from browser to database. Nói trong 30 giây.
  6. Nhìn câu Java count++; chạy từ hai threads: có thể sai ở đâu?

Định hướng: bí (2)/(3) → LAB A; bí (1)/(6) → transaction/OS modules; bí (4) → FDE decomposition; hiểu mà không nói được (5) → English modules. Đây là bài phân loại lỗ hổng, không phải bài thi chấm điểm.


CHẶNG I — CƠ BẢN VỀ REQUIREMENTS VÀ TIẾNG ANH


MÔ-ĐUN 01 [CORE] — “Thiết kế hệ thống” thực ra là làm gì?

01.1. Bắt đầu bằng một câu chuyện không có thuật ngữ

Một khách gọi khách sạn: “Tôi muốn đặt phòng ngày 20–22/10”. Nhân viên sẽ:

  1. Hỏi ngày, số khách, loại phòng.
  2. Kiểm tra phòng có còn trống trong toàn bộ khoảng ngày không.
  3. Cho khách biết giá và điều kiện.
  4. Ghi nhận booking.
  5. Xác nhận hoặc chuyển nhân viên duyệt.

Chuyển sang hệ thống phần mềm:

Người dùng (UI)
   ↓ HTTP request
Backend API (Controller)
   ↓
Business logic (Service): kiểm tra dữ liệu, ngày, giá, quyền, trạng thái
   ↓
Database / external room provider
   ↓
Service quyết định kết quả
   ↓
HTTP response → UI

Bạn đã biết Spring Boot nên nhiều khối này không mới. Phần mới là học trả lời năm câu:

  1. WHAT: Chức năng cần làm gì? (functional requirement)
  2. WHO/WHEN: Ai dùng và khi nào được làm? (actor / business rules)
  3. HOW: Dữ liệu và API đi qua những đâu? (components / data flow)
  4. WHAT IF: Nếu dữ liệu sai, hai người thao tác cùng lúc, service bên ngoài chết thì sao? (failure cases)
  5. WHY: Vì sao chọn cách A thay vì B? (trade-off)

Phân biệt từ đầu: LLD quan tâm chi tiết entities/classes/methods/APIs; basic system design quan tâm components, data flow, storage và những thuộc tính như reliability; problem decomposition bắt đầu sớm hơn: khách hàng chưa biết rõ cần xây cái gì.

01.2. Từ yêu cầu đến mô tả rõ ràng

Yêu cầu mơ hồ: “Xây chức năng booking”.

Làm rõ thành: - Actor: Customer, Staff. - Input: arrival date, departure date, room type, guest count. - Rules: departure > arrival; không chấp nhận hết phòng; booking cần duyệt nếu quy trình yêu cầu. - Output: booking ID + trạng thái hoặc lý do từ chối. - Error: room unavailable, malformed dates, downstream timeout.

Worked example — trả lời tiếng Anh chỉ 3 câu:

First, I would clarify who uses the feature and what the booking rules are. Then I would define the main entities and APIs. Finally, I would consider invalid requests, concurrent bookings, and how we verify the result.

Tự kiểm tra (che phần trên): Nếu khách hỏi “cho phép huỷ phòng”, bạn nêu được 2 câu làm rõ + 2 business rules không?

Đáp án tham khảo

🎙️ SPEAKING LAB V5.2 — 01. Requirements, rules và request flow

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Functional requirement; business rule; component/data flow; failure case; trade-off.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
clarify the requirement làm rõ yêu cầu
apply business rules áp dụng quy tắc nghiệp vụ
handle an invalid request xử lý yêu cầu không hợp lệ
verify the result kiểm chứng kết quả

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. First, I would clarify the booking requirements.
  2. Then I would define the data flow and possible failure cases.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

A booking feature needs . The service checks . If , the API should .

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 4 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q001 · MECHANISM / WHY · BASE V4

TTS 001 · Q: What is the difference between a requirement and a business rule?

TTS 001 · Câu hỏi
Tải MP3 001
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.

TTS 002 · Đáp án
Tải MP3 002
Q002 · MECHANISM / WHY · BASE V4

TTS 003 · Q: Walk me through a simple booking request.

TTS 003 · Câu hỏi
Tải MP3 003
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.

TTS 004 · Đáp án
Tải MP3 004
Q003 · FOUNDATION · ADD V5

TTS 005 · Q: What is a functional requirement?

TTS 005 · Câu hỏi
Tải MP3 005
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.

TTS 006 · Đáp án
Tải MP3 006
Q004 · FOUNDATION · ADD V5

TTS 007 · Q: What is a business invariant?

TTS 007 · Câu hỏi
Tải MP3 007
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.

TTS 008 · Đáp án
Tải MP3 008

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q005 · SCENARIO / FOLLOW-UP · BASE V4

TTS 009 · Q: Why would you ask about staff approval before writing code?

TTS 009 · Câu hỏi
Tải MP3 009
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.

TTS 010 · Đáp án
Tải MP3 010
Q006 · SCENARIO / FOLLOW-UP · BASE V4

TTS 011 · Q: What changes if customers can cancel a booking?

TTS 011 · Câu hỏi
Tải MP3 011
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.

TTS 012 · Đáp án
Tải MP3 012
Q007 · SCENARIO / FOLLOW-UP · BASE V4

TTS 013 · Q: What would you test before releasing the feature?

TTS 013 · Câu hỏi
Tải MP3 013
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.

TTS 014 · Đáp án
Tải MP3 014

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

A requirement describes what users need to do, while a business rule defines the conditions that must hold. For a booking feature, I would ask who can book and whether staff approval is required. The API receives a request, the service validates the rules, and the database stores the booking. I would also test unavailable rooms and invalid dates.

Knowledge guardrail: Nói “use Spring Boot” không trả lời được requirement; luôn bắt đầu với nhu cầu và quy tắc.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 01.



MÔ-ĐUN 02 [CORE] — Đọc, nghe và trả lời câu hỏi kỹ thuật bằng tiếng Anh (từ cơ bản)

Tại sao học trước? Không hiểu interviewer hỏi gì thì biết kiến thức vẫn trả lời sai. Nhưng không cần học cả giáo trình ngữ pháp: học theo những cấu trúc xuất hiện trong phỏng vấn.

02.1. “Giải mã” câu hỏi theo cấu trúc

Interviewer nói Dịch ý Phản xạ cần có
What is X? X là gì? Định nghĩa + ví dụ
How does X work? X hoạt động thế nào? Nêu từng bước
Why did you choose X? Vì sao chọn X? Lý do + phương án khác + đánh đổi
What's the difference between X and Y? X và Y khác nhau thế nào? So sánh 2–3 tiêu chí
What happens if X fails? Chuyện gì xảy ra nếu X lỗi? Hậu quả + cách phát hiện + phục hồi
Walk me through... Giải thích tuần tự Đi từ input → output
How would you design...? Nếu giao bạn thiết kế thì...? Hỏi rõ yêu cầu trước
What assumptions are you making? Bạn đang giả định gì? Nêu giả định, cách xác thực
How would you verify/test...? Làm sao kiểm chứng? Test case, metric, log
What is the trade-off? Đánh đổi là gì? Lợi ích ↔ chi phí/rủi ro
Could you elaborate? Bạn nói chi tiết hơn được không? Cho ví dụ hoặc cơ chế
Can you think of edge cases? Các trường hợp biên? Input rỗng, trùng, lỗi, đồng thời

02.2. 12 từ “đổi nghĩa câu hỏi” phải nhận ra ngay

Từ Nghĩa Cạm bẫy
NOT / EXCEPT / INCORRECT không đúng / ngoại trừ chọn phát biểu sai
BEST / MOST / LEAST tốt nhất / nhiều nhất / ít nhất so sánh tương đối
PRIMARY chính, chủ yếu không chọn lợi ích thứ yếu
necessary cần thiếu nó thì không có điều kiện đích
sufficient đủ có nó thì đảm bảo điều kiện đích
only if chỉ khi “A only if B”: A ⇒ B
unless trừ khi xem điều kiện ngoại lệ
given / assuming cho trước / giả sử không tự sửa giả định đề bài
always / never luôn / không bao giờ chú ý ngoại lệ
typically / by default thường / mặc định không có nghĩa 100%
concurrently diễn ra chồng lấn có thể không chạy song song thật
at least / at most ít nhất / nhiều nhất đảo nhầm giới hạn

Ví dụ: “Which action is LEAST likely to prevent duplicate bookings?” → chọn hành động ít có tác dụng nhất, không phải hiệu quả nhất.

02.3. Bốn khung trả lời thay cho học thuộc từng câu

Khung A — định nghĩa: X is ... → It is used for ... → Example ...

A database transaction groups multiple operations into one logical unit. It helps preserve consistency when something fails. For example, booking creation and inventory updates may need to succeed or fail together.

Khung B — giải thích cơ chế: Input → Step 1 → Step 2 → Result → Failure

When a request reaches the controller, we validate the input, call the service, access the database, and return a response. If validation fails, we return a client error.

Khung C — giải thích quyết định: Goal → Choice → Because → Trade-off

For an early MVP, I would choose a modular monolith because it's simpler to build and deploy. The trade-off is that independent scaling and deployment are more limited than with separate services.

Khung D — gặp bài chưa rõ: Clarify → Assume → Propose → Verify

Could I clarify whether reservations need staff approval? If approval is required, I would introduce a pending state and a staff approval API. We can verify this with acceptance tests.

02.4. Các câu cứu nguy khi nghe chưa hiểu

Không nên: trả lời thật dài để che việc chưa hiểu, hoặc nhận đã dùng công nghệ mà mình chưa dùng.

02.5. Luyện nghe không cần có partner

  1. Chép 6 câu trong §1.1 vào ứng dụng đọc văn bản tiếng Anh (text-to-speech) hoặc nhờ người khác đọc; ẩn bản chữ.
  2. Nghe 1 lần, nói lại bằng tiếng Việt interviewer muốn dạng câu trả lời nào.
  3. Nghe lần 2 và trả lời bằng 2–4 câu tiếng Anh.
  4. Ghi lỗi vào ba nhóm: (a) không nghe rõ từ; (b) nghe rõ nhưng không hiểu thuật ngữ; (c) hiểu nhưng không nói ra được.

Bài tập tăng dần: - Dễ: What is an index? - Vừa: Why would an index improve some queries but slow down writes? - Khó: A query is slow even though the indexed column appears in WHERE. What would you check first?

Đáp án mẫu ngắn — chỉ xem sau khi tự nói
  1. An index is a data structure that helps a database locate relevant rows faster.
  2. An index can reduce the work needed to find rows. However, inserts and updates may also need to maintain the index.
  3. I would inspect the execution plan and query predicates first. I would check whether the database actually uses the index, the selectivity, and whether the query needs many rows.

Checkpoint Mô-đun 02: Tự nghe và phân loại đúng ≥ 8/10 câu dạng trên; tự trả lời 3 câu không đọc script. Nếu chưa làm được, lặp Mô-đun 02 trước khi đi tiếp.

🎙️ SPEAKING LAB V5.2 — 02. Nghe và phân loại câu hỏi phỏng vấn

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: What / How / Why / Difference / What if / Verify / MOST / LEAST / EXCEPT / only if.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
Could you elaborate? bạn giải thích thêm được không?
The main difference is... khác biệt chính là...
One possible failure is... một lỗi có thể xảy ra là...
To verify this, I would... để kiểm chứng, tôi sẽ...

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. Could you rephrase the last part of the question?
  2. The main trade-off is better read performance but more write overhead.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

You are asking about . My short answer is . For example, ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 4 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q008 · MECHANISM / WHY · BASE V4

TTS 015 · Q: What kind of answer does “How does an index work?” require?

TTS 015 · Câu hỏi
Tải MP3 015
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.

TTS 016 · Đáp án
Tải MP3 016
Q009 · MECHANISM / WHY · BASE V4

TTS 017 · Q: Which action is LEAST likely to prevent duplicate bookings? Explain what LEAST changes.

TTS 017 · Câu hỏi
Tải MP3 017
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.

TTS 018 · Đáp án
Tải MP3 018
Q010 · MECHANISM / WHY · BASE V4

TTS 019 · Q: Could you compare a requirement and an assumption?

TTS 019 · Câu hỏi
Tải MP3 019
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.

TTS 020 · Đáp án
Tải MP3 020
Q011 · FOUNDATION · ADD V5

TTS 021 · Q: What does the word EXCEPT mean in a multiple-choice question?

TTS 021 · Câu hỏi
Tải MP3 021
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.

TTS 022 · Đáp án
Tải MP3 022

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q012 · SCENARIO / FOLLOW-UP · BASE V4

TTS 023 · Q: What would you say if you did not hear a technical term?

TTS 023 · Câu hỏi
Tải MP3 023
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.

TTS 024 · Đáp án
Tải MP3 024
Q013 · SCENARIO / FOLLOW-UP · BASE V4

TTS 025 · Q: How would you clarify a question about a “best” solution with missing constraints?

TTS 025 · Câu hỏi
Tải MP3 025
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.

TTS 026 · Đáp án
Tải MP3 026
Q014 · SCENARIO / FOLLOW-UP · ADD V5

TTS 027 · Q: What would you say if you did not know the answer to a technical question?

TTS 027 · Câu hỏi
Tải MP3 027
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.

TTS 028 · Đáp án
Tải MP3 028

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

The word “least” means I should choose the option that is the least effective, not the most effective. If a question is unclear, I would ask the interviewer to rephrase it. For a “best solution” question, I would first clarify the constraints, because the best option depends on the workload and business goals.

Knowledge guardrail: Đừng thấy BEST/MOST/NOT/EXCEPT rồi chọn theo phản xạ; tóm tắt lại yêu cầu đề trước.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 02.



CHẶNG II — TẬP THIẾT KẾ TỪ NHỎ ĐẾN TỔNG THỂ


LAB A [CORE] — Cầu nối cho người mới: từ một câu nói thành Entities → Rules → APIs

Vì sao làm lab này trước LLD đầy đủ? Khi mới học design, entity, business rule, state và API dễ bị trộn lẫn. Ta chia nhỏ, tập từng việc rồi mới ghép.

A0. Từ điển cực ngắn

Thuật ngữ Hiểu như người mới Ví dụ
Actor Ai làm? Customer, Staff
Use case Họ muốn làm gì? Customer creates a booking
Entity Thứ cần lưu/truy vết qua thời gian Booking, Room
Attribute Một đặc điểm của entity booking.status
Business rule / invariant Điều không được sai Một phòng không bị giữ trùng cùng đêm
State Giai đoạn của entity PENDING, APPROVED
Transition Hành động đưa entity sang state khác approve: PENDING → APPROVED
API contract Lời hứa input/output/lỗi giữa các bên POST /bookings, 201/409
Service Logic xử lý use case / business rules BookingService

Bẫy: Không phải mọi danh từ đều phải thành table hoặc class. BookingStatus có thể là enum, Price có thể là value object; chia thế nào phụ thuộc domain.

A1. WATCH — một yêu cầu cực nhỏ

A user can create a personal note and archive it later.

Bước 1 — actor/use cases: User; Create note, Archive note.

Bước 2 — entity: Note(id, ownerId, content, status, createdAt).

Bước 3 — rules: content không để trống; chỉ owner được archive; archived note không được archive lần hai theo chính sách đã chốt.

Bước 4 — states: ACTIVE → ARCHIVED.

Bước 5 — API: POST /notes nhận {content} → 201 + note; POST /notes/{id}/archive → 200/204, 403 nếu thiếu quyền, 404 nếu không tồn tại. Quyết định trả 409/204 khi đã archived phải thống nhất với contract.

Bước 6 — classes: NoteController xử lý HTTP; NoteService kiểm owner và trạng thái; NoteRepository đọc/ghi DB.

Bước 7 — tests: tạo note rỗng → 400; người B archive note A → 403; archive thành công → DB status ARCHIVED.

English, ba câu đủ dùng: The main entity is Note. The service validates ownership and status changes. I would test invalid content and unauthorized archiving.

A2. COMPLETE — điền những ô còn thiếu (5 phút)

A student can enroll in a course. A course has a maximum capacity.

  1. Actor: __________.
  2. Use case: __________.
  3. Entities: Student, Course, __________.
  4. Invariant: total active enrollments for a course must not exceed __________.
  5. Proposed API: POST /courses/{id}/__________.
  6. Concurrent case: Two students enroll for the last seat. How would you protect the rule? __________.
Gợi ý một

Một enrollment là mối quan hệ có thể có ngày tạo/trạng thái; Enrollment(studentId, courseId, status) có thể cần tồn tại độc lập. Count rồi insert mà không bảo vệ concurrency có thể vượt capacity.

Đáp án và lý do

Student; enroll; Enrollment; capacity; enrollments; dùng cơ chế kiểm soát cạnh tranh ở nguồn dữ liệu (ví dụ lock row Course trong transaction rồi đếm, hoặc atomic capacity reservation), kết hợp unique (course_id, student_id) và test đồng thời. Chọn giải pháp cụ thể tùy schema và isolation; chỉ @Transactional mà không có điều kiện/lock phù hợp không tự giải quyết mọi race.

A3. DO — case lạ không có khung điền (8 phút)

A team lead can approve an employee's leave request. An employee cannot approve their own request.

Trước khi xem đáp án, tự viết: 2 actors, tối đa 3 entities, states, 2 endpoints, 3 rules, 2 tests, một câu tiếng Anh giải thích vì sao cần role check.

Đáp án tham khảo

Actors: employee, team lead. Entity chính LeaveRequest(id, employeeId, approverId?, startDate, endDate, status) và User/Role; history nếu audit bắt buộc. States DRAFT → SUBMITTED → APPROVED/REJECTED; confirm chính sách sửa sau submit. POST /leave-requests, POST /leave-requests/{id}/approve. Rules: approver có quyền, không tự duyệt, chỉ SUBMITTED được approve; overlapping leave tùy policy. Tests: self-approval → 403; two approvals simultaneously → không có hai transitions/audit sai. I would verify the approver's role and ensure employees cannot approve their own requests.

Qua LAB A nếu: Bạn tự chỉ được actor/entity/state/rule/API cho một yêu cầu hoàn toàn mới trong 6–8 phút. Nếu chưa, làm lại A2/A3 trước khi vào Registration.

🎙️ SPEAKING LAB V5.2 — A. Entities → Rules → APIs

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Actor; entity; state; invariant; endpoint; authorization; concurrency test.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
the main entity is... thực thể chính là...
move from ... to ... chuyển trạng thái từ ... sang ...
enforce the rule buộc tuân thủ quy tắc
check ownership kiểm tra chủ sở hữu

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. The main entity is an enrollment with a student, a course, and a status.
  2. I would protect the last available seat with database concurrency control.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

The actor is . The main entities are . A key invariant is ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 3 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q015 · FOUNDATION · BASE V4

TTS 029 · Q: Design a small course enrollment feature. What are the entities?

TTS 029 · Câu hỏi
Tải MP3 029
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.

TTS 030 · Đáp án
Tải MP3 030
Q016 · FOUNDATION · BASE V4

TTS 031 · Q: Should the same student be allowed to enroll twice?

TTS 031 · Câu hỏi
Tải MP3 031
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.

TTS 032 · Đáp án
Tải MP3 032
Q017 · MECHANISM / WHY · ADD V5

TTS 033 · Q: What is the difference between an entity and a service?

TTS 033 · Câu hỏi
Tải MP3 033
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.

TTS 034 · Đáp án
Tải MP3 034

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q018 · SCENARIO / FOLLOW-UP · BASE V4

TTS 035 · Q: Two students take the last seat. How do you keep the capacity rule?

TTS 035 · Câu hỏi
Tải MP3 035
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.

TTS 036 · Đáp án
Tải MP3 036
Q019 · SCENARIO / FOLLOW-UP · BASE V4

TTS 037 · Q: How would you test unauthorized approval of a leave request?

TTS 037 · Câu hỏi
Tải MP3 037
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.

TTS 038 · Đáp án
Tải MP3 038
Q020 · SCENARIO / FOLLOW-UP · BASE V4

TTS 039 · Q: What if a student drops a course?

TTS 039 · Câu hỏi
Tải MP3 039
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.

TTS 040 · Đáp án
Tải MP3 040
Q021 · SCENARIO / FOLLOW-UP · ADD V5

TTS 041 · Q: How would you represent the lifecycle of a leave request?

TTS 041 · Câu hỏi
Tải MP3 041
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.

TTS 042 · Đáp án
Tải MP3 042

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

I would model Student, Course, and Enrollment. Each enrollment records the student, course, and status. A key invariant is that active enrollments cannot exceed the course capacity. The enrollment API should check permission and protect the last seat with suitable database concurrency control. I would test two students enrolling for the last seat at the same time.

Knowledge guardrail: Chỉ kiểm tra count rồi insert không đảm bảo giới hạn khi request concurrent.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab A.



MÔ-ĐUN 03 [CORE] — LLD bước 1: yêu cầu → entities, classes, API

Mục tiêu: sau bài này, được giao “thiết kế đăng ký tài khoản”, bạn không còn đứng hình vì không biết bắt đầu từ đâu.

03.1. LLD khác code Spring sẵn có ở đâu?

Bạn đã biết Controller → Service → Repository. LLD yêu cầu bạn quyết định vì sao có những lớp đó, mỗi lớp chịu trách nhiệm gì, cấu trúc dữ liệu ra sao, rồi giải thích được khi thay đổi yêu cầu.

Quy tắc bắt đầu đơn giản — không phải phép màu: 1. Tìm danh từ trong yêu cầu → ứng viên entity/object (User, Booking, Room). 2. Tìm động từ → hành vi (register, approve, cancel). 3. Tìm business rules → invariants (email unique, room not overbooked). 4. Tìm vai trò → permissions. 5. Tìm sự kiện thay đổi trạng thái → lifecycle / state transitions.

03.2. Worked example đầy đủ: User Registration

Đề: Users can register with email and password. The email must be unique. After registration, a verification email is sent.

Bước 1 — hỏi trước khi design: - Email verification là bắt buộc trước khi login? - Chính sách mật khẩu thế nào? - Trùng email trả lỗi gì, có cần tránh user enumeration? - Gửi email thất bại có hủy việc đăng ký không?

Giả định cho MVP: tài khoản ở PENDING_VERIFICATION đến khi verify; email unique case-insensitive theo quy tắc đã thống nhất; việc gửi email có thể bất đồng bộ và retry được.

Bước 2 — data model:

User
- id: UUID                 PK
- email: String            UNIQUE theo normalized_email / quy tắc DB
- passwordHash: String
- status: UserStatus       PENDING_VERIFICATION / ACTIVE
- createdAt: Instant

VerificationToken
- id: UUID
- userId: UUID             FK → User.id
- tokenHash: String
- expiresAt: Instant
- consumedAt: Instant?

Bước 3 — chia responsibilities:

RegistrationController : HTTP request + validation boundary + response
RegistrationService    : use case register user, phối hợp các thành phần
UserRepository         : lưu/truy xuất User, kiểm tra uniqueness qua DB constraint
PasswordHasher         : tạo password hash
VerificationService    : quản lý token và verification policy
EmailSender            : gửi email qua abstraction

Đừng đặt mọi logic vào Controller; cũng đừng tạo 20 interfaces cho một MVP nhỏ. High cohesion / low coupling: một module có trách nhiệm liên quan, phụ thuộc ngoài càng ít càng tốt.

Bước 4 — API:

POST /api/users/register
Content-Type: application/json

{"email":"an@example.com","password":"..."}

HTTP/1.1 201 Created
{"userId":"...","status":"PENDING_VERIFICATION"}

Status code và response cụ thể do API contract lựa chọn, không có một đáp án tuyệt đối. Với hệ thống public, cân nhắc thông báo chung để hạn chế tiết lộ email nào đã đăng ký.

Bước 5 — sequence diagram dạng text:

Client          Controller       RegistrationService       Database       Email
  | POST register   |                    |                    |             |
  |---------------->| validate           |                    |             |
  |                 |------------------->| normalize/hash     |             |
  |                 |                    | INSERT User+token  |             |
  |                 |                    |------------------->|             |
  |                 |                    | <--- commit result |             |
  |                 |                    | request delivery ----------------->|
  |                 |<-------------------| result             |             |
  |<-- 201 + status |                    |                    |             |

Production nuance: gọi email trực tiếp sau DB commit có thể bị mất nếu process crash giữa commit và gửi. Một cách xử lý đáng học ở bước sau là outbox pattern; không bắt buộc thiết kế ngay trong bài LLD đầu tiên.

Bước 6 — edge cases / tests: invalid email; weak password; duplicate registration; email provider timeout; expired token; reused token; two concurrent registrations of same email (DB unique constraint là điểm bảo vệ cuối cùng).

03.3. UML căn bản — nhớ ý, đừng học quá nhiều ký hiệu

Quan hệ Ý nghĩa trực giác
Association hai đối tượng có liên hệ
Aggregation (hollow diamond) quan hệ whole–part yếu
Composition (filled diamond) whole–part với ownership/lifecycle mạnh
Inheritance / generalization is-a relationship
Interface implementation / realization class thực hiện contract

03.4. SOLID từ ứng dụng chứ không phải 5 định nghĩa trừu tượng

Nguyên lý Áp dụng vào Registration
S — Single Responsibility EmailSender không quyết định user status
O — Open/Closed thêm EmailSender implementation khác mà hạn chế sửa registration logic
L — Liskov Substitution thay implementation của EmailSender vẫn phải giữ contract hứa hẹn
I — Interface Segregation đừng bắt EmailSender implement 20 methods không dùng
D — Dependency Inversion Service phụ thuộc EmailSender contract thay vì SDK cụ thể

Không lạm dụng: nguyên lý là hướng dẫn thiết kế, không phải yêu cầu tạo interface cho mọi class.

03.5. Design patterns chỉ cần biết tình huống

Tự làm — bản có gợi ý: Thiết kế PasswordReset.

Đáp án mẫu PasswordReset

Câu tiếng Anh: I would separate HTTP handling from business logic and data access. The registration service coordinates validation, persistence, and verification. A database uniqueness constraint protects against concurrent duplicate registrations.

🎙️ SPEAKING LAB V5.2 — 03. Registration LLD

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Unique normalized email; hashed password; verification token; responsibilities; email failure.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
separate responsibilities tách trách nhiệm
enforce uniqueness đảm bảo tính duy nhất
hash the password băm mật khẩu
send a verification email gửi email xác minh

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. The registration service coordinates validation and persistence.
  2. A database uniqueness constraint helps prevent duplicate registrations.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

I would model ___ and ___. The ___ handles HTTP, while the ___ handles business logic.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 4 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q022 · MECHANISM / WHY · BASE V4

TTS 043 · Q: Explain the responsibilities of a registration controller and service.

TTS 043 · Câu hỏi
Tải MP3 043
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.

TTS 044 · Đáp án
Tải MP3 044
Q023 · MECHANISM / WHY · BASE V4

TTS 045 · Q: Why should the email comparison policy be defined explicitly?

TTS 045 · Câu hỏi
Tải MP3 045
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.

TTS 046 · Đáp án
Tải MP3 046
Q024 · MECHANISM / WHY · ADD V5

TTS 047 · Q: Why should passwords be hashed instead of encrypted for storage?

TTS 047 · Câu hỏi
Tải MP3 047
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.

TTS 048 · Đáp án
Tải MP3 048
Q025 · MECHANISM / WHY · ADD V5

TTS 049 · Q: What is the difference between validation and authorization in registration?

TTS 049 · Câu hỏi
Tải MP3 049
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.

TTS 050 · Đáp án
Tải MP3 050

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q026 · SCENARIO / FOLLOW-UP · BASE V4

TTS 051 · Q: How do you prevent two concurrent registrations with the same email?

TTS 051 · Câu hỏi
Tải MP3 051
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.

TTS 052 · Đáp án
Tải MP3 052
Q027 · SCENARIO / FOLLOW-UP · BASE V4

TTS 053 · Q: What happens if the email provider fails after the user is saved?

TTS 053 · Câu hỏi
Tải MP3 053
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.

TTS 054 · Đáp án
Tải MP3 054
Q028 · SCENARIO / FOLLOW-UP · BASE V4

TTS 055 · Q: How would you protect password-reset tokens?

TTS 055 · Câu hỏi
Tải MP3 055
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.

TTS 056 · Đáp án
Tải MP3 056
Q029 · SCENARIO / FOLLOW-UP · ADD V5

TTS 057 · Q: How would you handle verification-email delivery reliably?

TTS 057 · Câu hỏi
Tải MP3 057
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.

TTS 058 · Đáp án
Tải MP3 058

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

I would use a User entity and a VerificationToken entity. The controller handles HTTP input and response, while the service coordinates validation, password hashing, and persistence. The database should enforce email uniqueness to handle concurrent requests. I would send verification through a separate component and plan for delivery failures after the database commit.

Knowledge guardrail: Email failure không nên được giải thích như được DB transaction bảo đảm rollback tự động.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 03.



CHẶNG III — CS CẦN ĐÚNG LÚC (KHÔNG NHỒI TOÀN BỘ)


MÔ-ĐUN 04 [CORE] — Database / SQL: từ bảng dữ liệu đến transaction và index

04.1. Khởi đầu thật đơn giản: entity → table

Giả sử có:

Customer(customer_id, email)
Room(room_id, room_type)
Booking(booking_id, customer_id, room_id, check_in, check_out, status)

MICRO SPEAK V5.2 — sau mục 04.1 · 2 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: A primary key uniquely identifies each row in a table. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (2 câu)

Q030 · FOUNDATION · ADD V5

TTS 059 · Q: What is a primary key?

TTS 059 · Câu hỏi
Tải MP3 059
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.

TTS 060 · Đáp án
Tải MP3 060
Q031 · FOUNDATION · ADD V5

TTS 061 · Q: What is a foreign key?

TTS 061 · Câu hỏi
Tải MP3 061
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.

TTS 062 · Đáp án
Tải MP3 062

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

04.2. SQL từ dễ đến vừa

Dữ liệu ví dụ:

Customers
id | name
1  | An
2  | Binh
3  | Chi

Bookings
id  | customer_id | amount | status
10  | 1           | 500    | CONFIRMED
11  | 1           | 700    | CANCELLED
12  | 2           | 400    | CONFIRMED

Bước 1 — lọc: SELECT * FROM bookings WHERE status = 'CONFIRMED';

Bước 2 — JOIN:

SELECT c.name, b.id, b.amount
FROM customers c
JOIN bookings b ON b.customer_id = c.id
WHERE b.status = 'CONFIRMED';

Bước 3 — GROUP BY/HAVING:

SELECT c.id, c.name, SUM(b.amount) AS total_confirmed
FROM customers c
JOIN bookings b ON b.customer_id = c.id
WHERE b.status = 'CONFIRMED'
GROUP BY c.id, c.name
HAVING SUM(b.amount) >= 400;

Thấy gì? WHERE lọc rows trước grouping; HAVING lọc nhóm sau aggregate. LEFT JOIN giữ cả customer không booking; cần hiểu vì sao filter ở WHERE có thể vô tình làm mất những rows NULL phía phải.

5 điều SQL dễ nhầm: - COUNT(*) đếm rows; COUNT(column) bỏ NULL trong column đó. - IS NULL thay vì = NULL (SQL three-valued logic). - UNION loại duplicate; UNION ALL giữ lại. - INNER JOIN chỉ match; LEFT JOIN giữ tất cả phía trái. - LIMIT / OFFSET thường đi sau ORDER BY; muốn kết quả ổn định cần sort key xác định.

MICRO SPEAK V5.2 — sau mục 04.2 · 4 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: An INNER JOIN returns only customers with matching bookings. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (4 câu)

Q032 · MECHANISM / WHY · BASE V4

TTS 063 · Q: Explain INNER JOIN versus LEFT JOIN with customer bookings.

TTS 063 · Câu hỏi
Tải MP3 063
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.

TTS 064 · Đáp án
Tải MP3 064
Q033 · MECHANISM / WHY · ADD V5

TTS 065 · Q: What is the difference between WHERE and HAVING?

TTS 065 · Câu hỏi
Tải MP3 065
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.

TTS 066 · Đáp án
Tải MP3 066
Q034 · MECHANISM / WHY · ADD V5

TTS 067 · Q: What is the difference between COUNT(*) and COUNT(column)?

TTS 067 · Câu hỏi
Tải MP3 067
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.

TTS 068 · Đáp án
Tải MP3 068
Q035 · MECHANISM / WHY · ADD V5

TTS 069 · Q: What is the difference between UNION and UNION ALL?

TTS 069 · Câu hỏi
Tải MP3 069
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.

TTS 070 · Đáp án
Tải MP3 070

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

04.3. Index — vì sao giúp đọc nhưng có thể làm ghi chậm?

Tưởng tượng một cuốn từ điển: index giúp nhảy gần vị trí cần tìm thay vì đọc tuần tự. Nhưng mỗi lần thêm/sửa dữ liệu, cấu trúc index có thể phải cập nhật theo.

Ví dụ truy vấn:

SELECT * FROM bookings WHERE customer_id = 7 ORDER BY created_at DESC;

Có thể xem xét index (customer_id, created_at DESC) tùy workload, query plan và DBMS. Không phải cứ có index là query dùng index. Với bảng nhỏ hoặc filter chọn phần lớn bảng, sequential scan có thể tốt hơn.

Interview answer: An index can speed up eligible reads by reducing unnecessary scanning, but it costs storage and write maintenance. I'd check the query plan and actual workload before adding one.

MICRO SPEAK V5.2 — sau mục 04.3 · 4 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: Not automatically. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (2 câu)

Q036 · FOUNDATION · ADD V5

TTS 071 · Q: What is a database index?

TTS 071 · Câu hỏi
Tải MP3 071
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.

TTS 072 · Đáp án
Tải MP3 072
Q037 · MECHANISM / WHY · ADD V5

TTS 073 · Q: Why can an index slow down INSERT and UPDATE operations?

TTS 073 · Câu hỏi
Tải MP3 073
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.

TTS 074 · Đáp án
Tải MP3 074

FOLLOW-UP — case / phản biện (2 câu)

Q038 · SCENARIO / FOLLOW-UP · BASE V4

TTS 075 · Q: Would you add an index on a low-selectivity status column?

TTS 075 · Câu hỏi
Tải MP3 075
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.

TTS 076 · Đáp án
Tải MP3 076
Q039 · SCENARIO / FOLLOW-UP · ADD V5

TTS 077 · Q: How would you investigate a slow SQL query that already has an index?

TTS 077 · Câu hỏi
Tải MP3 077
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.

TTS 078 · Đáp án
Tải MP3 078

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

04.4. Transactions / ACID — hình dung trước khi học chữ

Ví dụ chuyển tiền từ tài khoản A sang B: không thể trừ A thành công mà cộng B thất bại rồi dừng mãi. Database transaction giúp quản lý nhiều thao tác thành một đơn vị theo các bảo đảm cụ thể.

Không nhầm: Atomicity không đồng nghĩa Isolation. Transaction không tự bảo vệ mọi business invariant nếu isolation/locking không phù hợp.

04.5. Những bất thường do concurrent transactions

Hiện tượng Ví dụ
Dirty read đọc dữ liệu bên khác chưa commit
Non-repeatable read đọc cùng row hai lần, thấy giá trị mới đã commit
Phantom chạy lại query điều kiện, tập rows khác
Lost update hai bên đọc cùng giá trị, ghi đè lẫn nhau
Write skew hai transaction cùng dựa vào một snapshot, cập nhật các rows khác nhau làm hỏng rule chung

Các isolation levels chuẩn hay gặp: Read Uncommitted → Read Committed → Repeatable Read → Serializable (không coi đây là lời hứa hành vi đồng nhất giữa mọi DBMS; PostgreSQL và MySQL có chi tiết triển khai khác nhau).

Optimistic locking: thường dùng version, cập nhật có điều kiện WHERE id=? AND version=?, phát hiện conflict và xử lý/retry có kiểm soát.
Pessimistic locking: lấy khóa trước khi đọc/sửa critical data, có thể làm tăng contention.

MICRO SPEAK V5.2 — sau mục 04.5 · 4 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: Atomicity means a transaction succeeds or fails as one unit. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (4 câu)

Q040 · MECHANISM / WHY · BASE V4

TTS 079 · Q: What is the difference between atomicity and isolation?

TTS 079 · Câu hỏi
Tải MP3 079
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.

TTS 080 · Đáp án
Tải MP3 080
Q041 · FOUNDATION · ADD V5

TTS 081 · Q: What does ACID stand for?

TTS 081 · Câu hỏi
Tải MP3 081
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.

TTS 082 · Đáp án
Tải MP3 082
Q042 · MECHANISM / WHY · ADD V5

TTS 083 · Q: What is the difference between a dirty read and a non-repeatable read?

TTS 083 · Câu hỏi
Tải MP3 083
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.

TTS 084 · Đáp án
Tải MP3 084
Q043 · FOUNDATION · ADD V5

TTS 085 · Q: What is a phantom read?

TTS 085 · Câu hỏi
Tải MP3 085
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.

TTS 086 · Đáp án
Tải MP3 086

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

04.6. Worked example — hai người cùng đặt một phòng

  1. Rule: chỉ có một booking hiệu lực cho cùng room_id và stay_date.
  2. Data model đơn giản: booking_nights(room_id, stay_date, booking_id) và ràng buộc unique (room_id, stay_date) cho các nights đã giữ theo mô hình này; trạng thái hủy/giải phóng phải được thiết kế đồng bộ.
  3. Khi tạo booking: xác thực → cố gắng giữ toàn bộ nights trong transaction thích hợp → nếu conflict thì từ chối → commit.
  4. Nếu nối với nhà cung cấp phòng bên ngoài: local transaction không bao trùm external API; cần điều chỉnh workflow, reconciliation/idempotency và trạng thái pending theo contract của bên ngoài.
  5. Test: hai requests đồng thời cho cùng room/date → không bao giờ có hai booking active hợp lệ cho cùng đêm.

Đây là một mô hình minh họa, không phải mô hình booking duy nhất hay giải pháp sẵn sàng production.

MICRO SPEAK V5.2 — sau mục 04.6 · 3 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: A transaction gives atomic behavior, but two transactions can still pass the same availability check. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (2 câu)

Q044 · MECHANISM / WHY · BASE V4

TTS 087 · Q: Why is a transaction not always enough to prevent overselling?

TTS 087 · Câu hỏi
Tải MP3 087
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.

TTS 088 · Đáp án
Tải MP3 088
Q045 · MECHANISM / WHY · ADD V5

TTS 089 · Q: What is the difference between optimistic and pessimistic locking?

TTS 089 · Câu hỏi
Tải MP3 089
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.

TTS 090 · Đáp án
Tải MP3 090

FOLLOW-UP — case / phản biện (1 câu)

Q046 · SCENARIO / FOLLOW-UP · BASE V4

TTS 091 · Q: How would you test a lost update with two requests?

TTS 091 · Câu hỏi
Tải MP3 091
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.

TTS 092 · Đáp án
Tải MP3 092

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

04.7. Tự làm 3 câu SQL ngắn

  1. Viết SQL lấy mọi customer, kể cả customer chưa booking, cùng tổng số booking.
  2. Viết SQL lấy customer có tổng confirmed amount > 450.
  3. Tại sao thêm index lên status (cột chỉ có 2 giá trị) có thể không giúp query nhanh hơn?
Đáp án SQL
-- 1
SELECT c.id, c.name, COUNT(b.id) AS booking_count
FROM customers c
LEFT JOIN bookings b ON b.customer_id = c.id
GROUP BY c.id, c.name;

-- 2
SELECT c.id, c.name, SUM(b.amount) AS total
FROM customers c
JOIN bookings b ON b.customer_id = c.id
WHERE b.status = 'CONFIRMED'
GROUP BY c.id, c.name
HAVING SUM(b.amount) > 450;

Dữ liệu mẫu: câu 2 chỉ có An (500), vì Binh có 400.
3. Nếu status rất ít giá trị và phần lớn rows match, scan có thể rẻ hơn index lookup + row access. Cần xem thực tế query plan và thống kê.

Checkpoint Mô-đun 04: Giải thích được JOIN vs LEFT JOIN, WHERE vs HAVING, atomicity vs isolation, why index, và xử lý một lost update.

🎙️ SPEAKING LAB V5.2 — 04. SQL, indexes, ACID và locking

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: JOIN vs LEFT JOIN; WHERE vs HAVING; index trade-offs; atomicity vs isolation; concurrent updates.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
filter rows lọc các hàng
group the results nhóm kết quả
inspect the query plan xem kế hoạch thực thi
prevent lost updates ngăn cập nhật bị ghi đè

1. PRETEST + WATCH + DO

Đã được chia nhỏ: 17 cặp Q&A của mô-đun này được đặt sau từng mục lý thuyết ở phía trên (MICRO SPEAK V5.2). Không đọc lại toàn bộ câu hỏi ở đây; chọn 3 câu khó nhất để làm lại không nhìn.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. A left join keeps rows from the left table even when there is no match.
  2. An index can improve reads, but it also adds storage and write costs.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

I would use ___ because . The downside is . To verify it, I would ___.

4. FREE SPEAK + FOLLOW-UP — ôn các micro-lab

Lấy ngẫu nhiên 2 câu cơ chế + 1 câu tình huống đã làm trong các MICRO SPEAK phía trên. Không đọc script; câu nào sai phải sửa kèm một ví dụ/code/test.

Mã câu trong mô-đun: Q032, Q044, Q038, Q040, Q046, Q030, Q031, Q033, Q034, Q035, Q036, Q037, Q039, Q041, Q042, Q043, Q045.

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

An inner join returns matching rows, while a left join keeps all customers, including those without bookings. For concurrency, a transaction provides atomicity, but we still need appropriate isolation or locking to protect the inventory rule. I would use a database constraint or an atomic conditional update, and test two concurrent booking requests against the last room.

Knowledge guardrail: @Transactional hay ACID không tự động biến một logic check-then-act thành an toàn ở mọi isolation level.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 04.



MÔ-ĐUN 05 [CORE] — Network / HTTP: một request chạy từ trình duyệt đến backend thế nào?

05.1. Luồng thực tế

User enters https://example.com
  ↓
DNS lookup (tìm thông tin IP của hostname, có thể qua cache)
  ↓
Connect (thường TCP; HTTP/3 dùng QUIC/UDP)
  ↓
TLS handshake (nếu HTTPS)
  ↓
HTTP request → reverse proxy / backend
  ↓
Application xử lý → DB / external APIs
  ↓
HTTP response → browser render

Mấu chốt: DNS khác HTTP; TCP cung cấp luồng byte có độ tin cậy/thứ tự; TLS bảo vệ kết nối; HTTPS là HTTP qua TLS. HTTP là stateless theo ngữ nghĩa giao thức, nhưng ứng dụng có thể quản lý session/cookies/tokens.

05.2. HTTP methods và response codes

Cần làm Cách thường dùng Ghi chú
Lấy booking GET /bookings/{id} GET safe/idempotent theo HTTP semantics
Tạo booking POST /bookings POST không mặc định idempotent; có thể thêm idempotency key
Thay toàn bộ resource PUT /bookings/{id} PUT idempotent về hiệu ứng mong đợi
Sửa một phần PATCH /bookings/{id} không mặc định idempotent
Xoá / hủy theo API contract DELETE /bookings/{id} DELETE idempotent theo HTTP semantics; business cancellation có thể dùng action riêng
Code Dùng khi
200 OK thành công và thường có body
201 Created tạo resource
204 No Content thành công, không có body
400 Bad Request request sai cú pháp/validation theo API
401 Unauthorized thiếu/xác thực không hợp lệ
403 Forbidden có thể xác thực nhưng không đủ quyền
404 Not Found không tìm thấy resource
409 Conflict mâu thuẫn trạng thái (ví dụ phòng đã hết)
429 Too Many Requests vượt rate limit
500 Internal Server Error lỗi backend không xử lý được
502/503/504 gateway error / service unavailable / gateway timeout (tùy vai trò)

05.3. Timeout và retry: câu hỏi hay gặp

Bẫy quan trọng: khi client timeout, ta không biết chắc server đã hoàn thành thao tác hay chưa. Không được suy luận “timeout ⇒ booking chưa được tạo”.

05.4. Mạng nền tảng — chỉ ghi nhớ vừa đủ

Tự trả lời: A customer clicks Book. The browser times out. Should we retry automatically?

Đáp án mẫu

We should not blindly retry a non-idempotent booking operation. The server may have created the booking even if the response was lost. I'd use an idempotency key and provide a way to retrieve the existing booking status before creating a duplicate.

🎙️ SPEAKING LAB V5.2 — 05. HTTP request, timeout và retry

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: DNS, connection, TLS, request/response; HTTP semantics; timeout uncertainty; idempotency.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
resolve the hostname phân giải tên miền
send an HTTP request gửi yêu cầu HTTP
time out hết thời gian chờ
retry safely thử lại an toàn

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. A response timeout does not prove that the server failed.
  2. The client should reuse an idempotency key when retrying the operation.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

First, the browser . Then the backend . If the request times out, ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 9 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q047 · MECHANISM / WHY · BASE V4

TTS 093 · Q: Walk me through an HTTPS request from browser to backend.

TTS 093 · Câu hỏi
Tải MP3 093
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.

TTS 094 · Đáp án
Tải MP3 094
Q048 · MECHANISM / WHY · BASE V4

TTS 095 · Q: What is the difference between HTTP 401 and 403?

TTS 095 · Câu hỏi
Tải MP3 095
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.

TTS 096 · Đáp án
Tải MP3 096
Q049 · FOUNDATION · BASE V4

TTS 097 · Q: Should a client automatically retry a booking POST after a timeout?

TTS 097 · Câu hỏi
Tải MP3 097
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.

TTS 098 · Đáp án
Tải MP3 098
Q050 · MECHANISM / WHY · ADD V5

TTS 099 · Q: What is the difference between GET and POST?

TTS 099 · Câu hỏi
Tải MP3 099
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.

TTS 100 · Đáp án
Tải MP3 100
Q051 · MECHANISM / WHY · ADD V5

TTS 101 · Q: What is the difference between PUT and PATCH?

TTS 101 · Câu hỏi
Tải MP3 101
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.

TTS 102 · Đáp án
Tải MP3 102
Q052 · FOUNDATION · ADD V5

TTS 103 · Q: What do HTTP 200, 201, and 204 mean?

TTS 103 · Câu hỏi
Tải MP3 103
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.

TTS 104 · Đáp án
Tải MP3 104
Q053 · FOUNDATION · ADD V5

TTS 105 · Q: What do HTTP 400, 404, 409, and 500 mean?

TTS 105 · Câu hỏi
Tải MP3 105
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.

TTS 106 · Đáp án
Tải MP3 106
Q054 · MECHANISM / WHY · ADD V5

TTS 107 · Q: What is the difference between a timeout and a connection refusal?

TTS 107 · Câu hỏi
Tải MP3 107
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.

TTS 108 · Đáp án
Tải MP3 108
Q055 · MECHANISM / WHY · ADD V5

TTS 109 · Q: Why is an idempotency key useful for a payment or booking API?

TTS 109 · Câu hỏi
Tải MP3 109
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.

TTS 110 · Đáp án
Tải MP3 110

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q056 · SCENARIO / FOLLOW-UP · BASE V4

TTS 111 · Q: What if the first response is lost after a successful commit?

TTS 111 · Câu hỏi
Tải MP3 111
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.

TTS 112 · Đáp án
Tải MP3 112
Q057 · SCENARIO / FOLLOW-UP · BASE V4

TTS 113 · Q: How would you expose the status of an uncertain operation?

TTS 113 · Câu hỏi
Tải MP3 113
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.

TTS 114 · Đáp án
Tải MP3 114

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

The browser resolves the hostname, establishes a secure connection, and sends an HTTP request. The backend processes the request and returns a response. If a booking request times out, the operation may still have succeeded. I would avoid a blind retry. Instead, I would reuse an idempotency key and let the client check the booking status.

Knowledge guardrail: Timeout không suy ra “server failed”; POST không tự động idempotent.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 05.



MÔ-ĐUN 06 [CORE] — OS + JVM + concurrency: vì sao hệ thống có thể sai khi nhiều request cùng đến?

06.1. Process, thread và bộ nhớ — giải thích bằng mô hình

Java process / JVM
 ├─ Heap: objects được các threads cùng truy cập
 ├─ Thread A → call stack A
 └─ Thread B → call stack B

Ví dụ: hai HTTP requests cùng gọi reserveLastRoom(). Nếu logic chỉ “đọc số phòng = 1 → cả hai cùng ghi lại = 0”, có thể xác nhận hai booking khi chỉ còn một phòng. Đây là vấn đề read–modify–write / race condition.

06.2. Race condition, atomicity và bảo vệ invariant

Invariant = điều luôn phải đúng, ví dụ: availableRooms >= 0, hoặc “cùng một phòng không được bán hai lần cho cùng một đêm”.

Sai (mô hình giả):

Request A: READ available=1
Request B: READ available=1
Request A: WRITE available=0 → success
Request B: WRITE available=0 → success

Ý tưởng đúng: thao tác dành phòng phải được kiểm soát tại nguồn dữ liệu có thẩm quyền, ví dụ:

UPDATE room_inventory
SET available = available - 1
WHERE room_type_id = :id AND stay_date = :date AND available > 0;

Chỉ coi bước giữ chỗ thành công khi số dòng cập nhật đúng kỳ vọng. Với booking nhiều đêm, phải xử lý tất cả các đêm như một đơn vị giao dịch phù hợp, không chỉ một dòng; kiểm tra điều kiện, transaction, và ranh giới giữa DB nội bộ / hệ thống bên ngoài phải được thiết kế cụ thể. Không khẳng định chỉ một câu SQL là đủ cho mọi booking system.

Phân biệt: Java synchronized bảo vệ truy cập trong một JVM; không đủ nếu chạy nhiều instances hoặc dữ liệu nằm ở external service. Database constraints, transactions/locks hoặc concurrency control phù hợp thường cần thiết.

06.3. Deadlock là gì?

Bốn điều kiện Coffman thường được nhắc trong OS deadlock: mutual exclusion, hold-and-wait, no preemption, circular wait. Không cần học thuật toán Banker nâng cao ở giai đoạn này.

06.4. CPU scheduling: chỉ phần đủ đọc MCQ

Thuật ngữ Trực giác Nhớ nhanh
FCFS ai đến trước chạy trước order of arrival
SJF việc ngắn trước có thể khiến job dài chờ lâu
Round Robin mỗi job một lát CPU time quantum
Priority ưu tiên cao được chọn starvation nếu không điều tiết
Preemptive có thể ngắt để chuyển CPU khác non-preemptive
Turnaround time từ lúc đến đến lúc hoàn tất completion − arrival
Waiting time thời gian chờ trong ready queue không giống turnaround
Context switch CPU đổi context thực thi có overhead

06.5. Java Memory / GC ở mức entry-level

Câu hỏi phỏng vấn: What is the difference between a process and a thread?

A process has its own virtual address space, while threads within one process share many resources, including heap objects. Each thread has its own execution stack. Shared state requires care because concurrent access can cause race conditions.

Bài biến thể — không xem gợi ý: Hai requests tăng viewCount bằng count = count + 1. Vì sao kết quả đôi khi tăng chỉ 1?

Gợi ý và đáp án

Cả hai có thể đọc cùng giá trị cũ rồi cùng ghi giá trị mới. Đây là lost update. Có thể dùng atomic update ở DB (SET count = count + 1) hoặc các cơ chế đồng bộ/locking phù hợp nơi state được quản lý. Không dùng volatile int đơn thuần để bảo đảm increment atomic.

🎙️ SPEAKING LAB V5.2 — 06. Threads, shared state và race conditions

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Process vs thread; heap/stack; concurrency vs parallelism; race; deadlock; synchronized vs DB.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
share mutable state dùng chung dữ liệu có thể thay đổi
read the same value đọc cùng một giá trị
overwrite an update ghi đè một cập nhật
coordinate concurrent access điều phối truy cập đồng thời

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. Two threads may read the same counter value before either one writes.
  2. A Java lock does not protect shared database state across multiple application instances.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

A race condition can happen when . Both requests . I would protect ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 10 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q058 · MECHANISM / WHY · BASE V4

TTS 115 · Q: What is the difference between a process and a thread?

TTS 115 · Câu hỏi
Tải MP3 115
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.

TTS 116 · Đáp án
Tải MP3 116
Q059 · MECHANISM / WHY · BASE V4

TTS 117 · Q: Why can count++ lose increments under concurrent requests?

TTS 117 · Câu hỏi
Tải MP3 117
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.

TTS 118 · Đáp án
Tải MP3 118
Q060 · MECHANISM / WHY · BASE V4

TTS 119 · Q: Why might synchronized be insufficient in a multi-instance backend?

TTS 119 · Câu hỏi
Tải MP3 119
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.

TTS 120 · Đáp án
Tải MP3 120
Q061 · FOUNDATION · BASE V4

TTS 121 · Q: Does volatile make count++ atomic?

TTS 121 · Câu hỏi
Tải MP3 121
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.

TTS 122 · Đáp án
Tải MP3 122
Q062 · FOUNDATION · ADD V5

TTS 123 · Q: What is a race condition?

TTS 123 · Câu hỏi
Tải MP3 123
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.

TTS 124 · Đáp án
Tải MP3 124
Q063 · FOUNDATION · ADD V5

TTS 125 · Q: What is a deadlock?

TTS 125 · Câu hỏi
Tải MP3 125
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.

TTS 126 · Đáp án
Tải MP3 126
Q064 · MECHANISM / WHY · ADD V5

TTS 127 · Q: What is the difference between concurrency and parallelism?

TTS 127 · Câu hỏi
Tải MP3 127
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.

TTS 128 · Đáp án
Tải MP3 128
Q065 · MECHANISM / WHY · ADD V5

TTS 129 · Q: What is the difference between a thread's stack and the JVM heap?

TTS 129 · Câu hỏi
Tải MP3 129
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.

TTS 130 · Đáp án
Tải MP3 130
Q066 · MECHANISM / WHY · ADD V5

TTS 131 · Q: What is the difference between synchronized and ReentrantLock?

TTS 131 · Câu hỏi
Tải MP3 131
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.

TTS 132 · Đáp án
Tải MP3 132
Q067 · FOUNDATION · ADD V5

TTS 133 · Q: What can cause memory leaks in a Java application even with garbage collection?

TTS 133 · Câu hỏi
Tải MP3 133
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.

TTS 134 · Đáp án
Tải MP3 134

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q068 · SCENARIO / FOLLOW-UP · BASE V4

TTS 135 · Q: When would you choose an atomic SQL update over an in-memory lock?

TTS 135 · Câu hỏi
Tải MP3 135
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.

TTS 136 · Đáp án
Tải MP3 136

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

Threads in one process share many resources, including heap objects, but each thread has its own execution stack. With count++, two threads can read the same value and overwrite each other, so one increment is lost. Volatile does not make that compound operation atomic. For data shared across multiple backend instances, I would consider an authoritative database update or suitable database locking.

Knowledge guardrail: Concurrency không nhất thiết là parallelism; volatile không thay thế atomic operation.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 06.



CHẶNG IV — GHÉP LLD, TESTING VÀ THIẾT KẾ HỆ THỐNG


MÔ-ĐUN 07 [CORE] — LLD bước 2: Hotel Booking + states + concurrency

Mục tiêu: ghép những khối ở Mô-đun 03 thành một design có tính “interview-ready”.

07.1. Đề bài và cách khoanh phạm vi

Design a hotel booking module. Customers can request a room, staff can approve it, and customers can cancel before check-in.

Hỏi interviewer 4 điều trước: booking có thanh toán không? xác định theo phòng vật lý hay loại phòng? inventory lấy local DB hay external provider? quy tắc cancel cụ thể?

Giả định để học: 1 booking = 1 phòng vật lý cho nhiều đêm; xác nhận cần staff approval; payment chưa nằm trong MVP; inventory chỉ quản lý local DB. Khi đề thay đổi, nói lại assumption.

07.2. Các entities bắt buộc trước khi nghĩ tới class code

Entity Field quan trọng Tại sao cần
Customer id, email chủ booking
Room id, roomType, active phòng được đặt
Booking id, customerId, roomId, checkIn, checkOut, status yêu cầu và vòng đời
BookingNight / InventoryHold roomId, date, bookingId, holdState chống giữ trùng một đêm tùy mô hình
BookingAudit bookingId, action, actorId, occurredAt truy nguyên thay đổi [PLUS]

Rule: dùng khoảng ngày [checkIn, checkOut), tức check-out date không tính là một đêm lưu trú; muốn đặt 20→22 thì giữ đêm 20 và 21.

07.3. State machine

PENDING --staff approves--> CONFIRMED
   |                         |
   | staff rejects           | customer cancels (if allowed)
   v                         v
REJECTED                   CANCELLED

CONFIRMED --stay completed--> COMPLETED

Một số nghiệp vụ yêu cầu hold inventory ngay khi PENDING, một số chỉ giữ khi CONFIRMED; đây là trade-off cần làm rõ, không đoán. Nếu PENDING giữ phòng, phải có chính sách hết hạn hold.

Đề kiểm tra: CANCELLED → CONFIRMED có hợp lệ? Không trong state machine đang giả định; muốn cho phép khôi phục phải thiết kế thêm rule riêng.

07.4. API contract cho MVP

POST   /api/bookings                 tạo request
GET    /api/bookings/{id}            xem trạng thái
POST   /api/bookings/{id}/approve    staff approval
POST   /api/bookings/{id}/reject     staff rejection
POST   /api/bookings/{id}/cancel     cancel theo chính sách

Vì approve là một state transition có side effect, nên endpoint hành động có thể được chọn rõ ràng thay vì ép tất cả thành PUT/DELETE. Status codes: 201 mới tạo; 200/204 hành động thành công; 400 input sai; 401/403 auth; 404 không tìm thấy; 409 trạng thái không hợp lệ hoặc inventory conflict.

07.5. Các classes và đường đi request

BookingController
  ↓
BookingService
  ├─ BookingPolicy (state transitions, cancellation rules)
  ├─ InventoryReservationService (atomic allocation)
  ├─ BookingRepository
  └─ NotificationPort (không để email failure tự quyết định DB transaction)

Phỏng vấn viên hỏi: “Why do you need BookingPolicy?”

It keeps business rules separate from HTTP handling and persistence. For example, it checks whether cancellation is allowed based on the booking status and check-in date.

07.6. Worked sequence — booking phòng cuối

Customer → API: POST booking with room/date + idempotency key
API → Service: validate input, identity, date range
Service → DB transaction: check/allocate every required night with conflict protection
DB → Service: success OR conflict
Service → DB: create Booking + status; commit
Service → API: created booking ID/status
API → Customer: 201

Nếu client timeout rồi retry bằng cùng idempotency key, service nên trả/tra lại kết quả phù hợp mà không tạo booking thứ hai. Key phải có scope, request fingerprint/expiry và chính sách concurrent duplicate requests rõ ràng.

Lỗi hay mắc: “Tôi check available=true rồi insert booking” nhưng quên rằng hai request có thể cùng đọc available=true. Kiểm tra logic trên Java trước insert không đủ khi concurrent operations.

07.7. Bài tập biến thể, giảm gợi ý

Đề: Add a waiting list when rooms are fully booked. If a reservation is cancelled, notify the next eligible customer.

Hãy tự điền: 1. Entity mới? ___ 2. State mới? ___ 3. Ai được vào waitlist? ___ 4. Nếu email notification fails? ___ 5. Nếu hai phòng cùng trống? ___ 6. Một test concurrent? ___

Đáp án tham khảo (không có một design duy nhất)
  1. WaitlistEntry(id, customerId, roomType, dateRange, createdAt, status).
  2. WAITING → OFFERED → ACCEPTED / EXPIRED / DECLINED.
  3. Rule về quyền, chính sách trùng danh sách và thứ tự ưu tiên phải xác nhận.
  4. Ghi nhận trạng thái và retry delivery; không phụ thuộc email được gửi đúng một lần.
  5. Quyết định allocation dưới transaction/constraint tránh cấp hai offers không hợp lệ; quy tắc ưu tiên do khách hàng quy định.
  6. Hai workers cùng xử lý một waitlist entry, chỉ một chuyển WAITING → OFFERED thành công.

07.8. Checklist LLD khi đi phỏng vấn

🎙️ SPEAKING LAB V5.2 — 07. Hotel Booking LLD + state machine

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Actors; booking nights; PENDING/CONFIRMED/CANCELLED; atomic allocation; idempotent retries.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
reserve each night giữ chỗ cho từng đêm
approve a pending booking duyệt booking chờ
invalid state transition chuyển trạng thái không hợp lệ
avoid double booking tránh đặt trùng phòng

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. I would model booking states explicitly and validate each transition.
  2. Inventory allocation must protect every required night from concurrent conflicts.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

I assume ___ and . The booking starts in . I would prevent double booking by ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 3 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q069 · FOUNDATION · BASE V4

TTS 137 · Q: Design a booking module where staff must approve requests.

TTS 137 · Câu hỏi
Tải MP3 137
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.

TTS 138 · Đáp án
Tải MP3 138
Q070 · MECHANISM / WHY · BASE V4

TTS 139 · Q: Should pending bookings hold inventory? What is the trade-off?

TTS 139 · Câu hỏi
Tải MP3 139
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.

TTS 140 · Đáp án
Tải MP3 140
Q071 · FOUNDATION · ADD V5

TTS 141 · Q: What is a state transition in a booking system?

TTS 141 · Câu hỏi
Tải MP3 141
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.

TTS 142 · Đáp án
Tải MP3 142

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q072 · SCENARIO / FOLLOW-UP · BASE V4

TTS 143 · Q: How do you handle two requests for the same room and night?

TTS 143 · Câu hỏi
Tải MP3 143
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.

TTS 144 · Đáp án
Tải MP3 144
Q073 · SCENARIO / FOLLOW-UP · BASE V4

TTS 145 · Q: What changes if a customer can cancel before check-in?

TTS 145 · Câu hỏi
Tải MP3 145
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.

TTS 146 · Đáp án
Tải MP3 146
Q074 · SCENARIO / FOLLOW-UP · BASE V4

TTS 147 · Q: What if a booking contains multiple nights and allocation fails halfway through?

TTS 147 · Câu hỏi
Tải MP3 147
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.

TTS 148 · Đáp án
Tải MP3 148
Q075 · SCENARIO / FOLLOW-UP · ADD V5

TTS 149 · Q: How would you prevent double booking for overlapping date ranges?

TTS 149 · Câu hỏi
Tải MP3 149
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.

TTS 150 · Đáp án
Tải MP3 150
Q076 · SCENARIO / FOLLOW-UP · ADD V5

TTS 151 · Q: What happens if an external hotel provider confirms a room but our database update fails?

TTS 151 · Câu hỏi
Tải MP3 151
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.

TTS 152 · Đáp án
Tải MP3 152

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

For a small booking system, I would model Customer, Room, Booking, and a way to reserve individual nights. A booking can move from pending to confirmed after staff approval. I would clarify whether pending bookings hold inventory, because that affects availability. To prevent double booking, allocation must be protected by suitable database constraints or concurrency control. I would test overlapping requests and failed multi-night reservations.

Knowledge guardrail: Không tự giả định PENDING có giữ chỗ hay không; phải thống nhất chính sách.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 07.



MÔ-ĐUN 08 [CORE] — Testing, Cloud, Security, Java & DSA: những gì cần để đọc đề và bảo vệ giải pháp

Mục tiêu: không học chứng chỉ. Chỉ học “tôi đã triển khai tính năng, vậy làm sao biết nó đúng, an toàn, vận hành được?”.

08.1. Testing từ trực giác đến lựa chọn

Loại test Câu hỏi trả lời Ví dụ booking
Unit test Một hàm/quy tắc có đúng? Check-out phải sau check-in
Integration test Các thành phần thực sự phối hợp đúng? Service + PostgreSQL transaction
End-to-end (E2E) Luồng từ UI/API đến hệ thống hoạt động? User đặt phòng rồi nhận mã
Regression test Sửa lỗi này có phá thứ khác? Hủy booking không làm lỗi giữ phòng
Smoke test Bản build có chạy chức năng trọng yếu? API booking health và thao tác đơn giản
Load test Khi nhiều request hệ thống có đáp ứng mục tiêu? concurrent availability reads

Bài thực hành: Ngày 20/10 không còn phòng, nhưng API vẫn trả 201. Hãy viết 3 tests: happy path, validation/boundary, concurrency/conflict.

Đáp án mẫu
  1. Có phòng, ngày hợp lệ → tạo booking và trả ID/expected status.
  2. Ngày checkout <= checkin hoặc guestCount=0 → trả 400, không tạo booking.
  3. Hai concurrent requests cho phòng cuối → chỉ một được xác nhận; request còn lại nhận conflict hoặc trạng thái từ chối thích hợp; assert DB invariant.

08.2. Cloud và triển khai: định nghĩa + ứng dụng

Thuật ngữ Cần hiểu thực tế
On-premises hệ thống đặt tại hạ tầng do đơn vị trực tiếp quản lý
Public/private/hybrid cloud mô hình tổ chức và triển khai cloud, không phải cấp độ dịch vụ
IaaS/PaaS/SaaS nhà cung cấp quản lý đến tầng nào
VM vs container VM có guest OS riêng; container thường chia sẻ kernel host và cô lập processes
Hypervisor Type 1/2 chạy trực tiếp trên phần cứng / trên host OS
Scalability vs elasticity có thể tăng năng lực / tự tăng giảm năng lực theo nhu cầu
Horizontal vs vertical scaling thêm instances / tăng tài nguyên của instance
CI / CD tích hợp & kiểm thử tự động / sẵn sàng phát hành hoặc tự triển khai
Logging / metrics / tracing sự kiện văn bản / số đo / theo dấu request qua components
SLA / SLO / SLI cam kết dịch vụ / mục tiêu / số đo chất lượng
P95 vs throughput 95% requests nhanh hơn ngưỡng đo được / số request hoàn tất mỗi đơn vị thời gian
RTO / RPO [PLUS] thời gian hồi phục tối đa mục tiêu / mức mất dữ liệu cho phép

Ví dụ: ứng dụng chậm khi lượng người dùng tăng. Trước khi hô “microservices”, kiểm tra query plan, app logs, latency distribution, CPU/memory, connection pool, external dependency. Có thể vấn đề là SQL index chứ không phải số lượng servers.

08.3. Security cơ bản — nhìn theo rủi ro

08.4. Java Core và OOP — đối chiếu theo lỗi hay hỏi

Cặp dễ nhầm Trả lời đủ dùng
Overloading / overriding khác parameter list / subtype thay implementation phù hợp
== / equals() object identity / logical equality
equals() / hashCode() objects bằng nhau phải có hash code bằng nhau; chiều ngược không cần
Interface / abstract class contract và nhiều inheritance of type / base class có thể chứa state + implementation
Checked / unchecked exceptions compiler yêu cầu handle/declare vs RuntimeException và subclasses
final / finally / finalize keyword hạn chế thay đổi / cleanup block / cơ chế cũ deprecated-for-removal, không dựa vào
Comparable / Comparator natural ordering / external comparison rule
Shallow / deep copy object con có thể share references / tạo độc lập theo chiều sâu cần thiết
DI / dependency inversion cách truyền dependency / nguyên lý phụ thuộc abstractions
List / Set / Map danh sách có thứ tự / tập duy nhất / key-value
HashMap / ConcurrentHashMap map thông thường không thread-safe / hỗ trợ concurrent access theo contract
Stream / collection stream là pipeline thao tác, không phải nơi lưu dữ liệu
Optional biểu diễn giá trị có thể vắng mặt; không dùng tùy tiện mọi field/entity

Java ví dụ tối thiểu:

List<String> names = List.of("An", "Binh", "Chi");
List<String> filtered = names.stream()
    .filter(name -> name.length() > 2)
    .map(String::toUpperCase)
    .toList();
// [BINH, CHI] (toList() có từ Java 16)

Tự giải thích bằng tiếng Anh: The stream filters names with more than two characters, converts the remaining names to uppercase, and collects them into a list.

08.5. DSA vocabulary và complexity — đủ dùng cho lời giải

Sorting Best* Average* Worst* Nhớ gì
Bubble (early-stop) O(n) O(n²) O(n²) stable bản phổ biến
Selection O(n²) O(n²) O(n²) O(1) extra, không stable bản phổ biến
Insertion O(n) O(n²) O(n²) tốt với nearly sorted
Merge O(n log n) O(n log n) O(n log n) extra O(n) cho arrays
Quick O(n log n) O(n log n) O(n²) pivot lệch gây worst
Heap O(n log n) O(n log n) O(n log n) heap property

Các giá trị theo implementation thường được dạy; không đánh đồng toàn bộ biến thể.

Câu tự nói: My solution uses a hash map to count occurrences in O(n) expected time, with O(k) extra space for k distinct keys.

08.6. Glossary nén để không bỏ mất nội dung hai file cũ [PLUS]

Nhóm Thuật ngữ cần nhận ra Chỉ cần hiểu
Hardware CPU, ALU, RAM, ROM, SSD, cache, binary/hex, bit/byte xử lý / bộ nhớ / biểu diễn dữ liệu
Numeric signed/unsigned, overflow, precision/scale, truncation/rounding giới hạn giá trị / độ chính xác
OS virtual memory, paging, page fault, fragmentation, user/kernel mode ánh xạ RAM và quyền thực thi
DB theory 1NF/2NF/3NF, candidate/super/composite key, functional dependency giảm bất thường dữ liệu; định danh rows
DB performance index scan/seek, query plan, N+1, replication, partitioning hiểu chi phí truy xuất
Network MAC, IP, NAT, router, switch, OSI, TLS yêu cầu đi qua network thế nào
Delivery SDLC, Agile, Scrum, sprint, backlog, user story cách tổ chức công việc
Java type erasure, GC, upcasting/downcasting, static/dynamic binding cơ chế runtime/compile time
SQL Server [PLUS] money, bit, real là numeric; image là legacy binary nếu bài MCQ SQL Server hỏi loại data type
Reliability [PLUS] failover, redundancy, backpressure, circuit breaker chống lỗi và kiểm soát tải

Checkpoint CS (tự nói không nhìn file): “A user times out when booking the last room. What problems could occur from the browser to the database? How would you verify the behavior?” Nếu bạn tách được network timeout, duplicate retry, DB concurrency, logging/test, bạn đã liên kết được phần nền tảng thay vì học rời rạc.

🎙️ SPEAKING LAB V5.2 — 08. Testing, Cloud, Security và DSA recap

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Unit/integration/E2E; boundary/regression; authn/authz; logs/metrics/traces; cloud/scaling.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
write a regression test viết test chống tái phát lỗi
check authorization kiểm tra phân quyền
measure latency đo độ trễ
identify the bottleneck tìm điểm nghẽn

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. An integration test checks whether components work together with a real database.
  2. Before scaling the application, I would inspect latency, logs, and database queries.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

I would start with a ___ test. It should verify . If the system is slow, I would .

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 12 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q077 · MECHANISM / WHY · BASE V4

TTS 153 · Q: How do unit tests differ from integration tests?

TTS 153 · Câu hỏi
Tải MP3 153
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.

TTS 154 · Đáp án
Tải MP3 154
Q078 · FOUNDATION · BASE V4

TTS 155 · Q: Does high test coverage guarantee there are no bugs?

TTS 155 · Câu hỏi
Tải MP3 155
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.

TTS 156 · Đáp án
Tải MP3 156
Q079 · MECHANISM / WHY · BASE V4

TTS 157 · Q: What is the difference between authentication and authorization?

TTS 157 · Câu hỏi
Tải MP3 157
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.

TTS 158 · Đáp án
Tải MP3 158
Q080 · FOUNDATION · ADD V5

TTS 159 · Q: What is mocking in unit testing?

TTS 159 · Câu hỏi
Tải MP3 159
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.

TTS 160 · Đáp án
Tải MP3 160
Q081 · MECHANISM / WHY · ADD V5

TTS 161 · Q: What is the difference between authentication and role-based authorization?

TTS 161 · Câu hỏi
Tải MP3 161
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.

TTS 162 · Đáp án
Tải MP3 162
Q082 · MECHANISM / WHY · ADD V5

TTS 163 · Q: What is the difference between symmetric and asymmetric encryption?

TTS 163 · Câu hỏi
Tải MP3 163
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.

TTS 164 · Đáp án
Tải MP3 164
Q083 · MECHANISM / WHY · ADD V5

TTS 165 · Q: What is the difference between a virtual machine and a container?

TTS 165 · Câu hỏi
Tải MP3 165
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.

TTS 166 · Đáp án
Tải MP3 166
Q084 · FOUNDATION · ADD V5

TTS 167 · Q: What does Big O notation describe?

TTS 167 · Câu hỏi
Tải MP3 167
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.

TTS 168 · Đáp án
Tải MP3 168
Q085 · MECHANISM / WHY · ADD V5

TTS 169 · Q: What is the difference between a stack and a queue?

TTS 169 · Câu hỏi
Tải MP3 169
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.

TTS 170 · Đáp án
Tải MP3 170
Q086 · MECHANISM / WHY · ADD V5

TTS 171 · Q: What is the difference between BFS and DFS?

TTS 171 · Câu hỏi
Tải MP3 171
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.

TTS 172 · Đáp án
Tải MP3 172
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)?

TTS 173 · Câu hỏi
Tải MP3 173
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.

TTS 174 · Đáp án
Tải MP3 174
Q088 · FOUNDATION · ADD V5

TTS 175 · Q: How can you prevent SQL injection in a Java backend?

TTS 175 · Câu hỏi
Tải MP3 175
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.

TTS 176 · Đáp án
Tải MP3 176

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q089 · SCENARIO / FOLLOW-UP · BASE V4

TTS 177 · Q: How would you test that only staff can approve a booking?

TTS 177 · Câu hỏi
Tải MP3 177
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.

TTS 178 · Đáp án
Tải MP3 178
Q090 · SCENARIO / FOLLOW-UP · BASE V4

TTS 179 · Q: An application is slow. Would you add more servers immediately?

TTS 179 · Câu hỏi
Tải MP3 179
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.

TTS 180 · Đáp án
Tải MP3 180
Q091 · SCENARIO / FOLLOW-UP · ADD V5

TTS 181 · Q: How would you explain the time complexity of binary search?

TTS 181 · Câu hỏi
Tải MP3 181
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.

TTS 182 · Đáp án
Tải MP3 182

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

A unit test checks a small rule in isolation, while an integration test verifies how real components work together, such as a service and PostgreSQL. For staff approval, I would test valid access and a forbidden request from a normal customer. If the application is slow, I would inspect logs, latency metrics, and SQL queries before deciding whether more servers are needed.

Knowledge guardrail: Coverage chỉ là chỉ số phạm vi chạy code, không chứng minh không có lỗi.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 08.




MÔ-ĐUN 08A [CORE][JAVA BACKEND] — Java Core + OOP: từ biết dùng đến giải thích được cơ chế

Vì sao bổ sung? Mục 08.4 phía trên chỉ là bảng ôn nhanh. Mô-đun này dành cho ứng viên đã code Java cơ bản nhưng dễ bí khi interviewer hỏi why / what if / show me. Mục tiêu Intern/Fresher/Junior 0–1 năm: không học JVM nội bộ đến mức senior, không học thuộc câu trả lời dài.

Thứ tự mỗi cụm: PRETEST → WATCH → COMPLETE → DO → EXPLAIN theo cách học ở START HERE. Có thể bỏ qua WATCH nếu tự giải được DO và giải thích rõ.

08A.0. PRETEST — 8 câu (6 phút, chưa xem phần dưới)

  1. Hai Counter objects có static int total và int ownCount: gọi increment() trên object A thì B nhìn thấy trường nào đổi?
  2. Vì sao static void print() không thể trực tiếp dùng một instance field mà không có object?
  3. Vì sao hai object có equals() trả true phải có cùng hashCode()?
  4. Với List<String> xs = new ArrayList<>(), khác gì Set<String> khi thêm trùng?
  5. change(name) nhận String name rồi gán name = "new": biến bên ngoài có đổi không?
  6. Một HashMap dùng làm shared state giữa nhiều threads có an toàn không?
  7. Khác nhau thế nào giữa overloading và overriding? Static method có override không?
  8. count++ trên static int count có đảm bảo chính xác khi hai threads cùng gọi không?

Phân luồng: sai (1–2) → 08A.1; (3–5) → 08A.2–3; (6–8) → 08A.4–5. Nếu đúng hết, làm ngay DO/MOCK ở 08A.6.

08A.1. static / instance / final: một ví dụ từ đơn giản đến tình huống

WATCH — code có thể chạy bằng Java 21:

class Counter {
    static int total = 0;  // Một field gắn với lớp Counter (trong một class-loader context)
    int ownCount = 0;      // Mỗi object có field riêng

    void increment() {
        total++;
        ownCount++;
    }
    static int totalSoFar() { return total; }
}

class Demo {
    public static void main(String[] args) {
        Counter a = new Counter();
        Counter b = new Counter();
        a.increment();
        a.increment();
        b.increment();
        System.out.println(Counter.totalSoFar()); // 3
        System.out.println(a.ownCount);           // 2
        System.out.println(b.ownCount);           // 1
    }
}

COMPLETE — điền trước khi mở đáp án:

class Config {
    static final int MAX_RETRIES = 3;
    private String environment;
    Config(String environment) { this.environment = environment; }
    // Viết static method trả MAX_RETRIES và instance method trả environment.
}
Đáp án COMPLETE
static int maxRetries() { return MAX_RETRIES; }
String environment() { return environment; }

Nếu muốn environment truy cập từ static method, cần truyền Config config vào hoặc xác định object cụ thể. Không nên biến field thành static chỉ để tránh truyền object.

DO — đề biến thể (5 phút): Cart chứa static double discountPercent và double subtotal. Bạn muốn mỗi giỏ có chính sách giảm giá khác nhau. Thiết kế hiện tại có rủi ro gì? Sửa field nào? Nếu nhiều luồng cùng cập nhật tổng doanh thu của cửa hàng thì sao?

Gợi ý / đáp án DO

discountPercent hiện dùng chung cho mọi Cart, cập nhật một giỏ có thể ảnh hưởng giỏ khác. Nếu mỗi giỏ có discount riêng, chuyển nó thành instance field (hoặc object policy được truyền vào). Tổng doanh thu là shared mutable state: static không bảo đảm atomicity; nếu quản lý tiền thật cần quy tắc update ở authoritative store/database, không dựa đơn thuần vào counter RAM.

EXPLAIN: “A static field belongs to the class and is shared across instances, while an instance field belongs to each object. Static alone does not make updates thread-safe.” Nói thêm một ví dụ.

MICRO SPEAK V5.2 — sau mục 08A.1 · 4 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: No. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (4 câu)

Q092 · MECHANISM / WHY · BASE V4

TTS 183 · Q: Does static imply thread safety? Why not?

TTS 183 · Câu hỏi
Tải MP3 183
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.

TTS 184 · Đáp án
Tải MP3 184
Q093 · FOUNDATION · ADD V5

TTS 185 · Q: What does static mean, and does it imply thread safety?

TTS 185 · Câu hỏi
Tải MP3 185
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.

TTS 186 · Đáp án
Tải MP3 186
Q094 · MECHANISM / WHY · ADD V5

TTS 187 · Q: What happens when you invoke a static method through a superclass reference to a subclass object?

TTS 187 · Câu hỏi
Tải MP3 187
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.

TTS 188 · Đáp án
Tải MP3 188
Q095 · MECHANISM / WHY · ADD V5

TTS 189 · Q: What is the difference between final, finally, and finalize?

TTS 189 · Câu hỏi
Tải MP3 189
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.

TTS 190 · Đáp án
Tải MP3 190

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08A.2. Reference, pass-by-value, String, equality và hashCode()

WATCH — mô hình cần nhớ: Java luôn truyền arguments by value. Với object, giá trị được truyền là bản sao của reference. Method có thể sửa object thông qua reference đó, nhưng gán biến parameter sang object khác không đổi biến của caller.

import java.util.*;
class Demo {
    static void append(List<String> items) { items.add("B"); }
    static void replace(List<String> items) { items = new ArrayList<>(); items.add("C"); }
    public static void main(String[] args) {
        List<String> xs = new ArrayList<>(List.of("A"));
        append(xs);
        replace(xs);
        System.out.println(xs); // [A, B]
    }
}

COMPLETE: Kết quả đoạn sau là gì? Vì sao?

String x = new String("java");
String y = new String("java");
System.out.println(x == y);       // ?
System.out.println(x.equals(y));  // ?
String z = x.toUpperCase();
System.out.println(x);            // ?
Đáp án COMPLETE

false, true, java; biến z chứa JAVA. Hai lần new String tạo hai object khác nhau; equals so nội dung; String immutable.

DO — hai bug rất hay gặp:

  1. Một HashSet<Customer> chứa hai objects khác nhau có cùng customerId, nhưng vẫn giữ cả hai. Có thể sai ở đâu?
  2. Dùng object OrderKey(id, status) mutable làm key cho HashMap, sau đó đổi status; tại sao map.get(key) có thể thất bại?
Gợi ý / đáp án DO
  1. Nếu muốn equality theo customerId, phải định nghĩa equals và hashCode nhất quán; mặc định Object so identity. Không mặc định mọi entity phải so theo ID khi ID chưa được cấp hoặc đổi.
  2. Nếu các field dùng tính hash/equality thay đổi, key có thể nằm ở bucket cũ và lookup theo hash mới không tìm đúng. Dùng immutable key, chẳng hạn record OrderKey(UUID id, String status) {} nếu các components thực sự hợp business semantics, hoặc chỉ dùng ID ổn định.

MICRO SPEAK V5.2 — sau mục 08A.2 · 8 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: For object references, double equals compares whether they point to the same object. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (8 câu)

Q096 · MECHANISM / WHY · BASE V4

TTS 191 · Q: What is the difference between == and equals for objects?

TTS 191 · Câu hỏi
Tải MP3 191
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.

TTS 192 · Đáp án
Tải MP3 192
Q097 · MECHANISM / WHY · BASE V4

TTS 193 · Q: Why can mutable HashMap keys cause problems?

TTS 193 · Câu hỏi
Tải MP3 193
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.

TTS 194 · Đáp án
Tải MP3 194
Q098 · MECHANISM / WHY · BASE V4

TTS 195 · Q: What does Java pass when you pass an object to a method?

TTS 195 · Câu hỏi
Tải MP3 195
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.

TTS 196 · Đáp án
Tải MP3 196
Q099 · MECHANISM / WHY · ADD V5

TTS 197 · Q: Why do HashMap keys need a stable hashCode and equals contract?

TTS 197 · Câu hỏi
Tải MP3 197
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.

TTS 198 · Đáp án
Tải MP3 198
Q100 · MECHANISM / WHY · ADD V5

TTS 199 · Q: Why doesn't changing a method's object parameter reference replace the caller's reference?

TTS 199 · Câu hỏi
Tải MP3 199
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.

TTS 200 · Đáp án
Tải MP3 200
Q101 · MECHANISM / WHY · ADD V5

TTS 201 · Q: What is the difference between String, StringBuilder, and StringBuffer?

TTS 201 · Câu hỏi
Tải MP3 201
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.

TTS 202 · Đáp án
Tải MP3 202
Q102 · MECHANISM / WHY · ADD V5

TTS 203 · Q: What is the difference between stack memory and heap memory in Java?

TTS 203 · Câu hỏi
Tải MP3 203
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.

TTS 204 · Đáp án
Tải MP3 204
Q103 · MECHANISM / WHY · ADD V5

TTS 205 · Q: What is the difference between equals and hashCode contracts?

TTS 205 · Câu hỏi
Tải MP3 205
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.

TTS 206 · Đáp án
Tải MP3 206

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08A.3. OOP, access modifiers và polymorphism — khi nào dùng interface?

WATCH:

Chủ đề Cần nắm để trả lời phỏng vấn
Encapsulation Che state, kiểm soát cách thay đổi qua methods; không phải “mọi field có getter/setter”
Inheritance Quan hệ is-a và kế thừa behavior; không thay thế composition một cách vô điều kiện
Polymorphism Reference kiểu cha/interface có thể gọi implementation của object thực tế (instance methods overridden)
Abstraction Công khai contract quan trọng, ẩn chi tiết implementation
Overload Cùng tên method, parameter list khác; chọn overload chủ yếu tại compile time
Override Subclass implement lại instance method phù hợp; runtime dynamic dispatch
private / package-private / protected / public Trong class / cùng package / package & subclass theo quy tắc access / truy cập công khai
Interface / abstract class Interface cho contract và nhiều implementation; abstract class có thể có state/constructor và logic chia sẻ
Composition CheckoutService has a PricingPolicy; thường dễ thay đổi logic hơn lạm dụng inheritance

WATCH — code ví dụ:

interface DiscountPolicy {
    int discount(int subtotal);
}
class NoDiscount implements DiscountPolicy {
    public int discount(int subtotal) { return 0; }
}
class TenPercent implements DiscountPolicy {
    public int discount(int subtotal) { return subtotal / 10; }
}
class CheckoutService {
    private final DiscountPolicy policy;
    CheckoutService(DiscountPolicy policy) { this.policy = policy; }
    int finalPrice(int subtotal) { return subtotal - policy.discount(subtotal); }
}

Đây là Strategy + constructor injection bằng Java thuần. Bạn có thể thay policy mà không viết nhiều if bên trong CheckoutService. Không cần tạo interface cho mọi class; chỉ tạo abstraction khi giải quyết được nhu cầu thực tế.

COMPLETE: Đổi từ NoDiscount sang TenPercent mà không sửa CheckoutService như thế nào? Vì sao ví dụ này thể hiện polymorphism?

Đáp án COMPLETE
CheckoutService service = new CheckoutService(new TenPercent());
System.out.println(service.finalPrice(100)); // 90

CheckoutService biết contract DiscountPolicy, implementation thực tế quyết định kết quả tại runtime.

DO — follow-up: Interviewer yêu cầu “thêm discount VIP”. Bạn sẽ thêm subclass của CheckoutService hay thêm implementation DiscountPolicy? Khi nào một interface trở nên không cần thiết?

Gợi ý / đáp án DO

Thêm policy implementation thường hợp lý hơn vì yêu cầu chỉ thay đổi thuật toán tính giảm giá. Nếu chỉ có một policy và không có nhu cầu thay đổi/test seam, một class đơn giản có thể đủ; tránh overengineering.

MICRO SPEAK V5.2 — sau mục 08A.3 · 7 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: I would use an interface to define a contract that different classes can implement. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (6 câu)

Q104 · MECHANISM / WHY · ADD V5

TTS 207 · Q: What's the difference between interface and abstract class?

TTS 207 · Câu hỏi
Tải MP3 207
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.

TTS 208 · Đáp án
Tải MP3 208
Q105 · MECHANISM / WHY · ADD V5

TTS 209 · Q: What's the difference between an overloaded and an overridden method?

TTS 209 · Câu hỏi
Tải MP3 209
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.

TTS 210 · Đáp án
Tải MP3 210
Q106 · FOUNDATION · ADD V5

TTS 211 · Q: What is encapsulation in object-oriented programming?

TTS 211 · Câu hỏi
Tải MP3 211
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.

TTS 212 · Đáp án
Tải MP3 212
Q107 · MECHANISM / WHY · ADD V5

TTS 213 · Q: What is inheritance, and when could composition be better?

TTS 213 · Câu hỏi
Tải MP3 213
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.

TTS 214 · Đáp án
Tải MP3 214
Q108 · FOUNDATION · ADD V5

TTS 215 · Q: What is polymorphism in Java?

TTS 215 · Câu hỏi
Tải MP3 215
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.

TTS 216 · Đáp án
Tải MP3 216
Q109 · FOUNDATION · ADD V5

TTS 217 · Q: What is abstraction in OOP?

TTS 217 · Câu hỏi
Tải MP3 217
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.

TTS 218 · Đáp án
Tải MP3 218

FOLLOW-UP — case / phản biện (1 câu)

Q110 · SCENARIO / FOLLOW-UP · BASE V4

TTS 219 · Q: When would you use an interface rather than an abstract class?

TTS 219 · Câu hỏi
Tải MP3 219
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.

TTS 220 · Đáp án
Tải MP3 220

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08A.4. Collections, generics, Optional, Stream và exceptions

WATCH — phân biệt đủ dùng:

Công cụ Ý nghĩa và lỗi hay gặp
ArrayList Index O(1), thêm cuối amortized O(1); chèn giữa/dồn phần tử O(n)
LinkedList Truy cập theo index O(n); chèn tại vị trí đã biết có thể O(1), nhưng tìm vị trí vẫn tốn chi phí
HashSet / HashMap Lookup average/expected O(1) giả định hash phân bố phù hợp; phụ thuộc equals/hashCode; không tự thread-safe
TreeMap Keys sắp thứ tự; thông thường operations O(log n)
PriorityQueue Heap, offer/poll O(log n), peek O(1); không phải danh sách sorted hoàn toàn
Generics Kiểm tra kiểu tại compile time, Java dùng type erasure cho nhiều generic type information
Optional<T> Biểu diễn có/không có kết quả, hay ở API trả về; tránh get() mù và không áp dụng mọi entity field
Stream Pipeline map/filter/collect; thường lazy cho intermediate operations, chạy khi terminal operation được gọi
Checked exception IOException phải catch/declare; unchecked RuntimeException không bị compiler bắt buộc catch
Try-with-resources Tự đóng tài nguyên AutoCloseable kể cả khi có exception, khác với GC

WATCH — hai idiom ngắn:

Map<String, Integer> freq = new HashMap<>();
for (String s : List.of("A", "B", "A")) {
    freq.merge(s, 1, Integer::sum);
}
// {A=2, B=1} (thứ tự duyệt HashMap không được đảm bảo)

Optional<String> name = Optional.empty();
System.out.println(name.orElse("Unknown")); // Unknown

COMPLETE — dự đoán:

List<Integer> nums = new ArrayList<>(List.of(1, 2, 3, 4));
long count = nums.stream().filter(n -> n % 2 == 0).count();
// count = ? ; nums sau khi đếm = ?
Đáp án COMPLETE

count = 2; nums không đổi. Stream không tự sửa list ban đầu; các thao tác có side-effect trong stream cần cẩn trọng.

DO — Java interview nhỏ (8 phút): Viết Map<String,Integer> countByCategory(List<String> categories); bỏ qua null và chuỗi blank, trim khoảng trắng, gộp category không phân biệt hoa/thường. Viết hai test cases.

Đáp án tham khảo DO
static Map<String, Integer> countByCategory(List<String> categories) {
    Map<String, Integer> ans = new HashMap<>();
    for (String raw : categories) {
        if (raw == null || raw.isBlank()) continue;
        String key = raw.trim().toLowerCase(Locale.ROOT);
        ans.merge(key, 1, Integer::sum);
    }
    return ans;
}

Test: [" Food ", "food", "", null] → food=2; [] → empty map. Nếu parameter categories bản thân có thể null, cần định nghĩa contract và bổ sung xử lý, không âm thầm đoán.

MICRO SPEAK V5.2 — sau mục 08A.4 · 10 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: I usually choose ArrayList for indexed access and efficient iteration. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (8 câu)

Q111 · FOUNDATION · ADD V5

TTS 221 · Q: Can garbage collection replace closing a database connection?

TTS 221 · Câu hỏi
Tải MP3 221
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.

TTS 222 · Đáp án
Tải MP3 222
Q112 · MECHANISM / WHY · ADD V5

TTS 223 · Q: What is the difference between checked and unchecked exceptions?

TTS 223 · Câu hỏi
Tải MP3 223
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.

TTS 224 · Đáp án
Tải MP3 224
Q113 · MECHANISM / WHY · ADD V5

TTS 225 · Q: What is the difference between List, Set, and Map?

TTS 225 · Câu hỏi
Tải MP3 225
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.

TTS 226 · Đáp án
Tải MP3 226
Q114 · MECHANISM / WHY · ADD V5

TTS 227 · Q: What is the difference between HashMap and ConcurrentHashMap?

TTS 227 · Câu hỏi
Tải MP3 227
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.

TTS 228 · Đáp án
Tải MP3 228
Q115 · MECHANISM / WHY · ADD V5

TTS 229 · Q: What is the difference between HashSet and TreeSet?

TTS 229 · Câu hỏi
Tải MP3 229
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.

TTS 230 · Đáp án
Tải MP3 230
Q116 · FOUNDATION · ADD V5

TTS 231 · Q: What is a generic type in Java?

TTS 231 · Câu hỏi
Tải MP3 231
Mở đáp án mẫu Q116 — sau khi tự trả lời

TTS 232 · A: Generics let me express type constraints, such as List, at compile time. They improve type safety and reduce casts. Java implements most generic type checks through type erasure.

TTS 232 · Đáp án
Tải MP3 232
Q117 · MECHANISM / WHY · ADD V5

TTS 233 · Q: What is the difference between Comparable and Comparator?

TTS 233 · Câu hỏi
Tải MP3 233
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.

TTS 234 · Đáp án
Tải MP3 234
Q118 · MECHANISM / WHY · ADD V5

TTS 235 · Q: What is the difference between map and filter in Java Streams?

TTS 235 · Câu hỏi
Tải MP3 235
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.

TTS 236 · Đáp án
Tải MP3 236

FOLLOW-UP — case / phản biện (2 câu)

Q119 · SCENARIO / FOLLOW-UP · ADD V5

TTS 237 · Q: When would you choose ArrayList instead of LinkedList?

TTS 237 · Câu hỏi
Tải MP3 237
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.

TTS 238 · Đáp án
Tải MP3 238
Q120 · SCENARIO / FOLLOW-UP · ADD V5

TTS 239 · Q: When would you use Optional rather than returning null?

TTS 239 · Câu hỏi
Tải MP3 239
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. I would not automatically use Optional for every field or parameter.

TTS 240 · Đáp án
Tải MP3 240

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08A.5. Thread safety và dữ liệu: kết nối Java với Backend

WATCH:

class Counter {
    private int value;
    synchronized void increment() { value++; }
    synchronized int get() { return value; }
}

Trong một Counter object, hai synchronized instance methods dùng chung intrinsic lock của object đó. Nhưng nếu có hai Counter objects / hai JVM instances / hai backend pods, chúng không chia sẻ lock với nhau. volatile giúp visibility/order, không làm value++ atomic.

Khi data thật nằm ở PostgreSQL, hãy xét transaction + database locking/constraint/atomic conditional update thay vì tin rằng synchronized ở một application instance đã bảo vệ dữ liệu chung.

DO — tình huống: Hai người cùng mua sản phẩm còn 1 món. Vì sao synchronized method trong Spring service vẫn có thể không giải quyết được nếu chạy nhiều replicas? Thiết kế một test đồng thời và điều kiện sau test.

Đáp án DO

Mỗi replica có memory/lock riêng, cả hai có thể đọc tồn = 1 và đặt hàng. Dùng row lock (SELECT ... FOR UPDATE) hoặc atomic conditional update / constraint phù hợp trong DB; test hai requests bắt đầu chồng lấn, assert tối đa một đơn thành công và stock không âm. Isolation và transaction boundary phải phù hợp schema.

MICRO SPEAK V5.2 — sau mục 08A.5 · 1 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: Both requests may read the same old value and overwrite each other's update. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FOLLOW-UP — case / phản biện (1 câu)

Q121 · SCENARIO / FOLLOW-UP · ADD V5

TTS 241 · Q: Two requests increment a shared counter. What can go wrong?

TTS 241 · Câu hỏi
Tải MP3 241
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.

TTS 242 · Đáp án
Tải MP3 242

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08A.6. MOCK mới (12 phút): trả lời rồi mới mở đáp án

  1. What does static mean, and does it imply thread safety?
  2. Why do HashMap keys need a stable hashCode and equals contract?
  3. What's the difference between interface and abstract class?
  4. When would you choose ArrayList instead of LinkedList?
  5. What's the difference between an overloaded and an overridden method?
  6. Why doesn't changing a method's object parameter reference replace the caller's reference?
  7. When would you use Optional rather than returning null?
  8. Can garbage collection replace closing a database connection?
  9. What happens when you invoke a static method through a superclass reference to a subclass object?
  10. Two requests increment a shared counter. What can go wrong?
Rubric / câu trả lời tối thiểu (chỉ xem sau khi tự làm)
  1. Class-level membership; shared does not mean atomic/thread-safe.
  2. Hash lookup depends on consistent equality/hash, mutable keys can break lookup.
  3. Interface expresses contract; abstract class can share state/constructor/implementation; choose based on problem.
  4. Usually ArrayList for efficient random access and iteration; LinkedList only with a demonstrated need, account for search/memory costs.
  5. Overload changes parameter list, mainly compile-time selection; override replaces compatible instance method at runtime.
  6. Java passes a copy of reference value; reassigning that copy doesn't change caller variable.
  7. Optional on APIs where absence is expected; avoid blind get().
  8. No; connections are resources to close deterministically (try-with-resources or pool lifecycle).
  9. Static methods hide and selection depends on reference/class context; no dynamic overriding.
  10. Read–modify–write race / lost increments; synchronized, AtomicInteger, or authoritative DB operation depending on scope.

Chấm: 0 = không biết; 1 = đúng định nghĩa, thiếu ví dụ/giới hạn; 2 = đúng + ví dụ/giới hạn. Mục tiêu thực dụng: ≥16/20, trong đó câu (1), (2), (5), (10) không được 0.

Checkpoint 08A: tự làm 08A.4 và trả lời 10 câu mock đạt chuẩn, giải thích bằng 2–4 câu tiếng Anh ngắn với ít nhất 4 câu bất kỳ. Khi đã đạt, không đọc lại toàn module; chỉ flashcard lỗi.

🎙️ SPEAKING LAB V5.2 — 08A. Java Core + OOP

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: static/instance; Java pass-by-value; equals/hashCode; polymorphism; Collections; thread safety.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
belong to the class thuộc về class
compare object identity so sánh định danh object
override an instance method ghi đè instance method
preserve the equality contract giữ đúng quy ước equality

1. PRETEST + WATCH + DO

Đã được chia nhỏ: 30 cặp Q&A của mô-đun này được đặt sau từng mục lý thuyết ở phía trên (MICRO SPEAK V5.2). Không đọc lại toàn bộ câu hỏi ở đây; chọn 3 câu khó nhất để làm lại không nhìn.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. Static fields belong to the class rather than one object, but that does not make them thread-safe.
  2. Equal objects must return the same hash code under the equals and hashCode contract.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

In Java, ___ means . For example, . However, it does not guarantee ___.

4. FREE SPEAK + FOLLOW-UP — ôn các micro-lab

Lấy ngẫu nhiên 2 câu cơ chế + 1 câu tình huống đã làm trong các MICRO SPEAK phía trên. Không đọc script; câu nào sai phải sửa kèm một ví dụ/code/test.

Mã câu trong mô-đun: Q096, Q092, Q110, Q097, Q098, Q093, Q099, Q104, Q119, Q105, Q100, Q120, Q111, Q094, Q121, Q106, Q107, Q108, Q109, Q095, Q112, Q101, Q113, Q114, Q115, Q116, Q117, Q118, Q102, Q103.

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

In Java, == checks whether two object references point to the same object, while equals can express logical equality. When overriding equals, we must keep the hashCode contract, so equal objects have the same hash code. Static fields belong to the class, but they are not automatically thread-safe. If multiple threads modify a shared counter, we still need appropriate synchronization or an atomic operation.

Knowledge guardrail: Java luôn pass-by-value, kể cả khi value được copy là reference tới object.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 08A.



MÔ-ĐUN 08B [CORE][JAVA BACKEND] — Spring Boot + JPA/Hibernate: từ HTTP request đến database

Vị trí: học sau 08A và Mô-đun 04 (SQL/transaction). Không cần biết microservices/Kafka/Kubernetes để hoàn thành. Mục tiêu là giải thích và sửa được một luồng Spring Boot đơn giản, sau đó phát hiện những lỗi ORM/transaction phổ biến.

08B.0. PRETEST — 7 câu (6 phút)

  1. @Service và @Repository tự tạo object khác gì với new UserService(...)?
  2. Bean là gì? Vì sao có hai beans cùng type thì constructor injection có thể không rõ chọn bean nào?
  3. @Valid ở Controller có thay thế được check “email đã tồn tại trong DB” không?
  4. JpaRepository.findById(id) trả về gì? Vì sao không nên tự gọi .get() mù?
  5. Vì sao có @Transactional mà hai requests vẫn có thể cùng mua món hàng cuối cùng?
  6. Vì sao vòng lặp for (Order o : orders) o.getCustomer().getName() có thể tạo N+1 queries?
  7. flush() đồng nghĩa với commit() chưa? @Transactional có rollback với mọi checked exception theo mặc định không?

Nếu sai nhiều: học 08B.1 → 08B.4 theo thứ tự; nếu đúng gần hết: làm LAB 08C và MOCK 08B.7 trước.

08B.1. Spring Container, IoC, DI, Beans — ví dụ đơn giản

WATCH — lần theo nguồn tạo object:

@Service
public class BookingService {
    private final BookingRepository repository;

    public BookingService(BookingRepository repository) {
        this.repository = repository;
    }
}

@Repository
public class BookingRepository {
    // Data access methods
}

WATCH — một bean từ thư viện Java:

@Configuration
class TimeConfig {
    @Bean
    Clock applicationClock() { return Clock.systemUTC(); }
}

@Service
class DeadlineService {
    private final Clock clock;
    DeadlineService(Clock clock) { this.clock = clock; }
    boolean expired(Instant until) { return Instant.now(clock).isAfter(until); }
}

COMPLETE: Có Clock.systemUTC() và Clock.systemDefaultZone() đều đăng ký với tên khác nhau, cùng type Clock. Spring biết inject cái nào thế nào?

Đáp án COMPLETE

Dùng @Qualifier("beanName") trên injection point hoặc @Primary trên bean mặc định; xác nhận bean name/qualifier thật trong config. Không nên nói Spring tự chọn ngẫu nhiên. Trong các cấu hình cụ thể, tên parameter và cấu hình autowiring có thể tham gia resolution, nhưng tốt nhất explicit khi học.

DO: Viết một @Service nhận Clock qua constructor và có String nowIso() trả UTC instant. Nói một lợi ích khi unit test.

Đáp án DO
@Service
class TimeService {
    private final Clock clock;
    TimeService(Clock clock) { this.clock = clock; }
    String nowIso() { return Instant.now(clock).toString(); }
}

Test có thể inject Clock.fixed(...) để kết quả thời gian deterministic. Cần import từ java.time và Spring context phù hợp.

MICRO SPEAK V5.2 — sau mục 08B.1 · 7 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: Spring is a framework and ecosystem for building applications. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (6 câu)

Q122 · MECHANISM / WHY · ADD V5

TTS 243 · Q: What is the difference between Spring and Spring Boot?

TTS 243 · Câu hỏi
Tải MP3 243
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.

TTS 244 · Đáp án
Tải MP3 244
Q123 · MECHANISM / WHY · ADD V5

TTS 245 · Q: What is a bean, and how does constructor injection work?

TTS 245 · Câu hỏi
Tải MP3 245
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.

TTS 246 · Đáp án
Tải MP3 246
Q124 · MECHANISM / WHY · ADD V5

TTS 247 · Q: What's the difference between @Component, @Service, and @Repository?

TTS 247 · Câu hỏi
Tải MP3 247
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.

TTS 248 · Đáp án
Tải MP3 248
Q125 · FOUNDATION · ADD V5

TTS 249 · Q: What is inversion of control in Spring?

TTS 249 · Câu hỏi
Tải MP3 249
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.

TTS 250 · Đáp án
Tải MP3 250
Q126 · MECHANISM / WHY · ADD V5

TTS 251 · Q: Why is constructor injection often preferred over field injection?

TTS 251 · Câu hỏi
Tải MP3 251
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.

TTS 252 · Đáp án
Tải MP3 252
Q127 · FOUNDATION · ADD V5

TTS 253 · Q: What is Spring Boot auto-configuration?

TTS 253 · Câu hỏi
Tải MP3 253
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.

TTS 254 · Đáp án
Tải MP3 254

FOLLOW-UP — case / phản biện (1 câu)

Q128 · SCENARIO / FOLLOW-UP · ADD V5

TTS 255 · Q: What happens if two beans have the same type?

TTS 255 · Câu hỏi
Tải MP3 255
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.

TTS 256 · Đáp án
Tải MP3 256

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08B.2. Request flow, DTO, validation và status codes

WATCH — một luồng cơ bản:

HTTP POST /api/products
  → @RestController (JSON body → request DTO)
  → Bean Validation @Valid (shape/range)
  → @Service (business rules, authorization, DB checks)
  → repository/JPA/SQL
  → transaction commit
  → response DTO + HTTP 201 hoặc lỗi theo API contract

Ví dụ code học concept (bỏ qua imports và exception handler; chưa phải API hoàn chỉnh):

record CreateProductRequest(
    @NotBlank String sku,
    @NotNull @Positive BigDecimal price
) {}
record ProductResponse(Long id, String sku, BigDecimal price) {}

@RestController
@RequestMapping("/api/products")
class ProductController {
    private final ProductService service;
    ProductController(ProductService service) { this.service = service; }

    @PostMapping
    ResponseEntity<ProductResponse> create(@Valid @RequestBody CreateProductRequest req) {
        ProductResponse saved = service.create(req);
        return ResponseEntity.status(HttpStatus.CREATED).body(saved);
    }
}

COMPLETE: JSON { "sku":"", "price":-5 } gửi vào API trên: có nên tạo product? Lỗi thuộc DTO validation hay business rule trong DB?

Đáp án COMPLETE

Không; @NotBlank và @Positive vi phạm validation boundary, thường Spring trả 400 khi validation lỗi với setup MVC/validation chuẩn. Riêng “SKU đã tồn tại” cần kiểm tra nghiệp vụ và unique DB constraint: kiểm tra trước không đủ chống race.

DO: Thiết kế POST /api/tasks với title không blank, priority 1–5, chỉ người có role MEMBER được tạo; nêu ít nhất 3 HTTP responses và 3 tests. Không cần viết Spring Security hoàn chỉnh.

Đáp án DO

DTO có @NotBlank title, @NotNull @Min(1) @Max(5) priority; security context/service kiểm role. Thành công 201; malformed/invalid 400; chưa đăng nhập 401; đã đăng nhập không có quyền 403. Tests: title blank → 400; priority 6 → 400; user không có role → 403; member hợp lệ → 201 và kiểm tra DB. Cách lấy identity/role tùy kiến trúc, không tin client gửi role=MEMBER như chứng cứ.

MICRO SPEAK V5.2 — sau mục 08B.2 · 7 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: The controller handles the HTTP request and input validation. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (6 câu)

Q129 · MECHANISM / WHY · BASE V4

TTS 257 · Q: Walk me through Controller → Service → Repository in Spring Boot.

TTS 257 · Câu hỏi
Tải MP3 257
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.

TTS 258 · Đáp án
Tải MP3 258
Q130 · FOUNDATION · BASE V4

TTS 259 · Q: Can @Valid enforce uniqueness across concurrent requests?

TTS 259 · Câu hỏi
Tải MP3 259
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.

TTS 260 · Đáp án
Tải MP3 260
Q131 · FOUNDATION · ADD V5

TTS 261 · Q: Can @Valid prevent two users from registering the same email concurrently?

TTS 261 · Câu hỏi
Tải MP3 261
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.

TTS 262 · Đáp án
Tải MP3 262
Q132 · FOUNDATION · ADD V5

TTS 263 · Q: What does @RestController do?

TTS 263 · Câu hỏi
Tải MP3 263
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.

TTS 264 · Đáp án
Tải MP3 264
Q133 · MECHANISM / WHY · ADD V5

TTS 265 · Q: What is the difference between @RequestParam, @PathVariable, and @RequestBody?

TTS 265 · Câu hỏi
Tải MP3 265
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.

TTS 266 · Đáp án
Tải MP3 266
Q134 · MECHANISM / WHY · ADD V5

TTS 267 · Q: How does validation work with @Valid in a Spring controller?

TTS 267 · Câu hỏi
Tải MP3 267
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.

TTS 268 · Đáp án
Tải MP3 268

FOLLOW-UP — case / phản biện (1 câu)

Q135 · SCENARIO / FOLLOW-UP · ADD V5

TTS 269 · Q: How would you secure a Spring REST endpoint?

TTS 269 · Câu hỏi
Tải MP3 269
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.

TTS 270 · Đáp án
Tải MP3 270

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08B.3. JPA/Hibernate, Repository và entity lifecycle

WATCH — phân biệt:

WATCH — entity giản lược để học:

@Entity
class Task {
    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false)
    private String title;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private Workspace workspace;

    protected Task() {} // cho JPA
    Task(String title, Workspace workspace) {
        this.title = title;
        this.workspace = workspace;
    }
    void rename(String title) { this.title = title; }
}

interface TaskRepository extends JpaRepository<Task, Long> {
    List<Task> findByWorkspaceId(Long workspaceId);
}

Đây chỉ là ví dụ chưa đủ code để chạy độc lập: cần Workspace entity, imports, config, dependencies, schema và API. Dùng nó để giải thích mapping/relationship/repository, không nhận là production-ready.

COMPLETE: Service @Transactional tìm Task với findById, gọi task.rename("X") rồi return, không thấy save(task). Khi nào DB vẫn được update?

Đáp án COMPLETE

Khi Task là managed entity trong persistence context và transaction flush changes phù hợp (dirty checking), có thể update dù không gọi save lần hai. Nếu object detached, không có transaction thích hợp, hoặc transaction rollback thì không thể kết luận update sẽ commit.

DO: Vì sao API GET /tasks có thể bị lỗi hoặc chậm nếu trả thẳng List<Task> rồi serializer truy cập task.workspace.name? Nêu hai cách sửa.

Đáp án DO

Có thể phát sinh lazy initialization ngoài persistence context (tùy OSIV) hoặc N+1 queries khi serializer chạm lazy association từng row; thêm rủi ro serialization cycle/data exposure. Chọn projection/DTO query lấy đúng fields, hoặc fetch join/@EntityGraph có kiểm soát rồi map sang DTO trong service transaction. Không mặc định EAGER tất cả; fetch join collection + pagination cần cân nhắc riêng.

MICRO SPEAK V5.2 — sau mục 08B.3 · 10 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: Flush sends pending SQL changes to the database, but the transaction may still be open. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (9 câu)

Q136 · MECHANISM / WHY · BASE V4

TTS 271 · Q: What is the difference between flush and commit in JPA?

TTS 271 · Câu hỏi
Tải MP3 271
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.

TTS 272 · Đáp án
Tải MP3 272
Q137 · MECHANISM / WHY · BASE V4

TTS 273 · Q: Why can an ORM loop cause an N+1 query problem?

TTS 273 · Câu hỏi
Tải MP3 273
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.

TTS 274 · Đáp án
Tải MP3 274
Q138 · MECHANISM / WHY · ADD V5

TTS 275 · Q: What is the difference between JPA and Hibernate?

TTS 275 · Câu hỏi
Tải MP3 275
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.

TTS 276 · Đáp án
Tải MP3 276
Q139 · MECHANISM / WHY · ADD V5

TTS 277 · Q: What happens when you modify a managed JPA entity inside a transaction?

TTS 277 · Câu hỏi
Tải MP3 277
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.

TTS 278 · Đáp án
Tải MP3 278
Q140 · MECHANISM / WHY · ADD V5

TTS 279 · Q: What is lazy loading, and when can it fail?

TTS 279 · Câu hỏi
Tải MP3 279
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.

TTS 280 · Đáp án
Tải MP3 280
Q141 · MECHANISM / WHY · ADD V5

TTS 281 · Q: What is the difference between a JPA entity and a DTO?

TTS 281 · Câu hỏi
Tải MP3 281
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.

TTS 282 · Đáp án
Tải MP3 282
Q142 · FOUNDATION · ADD V5

TTS 283 · Q: What is the persistence context in JPA?

TTS 283 · Câu hỏi
Tải MP3 283
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.

TTS 284 · Đáp án
Tải MP3 284
Q143 · MECHANISM / WHY · ADD V5

TTS 285 · Q: What is the difference between persist and merge in JPA?

TTS 285 · Câu hỏi
Tải MP3 285
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.

TTS 286 · Đáp án
Tải MP3 286
Q144 · MECHANISM / WHY · ADD V5

TTS 287 · Q: What is the difference between LAZY and EAGER fetching?

TTS 287 · Câu hỏi
Tải MP3 287
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.

TTS 288 · Đáp án
Tải MP3 288

FOLLOW-UP — case / phản biện (1 câu)

Q145 · SCENARIO / FOLLOW-UP · ADD V5

TTS 289 · Q: When would you use a fetch join or an EntityGraph?

TTS 289 · Câu hỏi
Tải MP3 289
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.

TTS 290 · Đáp án
Tải MP3 290

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08B.4. @Transactional: rollback, concurrency và self-invocation

WATCH — những điều phải nói chính xác:

Câu hỏi Cần trả lời
Transaction boundary nằm đâu? Thường ở service/use-case cho nhóm DB operations cần nhất quán
@Transactional có rollback tất cả lỗi? Mặc định rollback với RuntimeException và Error; checked exception cần cấu hình như rollbackFor nếu phù hợp
Method trong cùng class gọi method @Transactional? Với proxy-based transaction mặc định, self-invocation thường không đi qua proxy nên annotation ở method được gọi có thể không có tác dụng như kỳ vọng
flush() có phải commit? Không. Flush có thể gửi SQL, commit vẫn chưa xảy ra
@Transactional có khóa tất cả records? Không; isolation, SQL statements, DB locks và constraints quyết định concurrency guarantees
Có thể rollback email/HTTP call bên ngoài? Không phải nhờ transaction DB; cần workflow/outbox/idempotency/reconciliation tùy contract
readOnly=true? Hint/optimization tùy transaction manager/ORM, không được coi là bảo đảm bảo mật hoặc cấm mọi write

WATCH — ví dụ self-invocation:

@Service
class ImportService {
    public void importAll() {
        applyOneBatch(); // call nội bộ, không đi qua transactional proxy mặc định
    }
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void applyOneBatch() { /* DB writes */ }
}

Không nên tự kết luận mỗi applyOneBatch có một transaction riêng. Có thể tách BatchWorker thành Spring bean riêng và gọi qua injected bean, dùng TransactionTemplate hoặc thiết kế transaction boundary phù hợp. Khi giải thích, luôn nhắc proxy mode đang dùng.

COMPLETE: Một service @Transactional đọc stock=1, kiểm stock > 0, trừ 1 và ghi. Hai requests cùng chạy, đều commit được trong cấu hình READ COMMITTED và không khóa/điều kiện bảo vệ. Vì sao?

Đáp án COMPLETE

@Transactional bảo đảm transaction boundary nhưng không tự làm read-check-write thành atomic business condition dưới READ COMMITTED. Hai transactions có thể cùng đọc giá trị cũ (lost update/oversell tùy update strategy). Giải pháp: UPDATE ... WHERE stock >= qty kiểm affected rows, hoặc SELECT FOR UPDATE rồi kiểm lại, unique constraints khi phù hợp, cộng concurrency test.

DO — tình huống thật: createBooking() trong transaction ghi Booking, rồi gọi provider external và gặp timeout. Nếu transaction rollback, có chắc provider chưa tạo booking không? Bạn sẽ cải tiến như thế nào?

Đáp án DO

Không thể kết luận điều gì về provider từ local DB rollback. External side effects không nằm trong cùng ACID transaction. Hướng giải tùy API contract: dùng provider idempotency key, trạng thái PENDING/UNKNOWN, status lookup/reconciliation; tránh giữ DB transaction dài qua network nếu không cần; outbox/asynchronous flow nếu hợp nghiệp vụ. Không retry mù khi outcome unknown.

MICRO SPEAK V5.2 — sau mục 08B.4 · 4 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: No. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FREE SPEAK — định nghĩa / cơ chế (2 câu)

Q146 · FOUNDATION · BASE V4

TTS 291 · Q: Does @Transactional automatically prevent all inventory races?

TTS 291 · Câu hỏi
Tải MP3 291
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.

TTS 292 · Đáp án
Tải MP3 292
Q147 · FOUNDATION · ADD V5

TTS 293 · Q: What is the default rollback behavior of @Transactional?

TTS 293 · Câu hỏi
Tải MP3 293
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.

TTS 294 · Đáp án
Tải MP3 294

FOLLOW-UP — case / phản biện (2 câu)

Q148 · SCENARIO / FOLLOW-UP · ADD V5

TTS 295 · Q: Does @Transactional guarantee that two requests won't oversell inventory?

TTS 295 · Câu hỏi
Tải MP3 295
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.

TTS 296 · Đáp án
Tải MP3 296
Q149 · SCENARIO / FOLLOW-UP · ADD V5

TTS 297 · Q: Why might @Transactional not work on a method called from within the same class?

TTS 297 · Câu hỏi
Tải MP3 297
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.

TTS 298 · Đáp án
Tải MP3 298

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08B.5. N+1, query tuning, authorization và tests

WATCH — N+1: query lấy N orders, sau đó N lần lazy-load customer: 1 query danh sách + N query association. Không phải mọi lần truy cập @ManyToOne đều gây N+1; phụ thuộc fetch plan, persistence context, dữ liệu được lấy và implementation.

Giải pháp phải chọn theo nhu cầu: DTO projection cho list endpoints; fetch join hoặc EntityGraph khi muốn association; kiểm Hibernate SQL logs / query count / actual query plan; tránh mặc định fetch tất cả collection trong page query.

Authorization không giống authentication: biết người dùng là ai chưa có nghĩa được sửa task của workspace khác. Truy vấn theo workspace_id + kiểm membership/role, kết hợp domain rule và DB constraints. Object ID khó đoán không thay thế authorization.

Kiểm thử nên phân biệt:

Loại Dùng khi Chú ý
Unit test với Mockito/fakes Policy/service logic không cần khởi động full Spring Không chứng minh DB/JPA behavior
@WebMvcTest MVC/controller validation, status/error mapping Thường mock service dependencies; không kiểm toàn flow DB
@DataJpaTest Entity/repository mapping/query Test transaction và DB compatibility; nếu dựa DB-specific SQL, cần môi trường gần production
@SpringBootTest + Testcontainers Integration nhiều components; transaction/concurrency Chậm hơn; cần setup thật và assert invariants

DO — phát hiện lỗi theo thứ tự: Endpoint /api/workspaces/{w}/tasks trả chậm khi số task lớn; sau đó phát hiện user A có thể đọc task của workspace B. Nêu hai nhóm nguyên nhân và đề xuất test.

Đáp án DO

Chậm: đo số SQL queries/logs, xem N+1, pagination/index và query plan; không mặc định “Redis giải quyết hết”. Đọc chéo workspace: xác minh identity, membership/role check, tenant-scoped query predicate (workspaceId) và test A đọc tài nguyên của B phải 403/404 theo contract. Query performance và access control là hai lỗi khác nhau.

MICRO SPEAK V5.2 — sau mục 08B.5 · 2 Q&A. Chỉ làm khi đã hiểu ví dụ/code ở ngay phía trên. Mỗi lượt chọn tối đa 4–6 câu; nếu nhiều hơn, chia 2 lượt.

SHADOW: N plus one happens when one query loads a list and additional queries fetch related data item by item. (nghe và nhại 2 lần). Sau đó che đáp án, tự trả lời bằng tiếng Anh rồi mới mở mẫu.

FOLLOW-UP — case / phản biện (2 câu)

Q150 · SCENARIO / FOLLOW-UP · ADD V5

TTS 299 · Q: What is the N+1 query problem and how would you detect it?

TTS 299 · Câu hỏi
Tải MP3 299
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.

TTS 300 · Đáp án
Tải MP3 300
Q151 · SCENARIO / FOLLOW-UP · ADD V5

TTS 301 · Q: How would you test a service that uses DB transactions and external APIs?

TTS 301 · Câu hỏi
Tải MP3 301
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.

TTS 302 · Đáp án
Tải MP3 302

DO → TRANSFER: quay lại bài thực hành ngay phía trên; đổi một dữ kiện và giải thích hệ quả bằng tiếng Anh. Ghi một lỗi kiến thức và một lỗi nói.

08B.6. LAB Spring/SQL tích hợp (18–25 phút)

Đề mới: Implement an API to move a task to another column. Each column has a maximum number of active tasks. Only workspace members may move tasks.

Phần A (5 phút): ghi actor, Task, Column, Membership, API, DTO và 3 HTTP statuses.

Phần B (7 phút): nêu Controller/Service/Repository responsibilities, transaction boundary, 2 concurrency bugs, hướng phòng ngừa.

Phần C (5 phút): viết query SQL lấy các columns và số lượng active tasks; dùng LEFT JOIN để vẫn có column trống.

Phần D (3 phút): nói 3–5 câu tiếng Anh giải thích flow và một trade-off. Không nhìn V-Core trả lời mẫu trước.

Lời giải tham khảo — chỉ xem sau khi thử

A. POST /api/workspaces/{w}/tasks/{t}/moves, DTO {targetColumnId, expectedVersion}. 200 khi move OK, 403 user không có quyền, 404 task không thuộc workspace, 409 WIP đầy hoặc stale version.

B. Controller DTO validation; Service kiểm member, status, WIP/version và transaction; Repository lookup với workspace_id, lock target column khi cần, update Task/version, ghi audit. Hai moves của hai tasks khác nhau vào chỗ cuối có thể vượt WIP nếu chỉ check count; hai moves của cùng task có thể gây stale update nếu thiếu version/concurrency control. Tách cách bảo vệ business aggregate khỏi cách bảo vệ một row.

C. Ví dụ PostgreSQL:

SELECT c.id, COUNT(t.id) AS active_count
FROM workflow_columns c
LEFT JOIN tasks t ON t.column_id = c.id AND t.status = 'ACTIVE'
WHERE c.workspace_id = :workspaceId
GROUP BY c.id;

AND t.status = 'ACTIVE' trong ON giúp giữ cả columns không có task active. Đây là query minh họa; schema thật có thể cần workspace_id trên task, tenant checks và index tương ứng.

D. “The controller validates the move request. The service checks workspace membership and the task version. It must protect the target column's WIP limit against concurrent moves, not only update one task. I would verify this with two simultaneous requests and check the final count.”

08B.7. MOCK Spring/JPA — 12 câu chưa có đáp án lộ sẵn (15 phút)

  1. What is the difference between Spring and Spring Boot?
  2. What is a bean, and how does constructor injection work?
  3. What happens if two beans have the same type?
  4. What's the difference between @Component, @Service, and @Repository?
  5. Can @Valid prevent two users from registering the same email concurrently?
  6. What is the difference between JPA and Hibernate?
  7. What happens when you modify a managed JPA entity inside a transaction?
  8. What is lazy loading, and when can it fail?
  9. What is the N+1 query problem and how would you detect it?
  10. Does @Transactional guarantee that two requests won't oversell inventory?
  11. Why might @Transactional not work on a method called from within the same class?
  12. How would you test a service that uses DB transactions and external APIs?
Rubric / đáp án ngắn cho 12 câu
  1. Spring là framework/ecosystem; Spring Boot cung cấp auto-configuration, starters và conventions để phát triển/chạy nhanh, vẫn trên nền Spring.
  2. Bean do container quản lý; constructor injection cung cấp required dependencies và giúp test.
  3. Có thể ambiguous, dùng @Qualifier/@Primary hoặc config rõ.
  4. Đều là stereotypes; Service nêu business layer, Repository cho persistence semantics/exception translation, Component tổng quát.
  5. Không; @Valid check input, unique DB constraint + error handling bảo vệ race.
  6. JPA specification, Hibernate implementation.
  7. Dirty checking/flush trong persistence context, commit/rollback vẫn quyết định durability cuối.
  8. Association có thể tải khi truy cập; ngoài persistence context có thể exception; load nhiều lần có thể N+1.
  9. 1 query list + N association queries; đo SQL logs/count, dùng projection/appropriate fetch plan.
  10. Không; cần concurrency strategy DB và tests.
  11. Self-invocation bỏ qua proxy-based transactional advice mặc định.
  12. Unit cho business logic, integration Testcontainers cho DB, mock/fake provider hoặc sandbox cho external contract, test failure/timeout và đảm bảo không claim đã rollback remote call.

Chấm: mỗi câu 0–2 điểm như 08A; mục tiêu ≥19/24, đặc biệt 5, 9–11 không được 0. Nếu chưa đạt, mở đúng 08B.2–5, không đọc lại toàn Foundation.

Checkpoint 08B: làm LAB 08B.6 không xem đáp án; đạt mock; mở một flow thật từ V-Market rồi chỉ được Controller, Service, SQL/Repository, transaction boundary và integration test. Nói rõ code repo dùng JDBC ở flow nào, JPA ở flow nào; không tự nhận V-Market checkout dùng Hibernate nếu code dùng JDBC.

🎙️ SPEAKING LAB V5.2 — 08B. Spring Boot + JPA/Hibernate

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: IoC/DI/Bean; controller/service/repository; DTO validation; JPA flush/commit; transaction and N+1.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
inject a dependency tiêm phụ thuộc
validate the request body xác thực dữ liệu request
persist an entity lưu entity qua persistence layer
trigger additional queries gây thêm các query

1. PRETEST + WATCH + DO

Đã được chia nhỏ: 30 cặp Q&A của mô-đun này được đặt sau từng mục lý thuyết ở phía trên (MICRO SPEAK V5.2). Không đọc lại toàn bộ câu hỏi ở đây; chọn 3 câu khó nhất để làm lại không nhìn.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. Spring manages beans and injects dependencies through the application context.
  2. Flushing changes to the database is not the same as committing a transaction.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

The controller . The service . The repository . A common issue is .

4. FREE SPEAK + FOLLOW-UP — ôn các micro-lab

Lấy ngẫu nhiên 2 câu cơ chế + 1 câu tình huống đã làm trong các MICRO SPEAK phía trên. Không đọc script; câu nào sai phải sửa kèm một ví dụ/code/test.

Mã câu trong mô-đun: Q129, Q136, Q137, Q130, Q146, Q122, Q123, Q128, Q124, Q131, Q138, Q139, Q140, Q150, Q148, Q149, Q151, Q125, Q126, Q127, Q132, Q133, Q134, Q141, Q142, Q143, Q144, Q145, Q147, Q135.

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

A Spring controller receives the HTTP request and validates its format. The service applies business rules, and the repository accesses the database. Spring manages these components as beans and can inject their dependencies. JPA defines a persistence API, while Hibernate is a common implementation. Flushing may send SQL to the database, but it does not commit the transaction. I would also check for N+1 queries when loading related entities.

Knowledge guardrail: Không nói save/flush luôn commit; không dùng @Transactional thay cho concurrency strategy.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 08B.



LAB 08C [CORE][JAVA BACKEND] — Kiểm tra cuối: code → SQL → English → follow-up

LAB này chỉ 35–45 phút, dùng để kiểm tra năng lực vận dụng chứ không kiểm tra trí nhớ về file. Nếu cần, đổi tên entity / input để tự tạo biến thể.

C1. Java code (10 phút, không dùng AI)

Viết Map<String, Long> summarize(List<String> tags) đếm từ khóa không phân biệt hoa thường, bỏ null/blank, trả map bất kỳ thứ tự. Viết 3 tests (input thường, null/blank, empty). Giải thích complexity theo tổng số ký tự và số phần tử (không chỉ nói O(n) nếu phải trim/lowercase strings).

Tham khảo C1
static Map<String, Long> summarize(List<String> tags) {
    Map<String, Long> counts = new HashMap<>();
    for (String raw : tags) {
        if (raw == null || raw.isBlank()) continue;
        String key = raw.trim().toLowerCase(Locale.ROOT);
        counts.merge(key, 1L, Long::sum);
    }
    return counts;
}

Giả sử average hash lookup O(1), work chủ yếu qua các characters để kiểm blank/trim/lowercase, cộng thêm O(m) hash operations cho m phần tử; O(k) map entries cộng bytes/chars của normalized keys. Không đảm bảo O(1) worst-case của HashMap. Test thêm List.of() (không chứa null); muốn test null entries hãy dùng Arrays.asList(null, " A ", "a", "").

C2. SQL (8 phút)

Có users(id,name) và orders(id,user_id,total,status). Viết query liệt kê mọi user với total_paid của các đơn PAID; người không có PAID trả 0. Vì sao đặt điều kiện status trong WHERE có thể làm mất người không có orders?

Tham khảo C2
SELECT u.id, u.name, COALESCE(SUM(o.total), 0) AS total_paid
FROM users u
LEFT JOIN orders o ON o.user_id = u.id AND o.status = 'PAID'
GROUP BY u.id, u.name;

Filter o.status='PAID' tại WHERE loại rows NULL do LEFT JOIN tạo, có thể biến kết quả thành hiệu ứng INNER JOIN cho user không có paid orders. Có cách khác dùng conditional aggregate; kiểm dataset và dialect cụ thể.

C3. Spring scenario (10 phút)

Một endpoint POST /api/bookings dùng DTO validation, @Transactional, findAvailableRoom() rồi lưu booking. Hai requests cùng room/date đều trả 201. Hãy nói tại sao, đề xuất hai phương án bảo vệ, và một integration test chứng minh không overbook.

Tham khảo C3

Read-check-insert race; chỉ có @Transactional không đủ dưới mọi isolation. Có thể dùng DB uniqueness cho (room,date) inventory hold phù hợp domain, hoặc atomic conditional allocation / row lock và check lại trong transaction. Test hai requests chồng lấn qua Testcontainers PostgreSQL, assert chỉ một allocation hợp lệ và DB invariant; cần quyết định status/hold semantics của PENDING trước.

C4. English (5 phút)

Trả lời mỗi câu trong 30–45 giây, không nhìn script:

Chuẩn: nói đúng ý, ít nhất 1 reason hoặc test, thừa nhận giới hạn khi không có provider status/idempotency. Sau đó ghi 3 lỗi vào error log của tài liệu gốc.

C5. Quy tắc chuyển bài

🎙️ SPEAKING LAB V5.2 — 08C. Java + SQL + English integrated case

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Read code → explain bug → implement/query → defend design → follow-up.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
walk through the code giải thích code tuần tự
identify the edge case xác định trường hợp biên
run a concurrent test chạy test đồng thời
explain the trade-off giải thích đánh đổi

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. The current implementation can fail when two requests update the same inventory record.
  2. I would protect the invariant in the database and verify it with a concurrent test.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

The current code . This can fail when . I would change ___ and test ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 5 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q152 · MECHANISM / WHY · BASE V4

TTS 303 · Q: Explain the main bug you found in the LAB 08C code.

TTS 303 · Câu hỏi
Tải MP3 303
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.

TTS 304 · Đáp án
Tải MP3 304
Q153 · FOUNDATION · BASE V4

TTS 305 · Q: What SQL query or constraint would support your fix?

TTS 305 · Câu hỏi
Tải MP3 305
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.

TTS 306 · Đáp án
Tải MP3 306
Q154 · FOUNDATION · BASE V4

TTS 307 · Q: Which part of your fix is guaranteed by a database transaction, and which part is not?

TTS 307 · Câu hỏi
Tải MP3 307
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.

TTS 308 · Đáp án
Tải MP3 308
Q155 · MECHANISM / WHY · ADD V5

TTS 309 · Q: How do you explain a concurrent inventory bug in one minute?

TTS 309 · Câu hỏi
Tải MP3 309
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.

TTS 310 · Đáp án
Tải MP3 310
Q156 · FOUNDATION · ADD V5

TTS 311 · Q: What should a database integration test assert after two simultaneous bookings?

TTS 311 · Câu hỏi
Tải MP3 311
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.

TTS 312 · Đáp án
Tải MP3 312

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q157 · SCENARIO / FOLLOW-UP · BASE V4

TTS 313 · Q: How would you explain the solution to a teammate in under one minute?

TTS 313 · Câu hỏi
Tải MP3 313
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.

TTS 314 · Đáp án
Tải MP3 314
Q158 · SCENARIO / FOLLOW-UP · BASE V4

TTS 315 · Q: What happens if a retry arrives with the same operation ID?

TTS 315 · Câu hỏi
Tải MP3 315
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.

TTS 316 · Đáp án
Tải MP3 316

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

The key risk is that two requests may pass the same availability check before either one commits. I would protect the inventory rule at the database boundary, for example with a conditional update or an appropriate lock and transaction. I would inspect the affected row count, handle the conflict, and run a concurrent test. The spoken explanation must match the SQL and Java behavior I implemented.

Knowledge guardrail: Không chỉ nói “I fixed the bug”; phải nêu cách tái hiện, giới hạn và test.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 08C.



🎙️ CASE LAB V5.2 — V-Market (11 cặp Q&A)

Nguồn: PROJECT_DEEP_DIVE_PREP(4).md; snapshot commit được mô tả: ff9fde3. Chưa kiểm chứng repo độc lập; không tự nhận đã triển khai hoặc chạy test khi chưa làm.

Mục tiêu kiến thức: Stock-safe checkout, idempotency, JDBC/PostgreSQL, Redis metadata và legacy CSV.

WATCH → DO (đọc code/test thực tế): OrderController → OrderService.create → integration tests; CSV: LegacyImportService/ImportChunkService.

LISTEN → SHADOW: V-Market is a Java and Spring Boot commerce project with a product catalog, guest checkout, and CSV imports. (2 lượt), rồi giải thích lại flow mà không nhìn script.

FREE SPEAK — P0 (ưu tiên, 4–6 câu mỗi buổi)

Q159 · P0 · PROJECT-SPECIFIC V5.1

TTS 317 · Q: What problem does V-Market solve?

TTS 317 · Câu hỏi
Tải MP3 317
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.

TTS 318 · Đáp án
Tải MP3 318
Q160 · P0 · PROJECT-SPECIFIC V5.1

TTS 319 · Q: Walk me through a V-Market checkout request.

TTS 319 · Câu hỏi
Tải MP3 319
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.

TTS 320 · Đáp án
Tải MP3 320
Q161 · P0 · PROJECT-SPECIFIC V5.1

TTS 321 · Q: Two customers each buy twenty items when only twenty-seven are in stock. What happens?

TTS 321 · Câu hỏi
Tải MP3 321
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.

TTS 322 · Đáp án
Tải MP3 322
Q162 · P0 · PROJECT-SPECIFIC V5.1

TTS 323 · Q: Why does V-Market need both an operation-key lock and stock locks?

TTS 323 · Câu hỏi
Tải MP3 323
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.

TTS 324 · Đáp án
Tải MP3 324
Q163 · P0 · PROJECT-SPECIFIC V5.1

TTS 325 · Q: How does V-Market handle a repeated checkout with the same key?

TTS 325 · Câu hỏi
Tải MP3 325
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.

TTS 326 · Đáp án
Tải MP3 326
Q164 · P0 · PROJECT-SPECIFIC V5.1

TTS 327 · Q: The client times out after checkout. Should it create a new request key?

TTS 327 · Câu hỏi
Tải MP3 327
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.

TTS 328 · Đáp án
Tải MP3 328
Q165 · P0 · PROJECT-SPECIFIC V5.1

TTS 329 · Q: Why does V-Market use Redis, and can the cache cause overselling?

TTS 329 · Câu hỏi
Tải MP3 329
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.

TTS 330 · Đáp án
Tải MP3 330
Q166 · P0 · PROJECT-SPECIFIC V5.1

TTS 331 · Q: What happens if a database error occurs while creating an order?

TTS 331 · Câu hỏi
Tải MP3 331
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.

TTS 332 · Đáp án
Tải MP3 332
Q167 · P0 · PROJECT-SPECIFIC V5.1

TTS 333 · Q: What evidence and limitations can you discuss for V-Market?

TTS 333 · Câu hỏi
Tải MP3 333
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.

TTS 334 · Đáp án
Tải MP3 334

FOLLOW-UP — P1 (chỉ học sâu sau P0)

Q168 · P1 · PROJECT-SPECIFIC V5.1

TTS 335 · Q: How does V-Market validate Japanese legacy CSV imports?

TTS 335 · Câu hỏi
Tải MP3 335
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.

TTS 336 · Đáp án
Tải MP3 336
Q169 · P1 · PROJECT-SPECIFIC V5.1

TTS 337 · Q: Why can't an old CSV stock snapshot restore inventory that has already been sold?

TTS 337 · Câu hỏi
Tải MP3 337
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.

TTS 338 · Đáp án
Tải MP3 338

UNEXPECTED FOLLOW-UP: Giả định client mất response sau khi server đã commit. Giải thích vì sao không tạo operation key mới và cách kiểm tra kết quả.

SELF-CHECK: có nêu một invariant, một failure, một test và một giới hạn thật? Chỉ nói I implemented hoặc I ran với phần mình đã xác minh từ công việc cá nhân.


🎙️ CASE LAB V5.2 — V-Core (11 cặp Q&A)

Nguồn: PROJECT_DEEP_DIVE_PREP(3).md; snapshot commit được mô tả: aff7e93. Chưa kiểm chứng repo độc lập; không tự nhận đã triển khai hoặc chạy test khi chưa làm.

Mục tiêu kiến thức: Kanban WIP limit, task version, quyền workspace và SSE refresh.

WATCH → DO (đọc code/test thực tế): TaskController → TaskMoveService.move → WorkflowColumnRepository/TaskEntity → integration tests.

LISTEN → SHADOW: V-Core is a Kanban collaboration project using Java, Spring Boot, PostgreSQL, and a React frontend. (2 lượt), rồi giải thích lại flow mà không nhìn script.

FREE SPEAK — P0 (ưu tiên, 4–6 câu mỗi buổi)

Q170 · P0 · PROJECT-SPECIFIC V5.1

TTS 339 · Q: What problem does V-Core solve?

TTS 339 · Câu hỏi
Tải MP3 339
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.

TTS 340 · Đáp án
Tải MP3 340
Q171 · P0 · PROJECT-SPECIFIC V5.1

TTS 341 · Q: Walk me through a task move in V-Core.

TTS 341 · Câu hỏi
Tải MP3 341
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.

TTS 342 · Đáp án
Tải MP3 342
Q172 · P0 · PROJECT-SPECIFIC V5.1

TTS 343 · Q: Why does V-Core use both a column lock and a task version?

TTS 343 · Câu hỏi
Tải MP3 343
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.

TTS 344 · Đáp án
Tải MP3 344
Q173 · P0 · PROJECT-SPECIFIC V5.1

TTS 345 · Q: Two users move tasks into the last free slot. How does V-Core prevent overflow?

TTS 345 · Câu hỏi
Tải MP3 345
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.

TTS 346 · Đáp án
Tải MP3 346
Q174 · P0 · PROJECT-SPECIFIC V5.1

TTS 347 · Q: What does V-Core do when the same task move request is retried?

TTS 347 · Câu hỏi
Tải MP3 347
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.

TTS 348 · Đáp án
Tải MP3 348
Q175 · P0 · PROJECT-SPECIFIC V5.1

TTS 349 · Q: What does the task-move transaction guarantee, and what does it not guarantee?

TTS 349 · Câu hỏi
Tải MP3 349
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.

TTS 350 · Đáp án
Tải MP3 350
Q176 · P0 · PROJECT-SPECIFIC V5.1

TTS 351 · Q: How does V-Core prevent a user from changing tasks in another workspace?

TTS 351 · Câu hỏi
Tải MP3 351
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.

TTS 352 · Đáp án
Tải MP3 352
Q177 · P0 · PROJECT-SPECIFIC V5.1

TTS 353 · Q: How would you verify V-Core's WIP concurrency rule?

TTS 353 · Câu hỏi
Tải MP3 353
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.

TTS 354 · Đáp án
Tải MP3 354

FOLLOW-UP — P1 (chỉ học sâu sau P0)

Q178 · P1 · PROJECT-SPECIFIC V5.1

TTS 355 · Q: What is the purpose of SSE in V-Core, and is delivery guaranteed?

TTS 355 · Câu hỏi
Tải MP3 355
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.

TTS 356 · Đáp án
Tải MP3 356
Q179 · P1 · PROJECT-SPECIFIC V5.1

TTS 357 · Q: What happens to an existing SSE stream when a user's access is revoked?

TTS 357 · Câu hỏi
Tải MP3 357
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.

TTS 358 · Đáp án
Tải MP3 358
Q180 · P1 · PROJECT-SPECIFIC V5.1

TTS 359 · Q: Can an administrator lower a WIP limit below the current task count?

TTS 359 · Câu hỏi
Tải MP3 359
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.

TTS 360 · Đáp án
Tải MP3 360

UNEXPECTED FOLLOW-UP: Giả định hai task cùng tranh slot cuối trong cột. Phân biệt column lock với task version và nêu một test.

SELF-CHECK: có nêu một invariant, một failure, một test và một giới hạn thật? Chỉ nói I implemented hoặc I ran với phần mình đã xác minh từ công việc cá nhân.


MÔ-ĐUN 09 [CORE] — Basic System Design: từ 1 server đến một hệ thống đủ tin cậy

09.1. System Design không đồng nghĩa “thiết kế YouTube/Netflix”

Đối với bài cơ bản, interviewer có thể chỉ muốn biết API nào, lưu dữ liệu ở đâu, luồng hoạt động và khi service ngoài lỗi thì sao. Đừng nhảy sang Kafka + Kubernetes + microservices khi bài toán chưa cần.

09.2. Level 1 — khởi đầu bằng cấu trúc tối giản

[Browser] ──HTTPS──> [Spring Boot App] ──SQL──> [PostgreSQL]

Ưu điểm: dễ xây, debug, deploy; transaction nội bộ rõ. Nhược: một app instance có thể là single point of failure; DB có thể thành bottleneck. Đây thường là thiết kế xuất phát tốt, không phải thiết kế sai.

Framework 5 bước cần thuộc: 1. Requirements: functions, users, traffic, availability/security constraints. 2. APIs + Data: endpoints, objects/tables, invariants. 3. Components + Flow: ai gọi ai, source of truth. 4. Failures + Bottlenecks: timeout, duplicate, consistency, scaling. 5. Trade-offs + Tests: vì sao chọn và cách chứng minh.

09.3. Level 2 — khi nhiều người đọc availability

          ┌──> [Redis cache] (optional, derived data)
[App] ────┤
          └──> [PostgreSQL] (source of truth)

Vì sao cache? Giảm truy vấn lặp cho dữ liệu đọc nhiều.
Tại sao cache nguy hiểm? Có thể stale; không tin cache là authority duy nhất khi xác nhận đặt phòng.

Answer: I might cache read-heavy availability summaries with a short TTL, but the final booking decision must be validated against the authoritative inventory store.

09.4. Level 3 — external service bị chậm / lỗi

[Client] → [Backend] → [Third-party room provider]
                 ↓              × timeout
               logs / pending state / safe retry / reconciliation

Có thể làm gì? - Đặt timeout để request không treo vô hạn. - Phân loại lỗi tạm thời / lỗi business / lỗi không retry. - Retry với backoff nếu operation safe hoặc idempotency mechanism đã được xác nhận. - Có trạng thái PENDING_CONFIRMATION nếu chưa biết kết quả thực tế. - Log correlation ID, request ID để truy vết. - Reconciliation: đối soát lại sau lỗi để không tạo booking ảo/nhân đôi.

Không hứa chính xác-once chỉ vì đã bật retry.

09.5. Level 4 — scale và background work

                 ┌─ [App instance 1] ─┐
[Load balancer] ──┤                    ├── [Database]
                 └─ [App instance 2] ─┘
                              │
                              └─[Queue]→[Worker]→ email / report

09.6. Bảng ra quyết định 8 trade-offs phổ biến

Khi interviewer hỏi Chọn đơn giản trước Khi nào cân nhắc phương án khác? Rủi ro phải nói
DB hay cache? DB là source of truth read-heavy & repeated queries → cache stale cache / invalidation
Sync hay async? sync nếu user cần kết quả ngay email, batch → async queue delays, duplicate deliveries
SQL hay NoSQL? SQL nếu relations/transactions rõ flexible access pattern hoặc scale đặc thù joins/transactions/query needs
Monolith hay microservices? modular monolith cho MVP team/services cần deploy độc lập thật distributed complexity
Optimistic hay pessimistic lock? dựa trên conflict frequency high contention có thể cần locking mạnh hơn retries vs waiting/deadlocks
Retry hay fail? fail rõ nếu chưa biết an toàn retry transient + idempotent operations duplicated business effect
Offset hay cursor paging? offset đơn giản large/rapidly changing list → cursor stable ordering / complexity
Index hay scan? đo workload + EXPLAIN trước predicates selective, frequent queries overhead storage/writes

Nhớ: không có đáp án “luôn luôn chọn X”. Đáp án tốt là theo yêu cầu và có lý do.

09.7. Một bài worked example đầy đủ (ngắn)

Đề: Design a URL shortener for a small internal team.

  1. Clarify: custom alias? expiration? internal only? anticipated traffic?
  2. API: POST /links → short code; GET /{code} → redirect.
  3. DB: Link(code UNIQUE, originalUrl, createdAt, expiresAt, ownerId).
  4. Flow: create validates URL + uniqueness; redirect looks up code and returns redirect response.
  5. Failure: collision in generated code → generate another; expired link → appropriate response; abuse prevention.
  6. Scaling: start with single app + relational DB; add cache for very frequent redirects if measurements justify it.

Mẫu tiếng Anh:

I'd start by clarifying traffic and expiration requirements. For the MVP, I'd use a Spring Boot service and a relational database with a unique short code. Redirect requests look up the code and return a redirect. If read traffic increases, I'd consider caching popular mappings, while keeping the database as the source of truth.

09.8. Tự làm — không có sẵn một đáp án duy nhất

Đề: Design a task management API for a team of 20 users. The app must support create/update tasks and an activity log.

Viết tối đa 10–12 dòng cho: requirements, entities, APIs, components, one failure case, one trade-off. Đừng giải thích Kubernetes/queues trước khi chỉ ra lý do cần.

Đáp án gợi ý

🎙️ SPEAKING LAB V5.2 — 09. Basic System Design

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: MVP monolith; database authority; caching; queue; failure/timeouts; scaling and trade-offs.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
start with a simple architecture bắt đầu với kiến trúc đơn giản
cache read-heavy data cache dữ liệu đọc nhiều
keep the database authoritative giữ DB là nguồn dữ liệu có thẩm quyền
introduce a message queue thêm hàng đợi thông điệp

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. I would start with one backend service and a relational database for the MVP.
  2. Caching can reduce read load, but stale data must not break booking correctness.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

For the MVP, I would use . If ___ becomes a bottleneck, I would . The trade-off is ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 4 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q181 · FOUNDATION · BASE V4

TTS 361 · Q: Design a simple booking service for an MVP.

TTS 361 · Câu hỏi
Tải MP3 361
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.

TTS 362 · Đáp án
Tải MP3 362
Q182 · MECHANISM / WHY · BASE V4

TTS 363 · Q: When might you add Redis caching, and what should not rely on a stale cache?

TTS 363 · Câu hỏi
Tải MP3 363
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.

TTS 364 · Đáp án
Tải MP3 364
Q183 · FOUNDATION · ADD V5

TTS 365 · Q: What is a load balancer?

TTS 365 · Câu hỏi
Tải MP3 365
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.

TTS 366 · Đáp án
Tải MP3 366
Q184 · FOUNDATION · ADD V5

TTS 367 · Q: What is eventual consistency?

TTS 367 · Câu hỏi
Tải MP3 367
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.

TTS 368 · Đáp án
Tải MP3 368

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q185 · SCENARIO / FOLLOW-UP · BASE V4

TTS 369 · Q: Why would you choose a modular monolith before microservices?

TTS 369 · Câu hỏi
Tải MP3 369
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.

TTS 370 · Đáp án
Tải MP3 370
Q186 · SCENARIO / FOLLOW-UP · BASE V4

TTS 371 · Q: What changes if an external provider is frequently slow?

TTS 371 · Câu hỏi
Tải MP3 371
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.

TTS 372 · Đáp án
Tải MP3 372
Q187 · SCENARIO / FOLLOW-UP · BASE V4

TTS 373 · Q: How would you measure whether scaling actually helped?

TTS 373 · Câu hỏi
Tải MP3 373
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.

TTS 374 · Đáp án
Tải MP3 374

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

For an MVP, I would start with one Spring Boot backend and a relational database. The backend handles booking rules and the database remains the authoritative source for availability. If read traffic increases, I might cache suitable read-heavy data, while protecting final inventory allocation in the database. I would monitor latency and query load before scaling. This design is simpler to deploy, but independent scaling is more limited.

Knowledge guardrail: Không thêm microservices/Redis/Kafka chỉ để thể hiện biết công nghệ; phải có nhu cầu.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 09.



LAB B [CORE] — Debugging + API Integration: từ triệu chứng đến nguyên nhân

Tại sao có LAB này? Java Backend và FDE đều có thể yêu cầu bạn xử lý một lỗi lạ, đọc API/data hiện có và đưa ra cách kiểm chứng — không phải chỉ nêu tên design pattern.

B1. Quy trình 6 bước (dùng cho mọi lỗi)

Symptom → Reproduce → Locate boundary → Hypotheses → Evidence → Fix & regression test.

Bước Ví dụ booking English prompt
Symptom Khách thấy “request timed out” What exactly failed?
Reproduce Dùng request ID, input và thời điểm Can you reproduce it?
Boundary Browser → BFF → backend → DB → provider Where does the flow stop?
Hypotheses Provider chậm, DB lock wait, network drop What might cause this?
Evidence Logs, traces, DB status, request ID What evidence supports it?
Fix/Test Retry có kiểm soát; test timeout/duplicate How would you verify the fix?

Tránh lỗi thường gặp: timeout ở browser không chứng minh database rollback; response 500 không chứng minh bên thứ ba chưa thực hiện side effect.

B2. WATCH — đơn đặt hàng trả 504 nhưng DB đã có order

Phân tích: 504 nói gateway/upstream đã chờ quá lâu. Cần query tình trạng operation theo key/order ID trước khi tạo lại. Nếu retry cùng operation, client phải giữ K1. Backend phải có dedup durable, và tốt hơn là kiểm tra payload hash; concurrent duplicates cần có chiến lược xử lý rõ. Không chỉ thêm @Transactional là đủ.

English (45s): A timeout does not prove that the operation failed. I would check the order status using a stable request ID or idempotency key. If the client retries the same operation, the backend must avoid creating a second order. I'd test a timeout after commit and concurrent retries.

B3. COMPLETE — triệu chứng khác nhau, xử lý khác nhau

Triệu chứng Điều biết chắc Bước xác minh tiếp theo
400 after POST Server đã phản hồi client error __________
403 on staff approval Bị từ chối quyền __________
409 when allocating last room Có xung đột trạng thái theo contract __________
503 from provider Provider hiện không phục vụ request __________
Timeout from payment provider Caller không biết kết quả cuối __________
Đáp án tham khảo

400: validate schema, required fields, constraints; 403: user identity, role, authorization policy; 409: current state, concurrency/race, whether retry/update allowed; 503: retry policy với backoff/circuit breaker nếu operation an toàn, quan sát lỗi; timeout payment: query provider status/correlation ID, kiểm soát idempotency và reconciliation trước khi thử lại. Chú ý mapping HTTP phụ thuộc API contract; không suy đoán mọi 409 cùng lý do.

B4. DO — API/data integration (10 phút)

An external vendor sends a CSV file every morning. Some rows are duplicated, some product names have garbled Japanese characters, and a few quantities are negative.

Không chọn tech ngay. Tự viết:

  1. 5 câu hỏi làm rõ (định dạng, encoding, business key, tần suất, cách xử lý sai).
  2. Pipeline 5 bước từ raw file tới DB.
  3. Một quy tắc dedup cấp file và một quy tắc dedup cấp row, vì hai thứ khác nhau.
  4. Một chiến lược xử lý lỗi: reject cả file hay partial success? Điều kiện nào quyết định?
  5. 4 tests kể cả replay/crash.
Hướng giải — chỉ xem sau khi thử

Clarify: encoding do exporter định nghĩa (UTF-8/Windows-31J?), delimiter/quote, SKU/vendor unique key, full snapshot hay delta, số hàng/file, lỗi row có chặn toàn bộ không, sale có chạy song song không? Pipeline: receive raw bytes → decode/parse → validate/normalize → stage + report rejects → transactional apply + reconcile. File checksum theo bytes ngăn upload giống bytes; unique business key/check theo vendor SKU/order ID xử lý duplicate record xuyên nhiều file. Partial success hay all-or-nothing phải được đồng ý qua acceptance criteria. Tests: CP932 fixture, negative quantity, same file reupload, duplicate SKU across files, crash/partial commit/recovery.

B5. Liên hệ đúng với V-Market (đọc sau khi hiểu B4)

Trong tài liệu phân tích project V-Market do bạn cung cấp, flow importer được mô tả dùng staged rows, checksum, Windows-31J, tasklet và các nhóm ghi REQUIRES_NEW. Tài liệu cũng cảnh báo: API hiện tại chưa có workflow restart đầy đủ, dù dữ liệu tiến độ đã lưu, và reconciliation phát hiện chênh lệch nhưng không tự chứng minh chênh lệch là lỗi. Đây là điều tài liệu phân tích code mô tả, không phải test tôi vừa chạy lại.

Câu FDE gợi ý: The client wants to import inventory without stopping sales. What would you ask before making changes? → hỏi feed là snapshot/delta, cutoff time, update stock ghi đè sale hợp lệ hay không, quyền operator, tiêu chí đối soát.

Qua LAB B nếu: Bạn không còn trả lời “cứ retry”, “cứ thêm Redis” khi chưa xác định root cause, có thể nêu evidence và một regression test.

🎙️ SPEAKING LAB V5.2 — B. Debugging và external integration

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Symptom → evidence → reproduce → hypothesis → fix → verify; external timeout; duplicate imports.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
reproduce the issue tái hiện lỗi
inspect request logs kiểm tra log request
isolate the root cause khoanh nguyên nhân gốc
verify the fix kiểm chứng bản sửa

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. A gateway timeout does not prove that the database operation was rolled back.
  2. I would correlate request IDs, database records, and downstream logs.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

The symptom is . My first hypothesis is . I would check ___ before changing ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 1 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q188 · FOUNDATION · BASE V4

TTS 375 · Q: Which evidence would tell you that a retry is safe?

TTS 375 · Câu hỏi
Tải MP3 375
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.

TTS 376 · Đáp án
Tải MP3 376

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

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?

TTS 377 · Câu hỏi
Tải MP3 377
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.

TTS 378 · Đáp án
Tải MP3 378
Q190 · SCENARIO / FOLLOW-UP · BASE V4

TTS 379 · Q: How would you investigate duplicate product imports?

TTS 379 · Câu hỏi
Tải MP3 379
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.

TTS 380 · Đáp án
Tải MP3 380
Q191 · SCENARIO / FOLLOW-UP · BASE V4

TTS 381 · Q: What if logs show the same request ID twice?

TTS 381 · Câu hỏi
Tải MP3 381
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.

TTS 382 · Đáp án
Tải MP3 382
Q192 · SCENARIO / FOLLOW-UP · BASE V4

TTS 383 · Q: How would you design a regression test for the root cause?

TTS 383 · Câu hỏi
Tải MP3 383
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.

TTS 384 · Đáp án
Tải MP3 384
Q193 · SCENARIO / FOLLOW-UP · ADD V5

TTS 385 · Q: How would you trace an HTTP request across multiple services?

TTS 385 · Câu hỏi
Tải MP3 385
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.

TTS 386 · Đáp án
Tải MP3 386
Q194 · SCENARIO / FOLLOW-UP · ADD V5

TTS 387 · Q: What would you do if an external API returned an unfamiliar error?

TTS 387 · Câu hỏi
Tải MP3 387
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.

TTS 388 · Đáp án
Tải MP3 388
Q195 · SCENARIO / FOLLOW-UP · ADD V5

TTS 389 · Q: How would you prevent duplicate records during a CSV import?

TTS 389 · Câu hỏi
Tải MP3 389
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.

TTS 390 · Đáp án
Tải MP3 390

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

A 504 response is a symptom, not proof that the order failed. I would start by correlating the request ID with application logs and database records. Then I would check whether the operation committed before the gateway timed out. If retries can duplicate the order, I would investigate idempotency and add a regression test. I would only change the code after identifying a defensible root cause.

Knowledge guardrail: Không hứa “adding a queue will fix it” trước khi biết bottleneck/bug.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab B.



🎙️ CASE LAB V5.2 — V-Pulse (11 cặp Q&A)

Nguồn: PROJECT_DEEP_DIVE_PREP(5).md; snapshot commit được mô tả: 08e6a01. Chưa kiểm chứng repo độc lập; không tự nhận đã triển khai hoặc chạy test khi chưa làm.

Mục tiêu kiến thức: Payment-reliability demo với simulated rails, timeout, retry safety và recovery.

WATCH → DO (đọc code/test thực tế): PaymentController → PaymentService.create/process → RailGateway → integration tests.

LISTEN → SHADOW: V-Pulse is a payment-reliability demo built with Java, Spring Boot, PostgreSQL, Redis, and React. (2 lượt), rồi giải thích lại flow mà không nhìn script.

FREE SPEAK — P0 (ưu tiên, 4–6 câu mỗi buổi)

Q196 · P0 · PROJECT-SPECIFIC V5.1

TTS 391 · Q: What is V-Pulse, and does it connect to real banks?

TTS 391 · Câu hỏi
Tải MP3 391
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.

TTS 392 · Đáp án
Tải MP3 392
Q197 · P0 · PROJECT-SPECIFIC V5.1

TTS 393 · Q: Walk me through creating a payment instruction in V-Pulse.

TTS 393 · Câu hỏi
Tải MP3 393
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.

TTS 394 · Đáp án
Tải MP3 394
Q198 · P0 · PROJECT-SPECIFIC V5.1

TTS 395 · Q: Does a gateway timeout mean that the payment failed?

TTS 395 · Câu hỏi
Tải MP3 395
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.

TTS 396 · Đáp án
Tải MP3 396
Q199 · P0 · PROJECT-SPECIFIC V5.1

TTS 397 · Q: What is the difference between duplicate create and replaying a payment attempt?

TTS 397 · Câu hỏi
Tải MP3 397
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.

TTS 398 · Đáp án
Tải MP3 398
Q200 · P0 · PROJECT-SPECIFIC V5.1

TTS 399 · Q: When is a parked instruction allowed to replay in V-Pulse?

TTS 399 · Câu hỏi
Tải MP3 399
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.

TTS 400 · Đáp án
Tải MP3 400
Q201 · P0 · PROJECT-SPECIFIC V5.1

TTS 401 · Q: Explain timeout, circuit breaker, bulkhead, and rate limit in V-Pulse.

TTS 401 · Câu hỏi
Tải MP3 401
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.

TTS 402 · Đáp án
Tải MP3 402
Q202 · P0 · PROJECT-SPECIFIC V5.1

TTS 403 · Q: Why does V-Pulse call the gateway outside its database transaction?

TTS 403 · Câu hỏi
Tải MP3 403
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.

TTS 404 · Đáp án
Tải MP3 404
Q203 · P0 · PROJECT-SPECIFIC V5.1

TTS 405 · Q: How would you test V-Pulse's timeout and retry behavior?

TTS 405 · Câu hỏi
Tải MP3 405
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.

TTS 406 · Đáp án
Tải MP3 406
Q204 · P0 · PROJECT-SPECIFIC V5.1

TTS 407 · Q: What are the most important limitations of V-Pulse?

TTS 407 · Câu hỏi
Tải MP3 407
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.

TTS 408 · Đáp án
Tải MP3 408

FOLLOW-UP — P1 (chỉ học sâu sau P0)

Q205 · P1 · PROJECT-SPECIFIC V5.1

TTS 409 · Q: What happens if an old gateway result arrives after recovery?

TTS 409 · Câu hỏi
Tải MP3 409
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.

TTS 410 · Đáp án
Tải MP3 410
Q206 · P1 · PROJECT-SPECIFIC V5.1

TTS 411 · Q: What happens when Redis rate limiting fails in V-Pulse?

TTS 411 · Câu hỏi
Tải MP3 411
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.

TTS 412 · Đáp án
Tải MP3 412

UNEXPECTED FOLLOW-UP: Giả định rail đã khỏe lại nhưng instruction còn PARKED vì timeout. Giải thích vì sao vẫn không được blind replay.

SELF-CHECK: có nêu một invariant, một failure, một test và một giới hạn thật? Chỉ nói I implemented hoặc I ran với phần mình đã xác minh từ công việc cá nhân.


CHẶNG V — FDE VÀ CUSTOMER PROBLEM DECOMPOSITION


MÔ-ĐUN 10 [CORE][FDE] — Problem Decomposition cho người chưa từng học Solution Engineering

10.1. Decomposition khác LLD và System Design

Một yêu cầu như “khách hàng muốn đặt phòng nhanh hơn” chưa chỉ rõ phần mềm phải làm gì.

Thứ tự đúng: Customer problem → Scope → Features/rules → Data/API → Architecture → Delivery & metrics.
Sai lầm phổ biến: nghe chữ “slow” lập tức đề xuất Redis, nghe “automation” lập tức đề xuất AI agents.

10.2. Công thức 6 bước duy nhất

GOAL → CLARIFY → SCOPE → BREAK DOWN → DESIGN → VALIDATE

Bước Cần trả lời Kết quả phải viết ra
Goal Họ muốn thay đổi điều gì? 1 câu problem statement
Clarify Ai, quy trình hiện tại, dữ liệu, constraint? 4–6 câu hỏi quan trọng
Scope MVP có gì / không có gì? danh sách in-scope / out-of-scope
Break down Actors, workflows, entities, rules, exceptions? 3–5 tính năng và dependencies
Design Data/API/components? trade-offs? sơ đồ tối giản + lựa chọn
Validate Làm sao biết cải thiện? acceptance criteria + metric + demo

Khác với trả bài thuộc lòng: interviewer đổi một ràng buộc ⇒ bạn biết phải quay lại bước nào và sửa giả định.

10.3. Worked example 1 — “Hệ thống booking đang rất chậm”

Yêu cầu: Our hotel staff spend too much time handling reservation requests. We want to make it faster.

Bước 1 — Goal
Không vội hiểu là “trang web load chậm”. Chậm có thể là nhân viên phải nhập tay, phải chờ hệ thống khác, hoặc trả lời email chậm.

I'd like to understand which part of the booking process is slow and who is affected.

Bước 2 — Clarify (hỏi để tìm nguyên nhân)

  1. Who: Staff nào xử lý? Customer hay staff bị ảnh hưởng nhiều nhất?
  2. Current workflow: Request đến bằng email/phone/web? Ai nhập dữ liệu? Bao nhiêu bước?
  3. Volume: Một ngày bao nhiêu request, giờ cao điểm?
  4. Bottleneck: 5 phút chờ thao tác nào? Trả lời khách, check availability hay duyệt?
  5. Data/source: Lịch phòng nằm ở đâu, có API không?
  6. Constraints: Deadline, budget, privacy, languages, approval policies?

Bước 3 — giả lập câu trả lời khách hàng: - 100 yêu cầu/ngày qua email. - Nhân viên copy thông tin vào spreadsheet, rồi check availability ở PMS. - 80% yêu cầu là hỏi phòng trống và giá. - API của PMS cho phép tra cứu availability nhưng booking cần nhân viên xác nhận. - MVP cần trong 3 tuần; chưa cần thanh toán online.

Bước 4 — Scope: - In scope: web form thu thập dates/room type; gọi availability API; tạo request PENDING; staff dashboard; notification. - Out of scope: AI chatbot, payment gateway, revenue optimization, dynamic pricing. - Metric: thời gian nhân viên xử lý mỗi request; % yêu cầu phải nhập lại; tỷ lệ lỗi.

Bước 5 — Break down thành workstreams:

A. Collect information
   └─ web form + validation
B. Check availability
   └─ PMS adapter + timeout handling
C. Create request
   └─ booking request data + idempotency
D. Staff approval
   └─ dashboard + role/permission + status
E. Observe results
   └─ audit/events + processing time measurements

Bước 6 — Design: frontend form → Spring API → PMS adapter → PostgreSQL workflow states → staff dashboard. Nếu external PMS không xác nhận kịp: request thành PENDING_CHECK và nhân viên tra soát, không tự trả CONFIRMED.

Bước 7 — Validate:

Acceptance criteria: - Given dates hợp lệ và PMS trả availability, when customer gửi form, then tạo một request có ID. - Given PMS timeout, then không xác nhận phòng trống; hiển thị thông báo phù hợp và lưu trạng thái để xử lý tiếp. - Given staff không có quyền, then không thể approve. - Given hai lần submit cùng một idempotency key, then không sinh hai business requests khác nhau.

Business metric đề xuất (không bịa số đã đạt): đo median/percentile processing time trước và sau pilot, tỷ lệ re-entry, số lỗi booking.

Câu trả lời cuối 60–90 giây bằng tiếng Anh:

Before proposing a solution, I'd clarify which part of the current process is slow. Let's assume staff manually copy requests from email and check availability in a separate system. For an MVP, I'd provide a booking form, integrate the availability API, and create requests for staff approval. I'd keep payment and AI features out of scope initially. The main risks are stale availability and third-party timeouts, so the system should avoid confirming a booking until we have a reliable result. I'd measure staff handling time and error rates to validate whether the solution helps.

10.4. Worked example 2 — Data integration: ứng dụng rất gần FDE

Đề: Three vendors send product catalogs as CSV files with different formats. Our team spends hours cleaning and importing them.

Clarify: File có cột gì? encoding nào? ID trùng? Mỗi vendor gửi bao lần? Lỗi một dòng thì bỏ cả file hay ghi lỗi? Có hệ thống hiện tại? Có cần review bằng tay?

Định nghĩa MVP: 1. upload CSV + identify vendor; 2. adapter mapping vendor fields → canonical Product schema; 3. validate sku, price, currency, encoding, required fields; 4. detect duplicate file & duplicate SKU theo business rules; 5. import valid rows hoặc quarantine invalid rows; report lỗi; 6. audit import result và cho phép retry idempotent.

Vendor CSV A/B/C
      ↓
Format-specific adapters
      ↓
Canonical Product DTO
      ↓
Validate / Deduplicate
      ↓
Import transaction/batch → DB
      ↓
Import report + error rows

Trade-off: fail-fast cả file giúp consistency đơn giản hơn; partial import giúp tận dụng rows hợp lệ nhưng cần reconciliation/status và business sign-off.

Dự án V-Market trong CV của bạn đã có batch importer/encoding/duplicate checking, nên đây là chất liệu phỏng vấn cực phù hợp. Bạn có thể tận dụng kinh nghiệm đó để thảo luận mà không phải học framework mới.

10.5. Discovery questions — học theo nhóm, không học thuộc một trăm câu

Nhóm Mẫu câu Mục đích
Business goal What business outcome are you trying to improve? biết thành công nghĩa là gì
Users Who uses the current workflow? biết actor
Process Could you walk me through the current process? hiểu các bước đang làm
Constraints Are there any security or deadline constraints? không design phi thực tế
Data Where does the source data come from? biết hệ thống nào là authority
Scope What is essential for the first release? giữ MVP nhỏ
Success How would you measure success? chọn metrics đúng
Failure What happens when the external system is unavailable? chốt quy trình xử lý lỗi

10.6. Phân biệt assumptions, constraints, acceptance criteria và metrics

10.7. Luyện giải case chưa có sẵn giải pháp — giảm gợi ý

Case A (có gợi ý): A university wants to avoid clashes when students register for classes.

Gợi ý chỉ mở khi bí:

Gợi ý 1

Hỏi: “Clash” là xung đột lịch học, trùng chỗ, capacity, hay prerequisites?

Gợi ý 2

Liệt kê actors: students/admin/teachers; entities: course/section/timetable/enrollment; những rules phải giữ đúng.

Gợi ý 3

Đề xuất MVP trước: view class schedule → choose section → validate constraints/capacity → enroll → confirmation. Nhớ concurrency với last seat.

Case B (không gợi ý): A small logistics company complains that deliveries are often late. Build something to help.

Không được đề xuất ngay app GPS. Trong 12 phút, viết: problem statement, 5 discovery questions, in/out of scope, top 3 features, 2 risks và 2 metrics.

Mẫu trả lời Case B — chỉ mở sau khi làm

10.8. FDE interview scorecard (tự chấm 0–2 mỗi tiêu chí)

Tiêu chí 0 điểm 1 điểm 2 điểm
Discovery không hỏi hỏi 1–2 câu chung hỏi đúng bottleneck, users, constraints
Scope xây mọi thứ MVP chưa rõ MVP có in/out rõ
Breakdown một câu chung nêu vài features workflows + entities + business rules
Design kể tech stack có API/data nhưng thiếu flow flow hợp lý, đơn giản, nhất quán
Risks không nhắc lỗi có 1 failure nêu failure + mitigation phù hợp
Success không có KPI KPI chung chung acceptance criteria + measurable KPI
Communication nói lan man đủ ý nhưng không rõ tóm tắt logic, trả lời thay đổi

12–14/14 là tiêu chuẩn tự luyện đề xuất, không có ý nghĩa bảo đảm pass. Quan trọng hơn: làm được trên một case chưa từng đọc trước.

🎙️ SPEAKING LAB V5.2 — 10. FDE discovery và problem decomposition

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Goal → Clarify → Scope → Break down → Design → Validate; metrics and acceptance criteria.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
clarify the business goal làm rõ mục tiêu kinh doanh
define the MVP scope xác định phạm vi MVP
state an assumption nêu giả định
agree on acceptance criteria thống nhất điều kiện nghiệm thu

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. Before proposing a solution, I would clarify which workflow is failing and how often.
  2. I would define an MVP and measurable acceptance criteria with the customer.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

Before choosing a technology, I would ask . My MVP would . We could validate it by ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 2 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q207 · FOUNDATION · BASE V4

TTS 413 · Q: What makes an acceptance criterion testable?

TTS 413 · Câu hỏi
Tải MP3 413
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.

TTS 414 · Đáp án
Tải MP3 414
Q208 · MECHANISM / WHY · ADD V5

TTS 415 · Q: What is the difference between a business outcome and a technical output?

TTS 415 · Câu hỏi
Tải MP3 415
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.

TTS 416 · Đáp án
Tải MP3 416

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q209 · SCENARIO / FOLLOW-UP · BASE V4

TTS 417 · Q: A customer says their booking system is slow. What do you ask first?

TTS 417 · Câu hỏi
Tải MP3 417
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.

TTS 418 · Đáp án
Tải MP3 418
Q210 · SCENARIO / FOLLOW-UP · BASE V4

TTS 419 · Q: How would you distinguish symptoms from actual business goals?

TTS 419 · Câu hỏi
Tải MP3 419
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.

TTS 420 · Đáp án
Tải MP3 420
Q211 · SCENARIO / FOLLOW-UP · BASE V4

TTS 421 · Q: What if the customer wants to automate everything in the first release?

TTS 421 · Câu hỏi
Tải MP3 421
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.

TTS 422 · Đáp án
Tải MP3 422
Q212 · SCENARIO / FOLLOW-UP · BASE V4

TTS 423 · Q: How would you respond if the assumed root cause is disproved?

TTS 423 · Câu hỏi
Tải MP3 423
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.

TTS 424 · Đáp án
Tải MP3 424
Q213 · SCENARIO / FOLLOW-UP · ADD V5

TTS 425 · Q: How would you start a discovery meeting with a nontechnical client?

TTS 425 · Câu hỏi
Tải MP3 425
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.

TTS 426 · Đáp án
Tải MP3 426
Q214 · SCENARIO / FOLLOW-UP · ADD V5

TTS 427 · Q: How would you define acceptance criteria for a small MVP?

TTS 427 · Câu hỏi
Tải MP3 427
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.

TTS 428 · Đáp án
Tải MP3 428

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

If a customer says the booking system is slow, I would first ask which workflow is slow, how often it happens, and how it affects users. I would request evidence such as latency measurements and error logs. For the MVP, I would focus on the highest-impact bottleneck, not redesign the entire platform. We should agree on measurable acceptance criteria and verify the result with a realistic workload.

Knowledge guardrail: FDE không chỉ nói tech stack: phải liên hệ business outcome và điều kiện nghiệm thu.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 10.



LAB C [CORE][FDE] — Cold Decomposition: đề mới, yêu cầu thay đổi, không học thuộc

Mục tiêu: có thể nói chuyện với interviewer như với khách hàng thực sự. Không cố đoán họ muốn nghe tech stack nào. Đây là bài mô phỏng dựa trên kiểu năng lực đã được ứng viên FDSE/FDE kể lại, không phải đề thi công ty cụ thể.

C0. Công thức dùng khi đứng hình

GOAL → CLARIFY → SCOPE → WORKFLOW & DATA → EDGE CASES → VALIDATE.

Đặt tối thiểu một câu mỗi nhóm: Users? Current pain? Success metric? Data source? Permissions? Failure/constraint? Sau đó mô tả MVP bằng 3–5 hành động có thể quan sát, rồi mới nói component/API.

Khác biệt: Decomposition bắt đầu khi bài toán còn mơ hồ; LLD đi sâu vào classes/state/API cho chức năng đã chốt; system design giải thích cách các components tương tác và những quality constraints. Đừng nhảy vào sơ đồ server khi người dùng còn chưa xác định vấn đề.

C1. Cold case 1 — Kho hàng của cửa hàng nhỏ (12 phút)

A local retailer says, “Our inventory data is never accurate. Build a system to fix this.”

Không đọc đáp án trước. Viết: 5 discovery questions; 1 goal đo được; 1 MVP tối đa 3 features; 4 entities; 3 edge cases; 2 acceptance criteria.

Interviewer bất ngờ bổ sung ở phút 6: We already use an old point-of-sale system that exports CSV nightly. Employees still sell items during imports.

Sửa lại: đâu là source of truth, file snapshot hay delta, điều gì xảy ra nếu đè stock sau sale? Không cần thiết kế event streaming nếu chưa cần.

C2. Cold case 2 — Scheduling thay đổi thường xuyên (12 phút)

An operations manager says, “Shifts change every day and people keep showing up at the wrong time.”

Phải làm: goal, actors, workflow hiện tại, minimum feature, data model và cách thông báo thay đổi.

Interviewer thay yêu cầu: Employees do not have company email, some share phones, and managers need an audit trail.

Làm lại: authentication/identity giả định ban đầu có còn hợp lệ? kênh thông báo, consent, access control và audit có thay đổi không?

C3. Cold case 3 — Bảo vệ sự chính xác của báo cáo (12 phút)

A finance team receives daily reports from 3 suppliers and says their numbers do not match. They want automation.

Phải làm: xác định loại dữ liệu, cách nhận file/API, có canonical IDs không, thế nào là mismatch, rule xử lý và ai phê duyệt ngoại lệ.

Interviewer thay yêu cầu: One supplier sometimes sends corrections for the previous day.

Thiết kế lại idempotency/version/source timestamp và reconciliation; đừng giả định daily import append-only.

C4. Cold case 4 — Đặt lịch dịch vụ (15 phút, luyện bằng tiếng Anh)

The owner of a chain of repair shops says, “Customers complain that online appointments are unreliable.”

Trả lời tiếng Anh (có thể dùng câu ngắn):

  1. Three questions about problem / users / existing workflow.
  2. Two questions about source of truth / branch constraints.
  3. MVP with 3 features.
  4. One concurrency problem, one external integration failure.
  5. One customer-facing demo scenario and two measurable success criteria.

Interviewer đổi scope ở phút 8: Employees currently confirm every booking manually. We cannot remove manual approval in the first release.

Điều chỉnh state machine và acceptance criteria, không tự ép auto-confirmation.

C5. Khuôn trả lời 90 giây — không phải script cố định

Before proposing a solution, I'd like to understand the current workflow and which failure matters most. For the first release, I would focus on [one pain point] for [specific user]. The core data would include [entities]. One important risk is [failure case], so I would [control/test]. I'd validate the MVP using [measurable outcome].

Rubric 0–2 mỗi tiêu chí (tổng 12): Goal đúng vấn đề; questions làm rõ; MVP có phạm vi; workflow/data hợp lý; xử lý thay đổi yêu cầu; validation đo được. 0: không có, 1: có nhưng mơ hồ, 2: cụ thể và phù hợp giả định. 8+/12 là ngưỡng tự luyện để chuyển case; không phải chuẩn tuyển dụng.

HƯỚNG GIẢI — chỉ mở khi đã làm cả 4 case

C1: Hỏi stock có từ POS/ERP không, SKU/vendor mapping, snapshot/delta, tần suất, bán hàng online/offline, mục tiêu sai lệch. MVP: nhận feed → staging/reject report → apply có kiểm soát + reconciliation. Product, StockMovement, ImportJob, ImportRow/Discrepancy. Không overwrite snapshot cũ lên sale mới nếu chưa có cutoff/version policy. Acceptance: không tạo SKU trùng, rejected rows có reason, xử lý sale/import đồng thời không làm mất biến động đã commit.

C2: Goal giảm ca xuất hiện sai lịch. Xác minh người đổi lịch, approval, lead time, notification read/ack, thiết bị có/không. MVP: canonical roster, permissioned change, acknowledgement + audit. Employee, Shift, ShiftAssignment, ChangeRequest, AuditEvent. Shared phones làm identity kém tin cậy; chọn cơ chế xác thực phù hợp điều kiện người dùng, không giả định chỉ cần email. Metrics: tỷ lệ missed shift, notification acknowledgement delay.

C3: Cần định nghĩa canonical source, ID, timezone, currency, adjustment vs replacement, cutoff, người xác nhận mismatch. MVP: ingest/stage/normalize, reconciliation report, manual resolution. Supplier, DailyStatement, StatementVersion, ReconciliationRun, Discrepancy. Correction có version/effective date; rerun cho ngày liên quan không ghi đè history. Metrics: unresolved discrepancy count và resolution time. Không tự tạo chuyển tiền hoặc tự sửa số liệu chưa được duyệt.

C4: Hỏi fail tại booking, staff confirm, reminders hay branch inventory? Nguồn lịch có tập trung không? Appointment(PENDING_APPROVAL, CONFIRMED, REJECTED, CANCELLED); API tạo request/duyệt/cancel, branch/service/slot mapping. Concurrent booking không được tạo hai confirmations cho cùng slot. Timeout sau submit cần request ID/status lookup; demo staff xác nhận một appointment và customer nhận trạng thái. Metrics: thời gian tới confirmation và tỷ lệ khách phải gọi lại/booking bị trùng. Scope change giữ staff approval là requirement bắt buộc.

Nhiều hướng giải đúng: tiêu chí là không bịa business rules; nêu assumptions, dữ liệu, concurrency, failure và kiểm chứng rõ.

Qua LAB C nếu: nhận đề mơ hồ mới mà bạn có thể đặt câu hỏi, chọn MVP và cập nhật khi requirement thay đổi, thay vì đọc lại một case đã thuộc.

🎙️ SPEAKING LAB V5.2 — C. FDE cold cases + changing requirements

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Unseen case; discovery; explicit assumptions; alternative and trade-off; update plan under change.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
revisit the scope xem lại phạm vi
adjust the proposed design điều chỉnh thiết kế đề xuất
identify a constraint xác định ràng buộc
run an acceptance test chạy kiểm thử nghiệm thu

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. That new requirement changes my assumption about the source of truth.
  2. I would revise the MVP scope and validate the new constraint before implementing it.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

Originally, I assumed . With this new requirement, . I would change ___ and validate ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 4 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q215 · MECHANISM / WHY · BASE V4

TTS 429 · Q: Choose one cold case from LAB C and explain your first three discovery questions.

TTS 429 · Câu hỏi
Tải MP3 429
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.

TTS 430 · Đáp án
Tải MP3 430
Q216 · MECHANISM / WHY · BASE V4

TTS 431 · Q: How do you decide what belongs in an MVP?

TTS 431 · Câu hỏi
Tải MP3 431
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.

TTS 432 · Đáp án
Tải MP3 432
Q217 · FOUNDATION · BASE V4

TTS 433 · Q: What is your fallback if the customer data source is unavailable?

TTS 433 · Câu hỏi
Tải MP3 433
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.

TTS 434 · Đáp án
Tải MP3 434
Q218 · FOUNDATION · BASE V4

TTS 435 · Q: Which metric would show business value after deployment?

TTS 435 · Câu hỏi
Tải MP3 435
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.

TTS 436 · Đáp án
Tải MP3 436

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q219 · SCENARIO / FOLLOW-UP · BASE V4

TTS 437 · Q: The interviewer changes one business rule. How do you update the design?

TTS 437 · Câu hỏi
Tải MP3 437
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.

TTS 438 · Đáp án
Tải MP3 438
Q220 · SCENARIO / FOLLOW-UP · ADD V5

TTS 439 · Q: The customer changes the source of truth during the interview. What do you do?

TTS 439 · Câu hỏi
Tải MP3 439
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.

TTS 440 · Đáp án
Tải MP3 440
Q221 · SCENARIO / FOLLOW-UP · ADD V5

TTS 441 · Q: What if the customer needs a working demo next week?

TTS 441 · Câu hỏi
Tải MP3 441
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.

TTS 442 · Đáp án
Tải MP3 442
Q222 · SCENARIO / FOLLOW-UP · ADD V5

TTS 443 · Q: How would you prioritize two competing customer requests?

TTS 443 · Câu hỏi
Tải MP3 443
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.

TTS 444 · Đáp án
Tải MP3 444

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

Originally, I assumed that the customer had one reliable data source. If the requirement changes and there are two conflicting sources, I need to clarify which source is authoritative. I would update the data flow and define how conflicts are handled. Then I would narrow the MVP to a testable workflow and agree on acceptance criteria for correctness, latency, and recoverability.

Knowledge guardrail: Thay requirement phải thay model/test và đôi khi scope; không chỉ thay tên endpoint.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab C.



CHẶNG VI — GIAO TIẾP, LEARNING & PRACTICAL CODING


MÔ-ĐUN 11 [CORE] — Technical English: nói tự nhiên, ngắn, có cấu trúc

11.1. Vấn đề thật của người đã biết Java nhưng tiếng Anh kỹ thuật yếu

Bạn có thể biết câu trả lời bằng tiếng Việt nhưng vấp ở ba bước: 1. Decode: không biết interviewer đang yêu cầu definition, mechanism, trade-off hay example. 2. Retrieve: biết tiếng Việt nhưng không gọi ra được keywords tiếng Anh. 3. Speak: nghĩ quá lâu hoặc nói lan man vì cố tìm câu hoàn hảo.

Giải pháp: dùng short answer first. Một câu định hướng → 2–3 ý chính → ví dụ. Không cần mỹ từ.

11.2. Bộ từ “động từ chuyên môn” đáng luyện nhất

Từ Dùng trong câu nào?
validate validate user input
enforce enforce business rules / access control
retrieve retrieve a booking from the database
persist persist a record
allocate allocate inventory
prevent prevent duplicate requests
ensure ensure data consistency (trong phạm vi bảo đảm)
handle handle failures / exceptions
retry retry a failed request safely
reproduce reproduce a bug
investigate investigate the root cause
trace trace a request across components
measure measure latency / success rate
trade off trade off simplicity against scalability
assume / clarify assume approval is required / clarify requirements
prioritize / exclude prioritize the MVP / exclude payment initially

11.3. Bốn kiểu hỏi — bốn cách trả lời (với câu thật)

Kiểu 1 — WHAT: What is dependency injection?

Dependency injection means providing dependencies from outside a class instead of creating them inside it. In Spring, constructor injection makes dependencies explicit and helps with testing.

Kiểu 2 — HOW: Walk me through the booking request flow.

The controller validates the request and calls the service. The service checks business rules, interacts with the inventory store, and persists the booking when the conditions are met. The API then returns a booking ID and its status.

Kiểu 3 — WHY: Why did you use Redis?

We used Redis for caching and rate limiting. It can reduce repeated database reads, but cached data may become stale, so we don't rely on it as the only source of truth for critical booking decisions.

Kiểu 4 — WHAT IF: What if the third-party service times out?

We cannot assume that the operation failed just because the response timed out. I would use a request identifier, check the operation status, and retry only when the API contract supports safe retries. Otherwise, the request should remain pending for reconciliation.

11.4. Mini dialogue — mock discussion FDE (từng bước)

Interviewer: Our support team says the current process is too slow. What would you build?

Candidate (good first move): Before proposing a solution, could you describe the current workflow and the main bottleneck?

Interviewer: They manually copy requests from email to a spreadsheet.

Candidate: Understood. Roughly how many requests arrive daily, and do you have an existing customer database or API?

Interviewer: About a hundred daily, and we have a basic API.

Candidate: For an MVP, I would consider a structured intake form integrated with that API, so staff no longer need to copy data manually. We'd also need validation, duplicate prevention, and a way to handle API failures.

Interviewer: What if the API is down?

Candidate: I'd avoid losing the request. Depending on the business rules, I'd store it as pending, display the status to staff, and retry or reconcile when the API recovers.

Học được gì? Người trả lời không bắt đầu bằng tên framework; họ hỏi, chọn MVP và phản ứng khi ràng buộc thay đổi.

11.5. Vòng nói 10 phút hàng ngày

Tiêu chuẩn đạt: người nghe hiểu what, how, why, dù ngữ pháp chưa hoàn hảo. Với câu không biết, có thể nói rõ giới hạn và đề xuất cách kiểm chứng.

11.6. Project deep dive — 8 câu chỉ cần luyện 1 project thật sâu

Lưu ý: các câu sau là đề mô phỏng dựa vào kinh nghiệm trong CV, không phải câu hỏi đã được xác nhận từ công ty tuyển dụng.

  1. What problem does your project solve?
  2. Which parts did you personally implement?
  3. Walk me through one important request from UI to database.
  4. Why did you choose this database/cache/framework?
  5. What happens if an external API times out?
  6. How do you protect against duplicate or concurrent operations?
  7. What is one difficult bug you encountered? How did you debug it?
  8. If you were to build it again, what would you improve?

Khung trả lời 45–90 giây: Context → My action / implementation → Why → Test / observed outcome → Limitation. Đừng bịa số liệu hoặc nói “I built everything” nếu làm theo team.

11.7. DSA speaking tối giản

The problem asks us to ... My first approach would be ... That takes O(...). We can improve it by ... One important edge case is ... I would verify it with ...

Example:

The problem asks us to find two numbers whose sum matches the target. A brute-force solution checks every pair in O(n²). A hash map lets us check the complement in O(n) expected time, using O(n) extra space. I'd test duplicates and negative values.

🎙️ SPEAKING LAB V5.2 — 11. Technical English, project story, DSA explanation

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Clear short answers; project flow; contribution; why/failure/test; DSA describe complexity.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
I was responsible for... tôi phụ trách...
one challenge was... một khó khăn là...
I chose this approach because... tôi chọn cách này vì...
the time complexity is... độ phức tạp thời gian là...

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. I worked on a backend feature and focused on the request flow and error handling.
  2. One trade-off was added complexity in exchange for stronger consistency.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

The project solves . My contribution was . One issue was . I tested it by .

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 12 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q223 · PROJECT TEMPLATE · BASE V4

TTS 445 · Q: Tell me about one backend project in 60 seconds.

TTS 445 · Câu hỏi
Tải MP3 445

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.

TTS 446 · Đáp án
Tải MP3 446
Q224 · MECHANISM / WHY · BASE V4

TTS 447 · Q: Explain one bug and how you verified the fix.

TTS 447 · Câu hỏi
Tải MP3 447
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.

TTS 448 · Đáp án
Tải MP3 448
Q225 · MECHANISM / WHY · BASE V4

TTS 449 · Q: Walk me through one DSA solution and its time complexity.

TTS 449 · Câu hỏi
Tải MP3 449
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.

TTS 450 · Đáp án
Tải MP3 450
Q226 · PROJECT TEMPLATE · BASE V4

TTS 451 · Q: Which parts did you personally implement?

TTS 451 · Câu hỏi
Tải MP3 451

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.

TTS 452 · Đáp án
Tải MP3 452
Q227 · PROJECT TEMPLATE · ADD V5

TTS 453 · Q: What problem does your project solve?

TTS 453 · Câu hỏi
Tải MP3 453

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.

TTS 454 · Đáp án
Tải MP3 454
Q228 · PROJECT TEMPLATE · ADD V5

TTS 455 · Q: How can you prove which parts you personally implemented?

TTS 455 · Câu hỏi
Tải MP3 455

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.

TTS 456 · Đáp án
Tải MP3 456
Q229 · PROJECT TEMPLATE · ADD V5

TTS 457 · Q: Walk me through one important request from UI to database.

TTS 457 · Câu hỏi
Tải MP3 457

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.

TTS 458 · Đáp án
Tải MP3 458
Q230 · PROJECT TEMPLATE · ADD V5

TTS 459 · Q: Why did you choose this database/cache/framework?

TTS 459 · Câu hỏi
Tải MP3 459

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.

TTS 460 · Đáp án
Tải MP3 460
Q231 · PROJECT TEMPLATE · ADD V5

TTS 461 · Q: What happens if an external API times out?

TTS 461 · Câu hỏi
Tải MP3 461

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.

TTS 462 · Đáp án
Tải MP3 462
Q232 · PROJECT TEMPLATE · ADD V5

TTS 463 · Q: How do you protect against duplicate or concurrent operations?

TTS 463 · Câu hỏi
Tải MP3 463

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.

TTS 464 · Đáp án
Tải MP3 464
Q233 · PROJECT TEMPLATE · ADD V5

TTS 465 · Q: What is one difficult bug you encountered? How did you debug it?

TTS 465 · Câu hỏi
Tải MP3 465

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.

TTS 466 · Đáp án
Tải MP3 466
Q234 · PROJECT TEMPLATE · ADD V5

TTS 467 · Q: If you were to build it again, what would you improve?

TTS 467 · Câu hỏi
Tải MP3 467

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.

TTS 468 · Đáp án
Tải MP3 468

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q235 · SCENARIO / FOLLOW-UP · BASE V4

TTS 469 · Q: If you had one more week, what would you improve and why?

TTS 469 · Câu hỏi
Tải MP3 469
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.

TTS 470 · Đáp án
Tải MP3 470
Q236 · SCENARIO / FOLLOW-UP · ADD V5

TTS 471 · Q: How would you explain Two Sum and its time complexity?

TTS 471 · Câu hỏi
Tải MP3 471
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.

TTS 472 · Đáp án
Tải MP3 472

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

One project I can discuss is a Java Spring Boot backend that handles order-related workflows. I would start by explaining the user problem and the request flow. Then I would describe one issue, such as duplicate operations or inventory concurrency, and the specific code and tests I can verify. I would clearly distinguish my implementation from features I only explored. The main lesson is to explain design decisions with evidence, not just tool names.

Knowledge guardrail: Mẫu trên là cách kể, không phải xác nhận bạn đã tự làm mọi tính năng được nhắc tới.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 11.



🎙️ CASE LAB V5.2 — Cross-project practice (3 cặp Q&A)

Nguồn: ba bản Project Deep Dive được cung cấp; so sánh dùng trong mock, không phải thành tích cá nhân.

Mục tiêu kiến thức: Đặt các giải pháp concurrency, retry và integration cạnh nhau để chọn ví dụ phù hợp với JD.

WATCH → DO (đọc code/test thực tế): Chọn một flow checkout, một flow move hoặc một flow gateway và nêu class/test bạn thực sự đã đọc.

LISTEN → SHADOW: V-Market locks inventory so two different checkouts cannot oversell stock. (2 lượt), rồi giải thích lại flow mà không nhìn script.

FREE SPEAK — P0 (ưu tiên, 4–6 câu mỗi buổi)

Q237 · P0 · CROSS-PROJECT V5.1

TTS 473 · Q: How is the concurrency problem different in V-Market and V-Core?

TTS 473 · Câu hỏi
Tải MP3 473
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.

TTS 474 · Đáp án
Tải MP3 474
Q238 · P0 · CROSS-PROJECT V5.1

TTS 475 · Q: How are retries different between V-Market checkout and V-Pulse payment attempts?

TTS 475 · Câu hỏi
Tải MP3 475
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.

TTS 476 · Đáp án
Tải MP3 476
Q239 · P0 · CROSS-PROJECT V5.1

TTS 477 · Q: Which project would you discuss for Java Backend concurrency versus FDE integration?

TTS 477 · Câu hỏi
Tải MP3 477
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.

TTS 478 · Đáp án
Tải MP3 478

UNEXPECTED FOLLOW-UP: Người phỏng vấn chuyển từ bài toán inventory sang external payment. So sánh tính chắc chắn của local transaction và unknown downstream outcome.

SELF-CHECK: có nêu một invariant, một failure, một test và một giới hạn thật? Chỉ nói I implemented hoặc I ran với phần mình đã xác minh từ công việc cá nhân.


LAB D [CORE] — Technical English Listening + Reading New Code + Practical Coding

Tại sao khác với học thuộc từ vựng? Khi interviewer đưa một câu nói hoặc code chưa thấy trước, bạn phải (1) hiểu yêu cầu, (2) xác minh giả định, (3) xử lý vấn đề, (4) giải thích bằng lời. LAB này đặt thử thách theo thứ tự dễ → vừa → không gợi ý.

D1. Listening: phương pháp không cần audio đính kèm

File Markdown không chứa âm thanh. Bạn có thể dùng trình đọc văn bản thành giọng nói trên Windows/điện thoại, hoặc nhờ một người đọc các câu trong mục D2. Không xem transcript trước. Nếu tự học một mình, copy lần lượt câu vào TTS, quay sang cửa sổ khác, nghe một lần, tự nói lại bằng tiếng Việt và trả lời bằng tiếng Anh. Nếu không có TTS, tự đọc thành tiếng vẫn luyện speaking nhưng không thay thế luyện nghe.

Mỗi câu 3 lượt: 1. First listen: nói lại interviewer muốn define / mechanism / compare / design / debug / trade-off. 2. Second listen: ghi 3 keywords và điều kiện if/unless/only if/most/least. 3. Answer: trả lời 3–5 câu ngắn; yêu cầu phát lại/hỏi rõ một chỗ nếu thật sự cần.

D2. 12 câu nghe/nói, từ dễ đến có follow-up

Dùng bảng này làm answer sheet; transcript được đặt trong phần gấp/mở bên dưới nhằm hạn chế nhìn lén.

Lượt Nhóm Bạn cần ghi
1–3 Định nghĩa/compare Loại câu + 2 keywords
4–6 Mechanism/debug Các bước và failure
7–9 Design/assumption 2 câu làm rõ và lựa chọn
10–12 FDE follow-up Nêu trade-off và phản ứng trước scope change
12 PROMPTS cho TTS / partner — chỉ mở khi luyện
  1. Could you briefly explain the difference between an interface and an abstract class in Java?
  2. Why can a database index make an update slower even if it speeds up some reads?
  3. What's the main difference between authentication and authorization?
  4. Walk me through what happens when a browser sends a request to your Spring Boot API.
  5. A user reports that saving a booking timed out. Does that always mean no booking was created?
  6. How would you investigate a sudden increase in HTTP 409 responses?
  7. Design a simple feature that lets staff approve booking requests. What would you clarify first?
  8. You are allowed to use a relational database and a single service. How would you design the first version?
  9. What assumptions would you validate before adding a cache to this system?
  10. The client says the problem is not low throughput but incorrect inventory. Would your solution change?
  11. Suppose the vendor API does not support idempotency and may time out after applying a change. What would you do?
  12. Halfway through the project, the customer decides manual approval must remain. How would you adjust the MVP and explain the impact?

Self-score (0–2): 0 không nhận diện câu hỏi / trả lời lệch; 1 đúng chủ đề nhưng thiếu cơ chế/thiếu tự tin; 2 đúng ý, rõ bước và xử lý điều kiện. Thêm điểm listening nếu nghe hiểu không nhìn script. Không nên tự đánh giá nghe từ việc đọc transcript.

D3. Reading unfamiliar Java: WATCH — nhận trách nhiệm của class trước

class BookingFacade {
    private final ReservationClient client;
    private final BookingRepository repo;

    BookingFacade(ReservationClient client, BookingRepository repo) {
        this.client = client;
        this.repo = repo;
    }

    BookingResult reserve(String requestId, String roomId) {
        ExternalResult remote = client.createReservation(roomId);
        return repo.save(requestId, roomId, remote.id());
    }
}

Cách đọc trong 90 giây: method là reserve → input requestId,roomId → external network call → DB save → return. Failure window: provider có thể tạo reservation rồi DB save lỗi; nếu retry, có thể tạo reservation khác. Có requestId không đồng nghĩa provider/client đang dùng nó để chống trùng.

Mẫu giải thích: The facade calls an external reservation service and then saves a local record. A failure between these steps can leave an external reservation without a matching local record. I'd check whether the provider supports an idempotency key or status lookup before adding retries.

D4. COMPLETE — đọc code và tìm tối thiểu 3 vấn đề

class ImportService {
    int importQuantities(List<String> lines) {
        int count = 0;
        for (String line : lines) {
            String[] cells = line.split("\\|");
            int quantity = Integer.parseInt(cells[1]);
            db.updateQuantity(cells[0], quantity);
            count++;
        }
        return count;
    }
}

Đề: format mỗi dòng SKU|QUANTITY, số lượng không âm. Giả định db tồn tại và updateQuantity sẽ thay giá trị hiện tại. Hãy liệt kê input lỗi có thể làm code fail hoặc ghi sai và nêu bước kiểm thử; chưa cần viết lại toàn bộ implementation.

Đáp án gợi ý (sau 5 phút)

cells[1] có thể gây index error nếu thiếu dấu |; parse lỗi khi ký tự không phải số; số âm chưa bị từ chối; SKU rỗng/trailing whitespace; duplicate SKU có thể ghi đè khó hiểu; không rõ update SKU không tồn tại; import một phần nếu nửa file đã ghi rồi mới throw; CSV-like format có escaping và encoding cần spec riêng nếu dữ liệu thật phức tạp. Chọn validation/staging, check business key và failure policy. Tests: A|3, A|, A|-3, |2, A|abc, A|3 hai lần, crash giữa file.

D5. DO — thực hành Java không cho sẵn lời giải ngay

Yêu cầu rõ để code được: Viết phương thức parse nhận List<String> với định dạng giản lược SKU|quantity, không có escape/quote, mỗi SKU unique trong file (duplicate phải throw), trim hai trường; quantity là số nguyên ≥ 0; dòng lỗi ném IllegalArgumentException kèm số dòng. Trả về Map<String,Integer> giữ thứ tự input. Không ghi database. Đưa ra 5 tests. Giới hạn: không cần xử lý CSV chuẩn hoặc Unicode decoding ở bài này.

static Map<String,Integer> parse(List<String> lines) {
    // TODO: validate, split, parse, reject duplicate, return result
}
Hướng giải Java + test ideas — chỉ mở sau khi code
import java.util.*;

class SimpleFeedParser {
    static Map<String, Integer> parse(List<String> lines) {
        if (lines == null) throw new IllegalArgumentException("lines is null");
        Map<String, Integer> result = new LinkedHashMap<>();
        for (int i = 0; i < lines.size(); i++) {
            String line = lines.get(i);
            if (line == null) throw new IllegalArgumentException("line " + (i + 1));
            String[] a = line.split("\\|", -1);
            if (a.length != 2) throw new IllegalArgumentException("line " + (i + 1));
            String sku = a[0].trim();
            String qtyText = a[1].trim();
            if (sku.isEmpty()) throw new IllegalArgumentException("line " + (i + 1));
            int qty;
            try {
                qty = Integer.parseInt(qtyText);
            } catch (NumberFormatException ex) {
                throw new IllegalArgumentException("line " + (i + 1), ex);
            }
            if (qty < 0 || result.containsKey(sku))
                throw new IllegalArgumentException("line " + (i + 1));
            result.put(sku, qty);
        }
        return result;
    }
}

Tests: valid two rows preserves order; empty SKU; negative; malformed numeric; duplicate SKU; missing/extra separator; null line/list. Complexity roughly O(n + total characters) time and O(number of distinct SKUs) extra map space (excluding stored strings). Đây là parser cho format rất hẹp, không đủ xử lý CSV quoted values chuẩn.

D6. Learning interview: đọc tài liệu của một API giả tưởng

SPEC (chỉ dựa trên thông tin dưới đây): API VendorClient.update(sku, quantity, requestKey) trả UpdateResponse(status, version). status là APPLIED, ALREADY_APPLIED, hoặc TEMPORARY_ERROR. Cùng requestKey và cùng payload phải có cùng hiệu ứng; dùng cùng key khác payload trả error. Không có API lấy trạng thái operation theo key.

Nhiệm vụ trong 8 phút: 1. Chọn cách xử lý TEMPORARY_ERROR mà không làm phát sinh kết quả ngoài spec. 2. Nêu trường hợp vẫn không thể chắc trạng thái sau mất kết nối. 3. Viết pseudocode update có giới hạn retry, giữ requestKey, có logging không lộ secret. 4. Hỏi interviewer hai điều mà spec còn thiếu.

Hướng giải — đối chiếu với spec, không tự bịa

TEMPORARY_ERROR là status đã nhận; có thể retry bounded với same requestKey nếu spec thực sự bảo đảm idempotency theo key/payload. Mất kết nối không rõ request có áp dụng hay chưa; caller có thể retry same key theo contract, nhưng không biết kết quả cuối nếu hết retry và không có status endpoint; cần ghi trạng thái pending/manual reconciliation. Pseudocode: generate key per operation → loop max N → call same key/payload → APPLIED hoặc ALREADY_APPLIED thì success; TEMPORARY_ERROR thì backoff nếu chính sách cho phép; catch timeout lưu UNKNOWN và retry có giới hạn → hết lần thì escalate. Hỏi key TTL/scope và semantics của TEMPORARY_ERROR; cũng cần biết rate limit và pagination nếu có.

D7. Behavioral English — đủ cho vòng intern/junior

Chuẩn bị 3 câu chuyện thật theo Situation → Task → Action → Result → Reflection, tối đa 60–90 giây/câu. Chọn: (a) bug khó bạn debug; (b) thay đổi requirement; (c) học công nghệ mới trong thời gian ngắn. Result có thể là test/feature giao được; không bịa metrics, production incident hoặc công lao cá nhân.

Khung: The situation was ... My responsibility was ... I tried ... I verified the result by ... Next time, I would ....

D8. Ghép project thật sau khi học cơ chế

Chỉ chọn 1 project chính trong một lượt phỏng vấn. V-Market phù hợp để giải thích checkout, row locking, CSV import, reconciliation; V-Core phù hợp để giải thích WIP invariant, optimistic lock, audit/outbox; V-Pulse phù hợp reliability/recovery. Các bản phân tích project bạn tải lên có đánh dấu Confirmed in code / Inferred / Not verified. Trước khi nói "I built", xác nhận đúng vai trò và mở implementation/test thật. Không khẳng định test đã chạy xanh trong buổi ôn nếu chưa chạy.

Qua LAB D nếu: Bạn nghe được câu hỏi chưa biết trước, đọc một class lạ, code một parser đơn giản và giải thích hạn chế mà không dựa vào script.

🎙️ SPEAKING LAB V5.2 — D. Listening blind + unfamiliar Java + on-the-job learning

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Hear intent; explain unfamiliar code; identify bugs; ask for requirements; safe verification.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
as far as I understand... theo cách tôi hiểu...
this method appears to... method này có vẻ...
I would check the contract tôi sẽ kiểm tra contract
I would confirm this behavior tôi sẽ xác nhận hành vi này

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. From the method name and return type, this appears to parse an incoming request.
  2. I would read the API contract and write a small test before changing the code.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

This method appears to . I am not sure whether . I would verify it by ___.

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 2 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q240 · MECHANISM / WHY · BASE V4

TTS 479 · Q: Look at a Java method you have never seen. How do you understand it?

TTS 479 · Câu hỏi
Tải MP3 479
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.

TTS 480 · Đáp án
Tải MP3 480
Q241 · MECHANISM / WHY · BASE V4

TTS 481 · Q: How do you distinguish a missing requirement from a bug?

TTS 481 · Câu hỏi
Tải MP3 481
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.

TTS 482 · Đáp án
Tải MP3 482

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q242 · SCENARIO / FOLLOW-UP · BASE V4

TTS 483 · Q: What would you ask before integrating an unfamiliar API?

TTS 483 · Câu hỏi
Tải MP3 483
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.

TTS 484 · Đáp án
Tải MP3 484
Q243 · SCENARIO / FOLLOW-UP · BASE V4

TTS 485 · Q: What if the API documentation contradicts actual behavior?

TTS 485 · Câu hỏi
Tải MP3 485
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.

TTS 486 · Đáp án
Tải MP3 486
Q244 · SCENARIO / FOLLOW-UP · BASE V4

TTS 487 · Q: What test would you write before refactoring the method?

TTS 487 · Câu hỏi
Tải MP3 487
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.

TTS 488 · Đáp án
Tải MP3 488
Q245 · SCENARIO / FOLLOW-UP · ADD V5

TTS 489 · Q: The interviewer speaks too quickly. What would you say?

TTS 489 · Câu hỏi
Tải MP3 489
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.

TTS 490 · Đáp án
Tải MP3 490
Q246 · SCENARIO / FOLLOW-UP · ADD V5

TTS 491 · Q: How would you explain unfamiliar Java code before changing it?

TTS 491 · Câu hỏi
Tải MP3 491
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.

TTS 492 · Đáp án
Tải MP3 492
Q247 · SCENARIO / FOLLOW-UP · ADD V5

TTS 493 · Q: How would you learn a new backend library for an urgent task?

TTS 493 · Câu hỏi
Tải MP3 493
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.

TTS 494 · Đáp án
Tải MP3 494

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

When I read unfamiliar code, I first look at the method signature, input, output, and callers. Then I trace the data flow and identify side effects or exceptions. If I am unsure about an external API, I check the contract and run a small controlled test. I would avoid making a large refactor until I understand the expected behavior and can reproduce the issue.

Knowledge guardrail: Đừng nói “it probably works” chỉ từ tên method; cần contract và kiểm chứng.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab D.



MÔ-ĐUN 12 [CORE] — Bốn bài tập tổng hợp: gợi ý ít dần

Cách làm: lấy giấy hoặc VS Code, gõ câu trả lời trước khi mở đáp án. Mỗi case 15–20 phút. Nếu chưa biết gì, quay lại đúng bài; đừng mở đáp án ngay lập tức.

Case 1 — Có ví dụ trước, tự đổi requirement

Prompt: An app lets users register. Now the product owner wants a maximum of 3 active devices per account.

Nhiệm vụ: 1. Hỏi 3 câu làm rõ. 2. Đề xuất entity/session model. 3. Nêu cách xác định “active device”. 4. Xử lý login thiết bị thứ 4. 5. Nêu một race condition.

Gợi ý từng nấc
Đáp án tham khảo

Case 2 — Chỉ có yêu cầu + đầu ra

Prompt: Design an API to import customer orders from daily CSV files. Re-uploading the same file should not create duplicates.

Đầu ra (10 phút): entities, API, input validation, duplicate detection, failure behavior, tests, 45-second English summary.

Đáp án tham khảo

Case 3 — Decomposition không cho biết tech stack

Prompt: A school administrator says, "Teachers and students complain that schedules change too often. We need a better system."

Đầu ra (12 phút): Problem statement, 5 discovery questions, MVP scope, entities, risks, metrics, 60-second English explanation.

Đáp án tham khảo

Case 4 — Mô phỏng gần phỏng vấn thực: thay đổi requirement giữa chừng

Prompt: Design a simple internal expense reimbursement system for 30 employees.

Interviewer bổ sung ở phút thứ 6: Now the finance team says every expense over a threshold needs two-level approval, and approvals must be auditable.

Tự trình bày không gợi ý: - Phút 0–3: hỏi requirement, actor, constraints. - Phút 3–6: scope và design version 1. - Phút 6–10: điều chỉnh data/state/API sau thay đổi. - Phút 10–12: one failure, one trade-off, how to validate.

Rubric và hướng giải (xem sau khi làm)

Tự nhận xét sau mỗi case (viết 3 dòng):

Tôi bỏ sót: ...
Tại sao bỏ sót: (không hiểu từ / không biết bước / thiếu knowledge / vội chọn tech)
Lần sau tôi sẽ hỏi/kiểm tra: ...

🎙️ SPEAKING LAB V5.2 — 12. Integrated design cases

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Unknown prompt → assumptions → model/API → failure → test → revision.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
break the problem down chia nhỏ vấn đề
define the scope xác định phạm vi
protect the invariant bảo vệ điều kiện bất biến
demonstrate the result trình diễn kết quả

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. I would begin with the smallest testable use case and make my assumptions explicit.
  2. After validating the core flow, I would add failure handling and concurrency tests.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

My assumption is . The simplest design is . A failure case is . I would test .

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 2 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q248 · MECHANISM / WHY · BASE V4

TTS 495 · Q: Choose one integrated case: explain your assumptions and design.

TTS 495 · Câu hỏi
Tải MP3 495
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.

TTS 496 · Đáp án
Tải MP3 496
Q249 · FOUNDATION · BASE V4

TTS 497 · Q: Which business invariant is most important in your solution?

TTS 497 · Câu hỏi
Tải MP3 497
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.

TTS 498 · Đáp án
Tải MP3 498

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q250 · SCENARIO / FOLLOW-UP · BASE V4

TTS 499 · Q: What would you change if the interviewer added an external system?

TTS 499 · Câu hỏi
Tải MP3 499
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.

TTS 500 · Đáp án
Tải MP3 500
Q251 · SCENARIO / FOLLOW-UP · BASE V4

TTS 501 · Q: Where would you enforce data consistency?

TTS 501 · Câu hỏi
Tải MP3 501
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.

TTS 502 · Đáp án
Tải MP3 502
Q252 · SCENARIO / FOLLOW-UP · BASE V4

TTS 503 · Q: How would you show the solution works without claiming zero bugs?

TTS 503 · Câu hỏi
Tải MP3 503
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.

TTS 504 · Đáp án
Tải MP3 504
Q253 · SCENARIO / FOLLOW-UP · ADD V5

TTS 505 · Q: How would you design a simple course enrollment API from scratch?

TTS 505 · Câu hỏi
Tải MP3 505
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.

TTS 506 · Đáp án
Tải MP3 506
Q254 · SCENARIO / FOLLOW-UP · ADD V5

TTS 507 · Q: What do you do if two services cannot commit atomically?

TTS 507 · Câu hỏi
Tải MP3 507
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.

TTS 508 · Đáp án
Tải MP3 508

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

I would first clarify who uses the feature and which business rule must never be violated. Then I would define the main entities, one API flow, and the simplest deployment that can support the MVP. I would identify a failure case, such as a timeout or duplicate request, and describe how to verify the system behavior. If an external integration is added, I would revisit transaction boundaries and recovery.

Knowledge guardrail: Không áp đặt một design cho mọi đề; cần assumptions và trade-offs.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 12.



CHẶNG VII — ĐÁNH GIÁ VÀ ÔN TẬP


MÔ-ĐUN 13 [CORE] — Mock interview có đáp án, không học vẹt

13.1. Một vòng luyện 55 phút (tự làm trước, không dùng AI/tra cứu)

Phần Thời gian Cách làm
A. Technical English 5 phút nghe/đọc 5 câu hỏi, nói lại interviewer muốn dạng đáp án nào
B. CS MCQ 12 phút làm 24 câu dưới đây; không nhìn đáp án
C. LLD mini 12 phút tự thiết kế một yêu cầu đơn giản
D. FDE decomposition 15 phút hỏi yêu cầu, khoanh MVP, flow, risks, metrics
E. English oral 8 phút 2 câu knowledge + 1 câu project + 1 câu design
F. Tự chấm 3 phút xác định loại lỗi, không chỉ điểm số

Phần A — 5 prompts: 1. Walk me through how a request reaches your backend. 2. What happens if two requests update the same row? 3. Which assumption would you validate first? 4. Why would you choose a monolith for an MVP? 5. How would you measure whether your solution helped users?

Phần B — 24 MCQ tiếng Anh, từ dễ đến tình huống

Nhóm 1: nhận diện (1–8)

  1. Which option BEST describes a functional requirement?
    A. 99.9% uptime · B. Staff can approve a booking · C. P95 latency < 200 ms · D. Data encrypted at rest
  2. Which data structure usually supports BFS traversal?
    A. Queue · B. Stack only · C. HashSet only · D. Sorted array
  3. A method is overridden when...
    A. The parameter list changes in the same class · B. A subtype supplies a compatible inherited implementation · C. A variable is final · D. Two classes have the same name
  4. Which HTTP status usually means an authenticated client lacks permission?
    A. 200 · B. 401 · C. 403 · D. 500
  5. Which SQL expression counts rows with NULL in any column?
    A. COUNT(column) · B. COUNT(*) · C. SUM(column) · D. AVG(column)
  6. Which isolation anomaly means reading uncommitted data from another transaction?
    A. Dirty read · B. Phantom read · C. Deadlock · D. Starvation
  7. What is the PRIMARY purpose of a sequence diagram?
    A. Display table indexes · B. Show message order among participants · C. Show deployment costs · D. Show server CPU usage
  8. What is the difference between scale-up and scale-out?
    A. More CPU/RAM per instance vs more instances · B. SQL vs NoSQL · C. Sync vs async · D. Unit vs integration testing

Nhóm 2: hiểu cơ chế (9–16)

  1. Two Java threads each execute counter++ on a shared int. Which statement is correct?
    A. volatile alone makes it atomic · B. Counter cannot lose increments · C. A race condition may cause a lost increment · D. JIT guarantees the outcome
  2. Which is NOT a standard Coffman deadlock condition?
    A. Circular wait · B. Hold and wait · C. No preemption · D. Round Robin scheduling
  3. Why might an index slow down writes?
    A. The DB must also maintain index structures · B. Indexes block all inserts permanently · C. Indexes turn SQL into NoSQL · D. Indexes require HTTP
  4. A client times out after sending POST /bookings. Which is the safest initial conclusion?
    A. The server certainly did nothing · B. The server certainly committed · C. The operation outcome is not yet known · D. The booking must be cancelled
  5. Which statement BEST describes idempotency?
    A. Requests always return identical HTTP bytes · B. Repeated execution has the same intended effect as one execution, within defined semantics · C. Requests never fail · D. The network never duplicates packets
  6. When does LEFT JOIN preserve unmatched rows from the left?
    A. Always even if WHERE removes them later · B. During join, with NULLs for unmatched right columns, subject to later filtering · C. Never · D. Only after GROUP BY
  7. Why is a DB unique constraint useful for concurrent registrations?
    A. It prevents all network failures · B. It enforces uniqueness at the authoritative data store · C. It guarantees emails are delivered · D. It replaces every validation
  8. Which test best detects two simultaneous requests allocating the same last unit?
    A. One unit test for positive input · B. Concurrent integration test asserting inventory invariant · C. CSS snapshot test · D. Documentation lint

Nhóm 3: design và decomposition (17–24)

  1. A customer says, “Our workflow is slow.” What should you do FIRST?
    A. Add Redis · B. Deploy Kubernetes · C. Ask which step is slow and how it is measured · D. Rewrite everything in Go
  2. The product owner requests a simple internal task app for 15 users. Which starting point is usually easiest to justify?
    A. 12 microservices · B. Modular app + relational DB, revisiting after measuring constraints · C. Blockchain · D. No database
  3. A booking application stores availability in Redis. Which statement is safest?
    A. Redis data can never become stale · B. Cached availability alone always guarantees a room · C. Final allocation should use an authoritative inventory check/control · D. Disable all DB constraints
  4. An external service returns 503 intermittently. What is the best design consideration?
    A. Retry forever without limit · B. Classify failure and retry only with appropriate bounds and safe semantics · C. Never set timeout · D. Tell user the service succeeded
  5. What does out of scope mean in an MVP?
    A. The feature is impossible forever · B. A capability intentionally excluded from this release · C. A bug · D. A production outage
  6. What is a good acceptance criterion?
    A. The system is modern · B. Use more libraries · C. Given an unauthorized user, when they request approval, then access is denied · D. Build a nice UX
  7. An interviewer changes the requirement from one approver to two approvers. What should you do?
    A. Ignore it · B. Update actors/workflow/states/data model and discuss consequences · C. Switch to NoSQL automatically · D. Remove logging
  8. Which question best checks the business value of your delivered workflow?
    A. How many frameworks did we use? · B. Has the mean/median handling time and error rate improved under an agreed measurement plan? · C. How many classes exist? · D. Is the diagram colorful?

Phần C — mini LLD (12 phút)

Design a library book borrowing feature. A member can borrow an available copy, return it, and view active loans. A copy cannot be borrowed by two members at the same time.

Yêu cầu đầu ra: 2–4 questions, 3–5 entities, 3 API endpoints, state diagram bằng chữ, một concurrent invariant, một failure test, 45-second English explanation.

Phần D — FDE case (15 phút)

A small medical appointment center says: “Patients keep missing appointments. We need an app.”
Đầu ra: GOAL → CLARIFY (5 questions) → SCOPE → BREAK DOWN → DESIGN → VALIDATE. Không mặc định dữ liệu y tế được phép gửi qua mọi third-party service; privacy/security là constraint cần làm rõ.

Phần E — trả lời nói:

  1. Explain the difference between a database transaction and a Java synchronized block.
  2. Why might you choose a queue instead of directly sending an email in the request thread?
  3. Walk me through an important project decision you personally made.
  4. What would you do if a customer changed the requirements halfway through development?
ĐÁP ÁN PHẦN B — chỉ mở sau khi làm
Câu Đúng Vì sao / lỗi thường gặp
1 B Functional requirement là chức năng, các lựa chọn khác là quality/security constraints.
2 A BFS dùng FIFO queue cho traversal theo level.
3 B Overriding thuộc subtype; A thiên về overloading.
4 C 403 là thiếu quyền; 401 là xác thực chưa hợp lệ/thiếu.
5 B COUNT(*) đếm rows, COUNT(column) bỏ NULL.
6 A Dirty read = thấy uncommitted data.
7 B Sequence diagram biểu diễn messages theo thời gian.
8 A Vertical (up) vs horizontal (out).
9 C counter++ gồm nhiều bước; volatile không biến nó thành atomic.
10 D Scheduling RR không thuộc điều kiện Coffman.
11 A Chi phí duy trì index khi write.
12 C Timeout khiến outcome chưa biết; cần status/reconciliation/idempotency.
13 B Idempotency nói về effect được định nghĩa; không bắt buộc identical response bytes.
14 B WHERE filter có thể loại rows unmatched về sau.
15 B DB unique constraint là tuyến phòng vệ ở authoritative store.
16 B Concurrent integration test kiểm invariant thật.
17 C Discovery trước khi chọn giải pháp.
18 B Start simple; tăng độ phức tạp khi constraints thật yêu cầu.
19 C Cache không nên quyết định business allocation một mình.
20 B Retry có giới hạn và ngữ nghĩa an toàn.
21 B Out of scope = không nằm trong release/MVP hiện tại.
22 C Given/When/Then có thể kiểm chứng.
23 B Requirement mới ảnh hưởng workflow, states và data, không phải đổi stack vô cớ.
24 B Đo outcome thay vì đếm công nghệ.

Cách dùng điểm: - 0–15/24: quay lại Mô-đun 02, 04–08; ghi rõ vì sao sai. - 16–20/24: nền tảng đang lên; luyện tiếp Mô-đun 03, 07, 09–10 và các câu scenario sai. - 21–24/24: chuyển sang bài case chưa từng thấy và English oral; điểm MCQ cao không chứng minh design tốt.

Ngưỡng chỉ là cách tự học, không phải thang điểm tuyển dụng.

ĐÁP ÁN PHẦN C — Library Borrowing LLD
ĐÁP ÁN PHẦN D — Appointment Decomposition

Goal: giảm missed appointments, nhưng chưa khẳng định nguyên nhân là “thiếu app”.
Clarify: patients quên hay hủy sát giờ? Hiện nhắc lịch thế nào? Consent với SMS/email? Ai dùng? Có hệ thống booking/CRM sẵn chưa? Dữ liệu nhạy cảm và quy định áp dụng?
Scope giả định: reminders dựa trên lịch đã có + confirm/cancel/reschedule request + staff dashboard; không xây hồ sơ y tế hay diagnostic AI.
Breakdown: Appointment, PatientContact/consent, ReminderJob, Response, StaffAction; trạng thái scheduled/confirmed/cancelled, policy no-show.
Design: tích hợp nguồn lịch hiện tại → enqueue reminder theo chính sách + opt-in → track delivery/response → staff follow-up.
Failures: số điện thoại/email sai, provider down, duplicate reminders, timezone, privacy/consent.
Validate: no-show rate, reminder delivery rate, confirmation rate; compare baseline/pilot; định nghĩa cách đo công bằng.

ĐÁP ÁN PHẦN E — English sample answers
  1. A Java synchronized block coordinates access to shared memory within a JVM. A database transaction manages a unit of data operations under the database's guarantees. A JVM lock alone is not enough to protect data shared across multiple application instances.
  2. A queue can keep slow email delivery out of the user-facing request, improve resilience, and support retries. However, the worker must handle duplicate messages, failures, and delayed processing.
  3. Không có một đáp án chung đúng: dùng project thực tế, nói rõ tôi làm gì, tại sao, kiểm thử ra sao và còn hạn chế gì. Không bịa metrics.
  4. I'd confirm the new requirement and its impact on scope, data, workflows, and deadlines. I'd explain the trade-offs, agree on priorities, then update the design and acceptance criteria before implementing it.

13.2. Chấm lỗi theo nguyên nhân, không chấm mỗi điểm

Nếu vấp Dấu hiệu Hành động tối thiểu
Technical English reading đọc LEAST/EXCEPT/only if sai học lại Mô-đun 02, làm 10 câu phân biệt
CS knowledge không biết isolation, index, thread chỉ mở đúng Mô-đun 04–06 liên quan
LLD không chia nổi class/state/API làm lại Mô-đun 03 hoặc 07 với đề biến thể
System Design liệt kê technologies không có reason làm lại Mô-đun 09, buộc nêu “because” + trade-off
Decomposition không biết phải hỏi gì làm lại 10.2 bằng case mới
Speaking viết được nhưng nói không thành câu Mô-đun 11, ghi âm 30–60 giây mỗi ngày
Coding practical giải thích hay nhưng không code được quay lại luyện Java/SQL/LeetCode bên ngoài file này

🎙️ SPEAKING LAB V5.2 — 13. Mock interview + oral delivery

Thứ tự sử dụng: PRETEST → WATCH & DO ngay trong phần kiến thức phía trên → LISTEN/SHADOW → FREE SPEAK → FOLLOW-UP → feedback. Không mở đáp án trước lượt nói đầu.

Những ý kỹ thuật phải hiểu trước khi nói: Blend CS/Java/SQL/LLD/FDE; no scripted answers; question recognition and follow-up.

Từ đơn → cụm nói được (chỉ chọn 3–5 cụm để ôn hôm nay):

Useful chunk Nghĩa
let me think through it để tôi suy luận một chút
my assumption is... giả định của tôi là...
the key risk is... rủi ro chính là...
I would verify that by... tôi sẽ kiểm chứng bằng cách...

1. PRETEST + WATCH + DO

Hoàn thành ít nhất một bài COMPLETE/DO ở phía trên (hoặc giải thích một ví dụ mới). Nếu chưa giải thích được cơ chế bằng tiếng Việt, quay lại bài kỹ thuật trước khi bắt đầu nói.

2. LISTEN → SHADOW

A — LISTEN & SHADOW (3–4 phút): Ẩn chữ; dùng TTS/Voice đọc lần lượt các câu sau. Lượt 1 nghe và tóm tắt ý; lượt 2–3 bắt chước nhịp nói, rồi nói lại không nhìn.

  1. My assumption is that the database is the source of truth for inventory.
  2. The key risk is an inconsistent update when multiple requests arrive together.

3. COMPLETE ORALLY

B — COMPLETE ORALLY (1–2 phút): Điền bằng giọng nói, không cần viết câu hoàn chỉnh trước.

My understanding is . I would . The main risk is . I would verify it by .

4. FREE SPEAK — định nghĩa / cơ chế (không nhìn script)

Chọn 3–5 câu/lượt trong 5 câu sau. Đáp án được thu gọn dưới từng câu; chỉ mở sau khi đã nói.

Q255 · MECHANISM / WHY · BASE V4

TTS 509 · Q: Explain a technical concept from a randomly selected module in 45 seconds.

TTS 509 · Câu hỏi
Tải MP3 509
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.

TTS 510 · Đáp án
Tải MP3 510
Q256 · MECHANISM / WHY · BASE V4

TTS 511 · Q: Defend a design choice and name one trade-off.

TTS 511 · Câu hỏi
Tải MP3 511
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.

TTS 512 · Đáp án
Tải MP3 512
Q257 · FOUNDATION · BASE V4

TTS 513 · Q: Handle one unexpected follow-up without looking at notes.

TTS 513 · Câu hỏi
Tải MP3 513
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.

TTS 514 · Đáp án
Tải MP3 514
Q258 · FOUNDATION · BASE V4

TTS 515 · Q: What evidence would change your decision?

TTS 515 · Câu hỏi
Tải MP3 515
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.

TTS 516 · Đáp án
Tải MP3 516
Q259 · MECHANISM / WHY · BASE V4

TTS 517 · Q: Could you explain the same answer in simpler English for a non-engineer?

TTS 517 · Câu hỏi
Tải MP3 517
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.

TTS 518 · Đáp án
Tải MP3 518

5. UNEXPECTED FOLLOW-UP — thay giả định và suy luận

Chọn ít nhất một câu dưới đây, tự trả lời trước; sau đó yêu cầu người luyện thay một điều kiện mới.

Q260 · SCENARIO / FOLLOW-UP · ADD V5

TTS 519 · Q: How would you answer a question whose assumptions are incomplete?

TTS 519 · Câu hỏi
Tải MP3 519
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.

TTS 520 · Đáp án
Tải MP3 520
Q261 · SCENARIO / FOLLOW-UP · ADD V5

TTS 521 · Q: How would you respond when an interviewer challenges your design choice?

TTS 521 · Câu hỏi
Tải MP3 521
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. ---

TTS 522 · Đáp án
Tải MP3 522

6. REPEAT + FEEDBACK — checkpoint

E — REPEAT + FEEDBACK: Chọn câu khó nhất ở phần FREE SPEAK, nói 3 lượt (45–60 giây → 30–45 giây → 20–30 giây ở L1; tăng thời lượng ở L2), giữ ý chính và một test/example. Mở câu trả lời ngay dưới câu hỏi sau lượt 1; mỗi lượt chỉ sửa tối đa 2 lỗi.

Self-check (đánh dấu sau khi nói) Yes/No
Tôi giải đúng kiến thức và nêu được ví dụ / failure / test cần thiết [ ]
Tôi hiểu câu hỏi khi nghe, hoặc hỏi lại đúng chỗ [ ]
Tôi tự nói không nhìn script; có mở đầu và kết luận rõ [ ]
Tôi xử lý được ít nhất 1 follow-up mới [ ]

Mẫu trả lời dài V4 (tùy chọn; xem sau khi tự nói)

Show sample only after speaking

One possible answer (~40–90 words):

Before answering, I would clarify the requirement and state my main assumption. Then I would explain a simple, testable approach. For example, if the issue involves inventory concurrency, I would protect the invariant at the database boundary and verify it with two overlapping requests. The trade-off may be extra contention or complexity, so I would choose a solution appropriate to the actual workload.

Knowledge guardrail: Mock là đo phản xạ với câu hỏi mới; không dùng bài mẫu vừa đọc để tự cho điểm cao.

Reverse recall: Che sample; nói lại bằng từ của mình rồi trả lời follow-up số 2 trong Speaking Lab 13.




HARD MOCK V3.1 — ĐÁNH GIÁ THỰC CHẤT, KHÔNG HỌC THUỘC

Chỉ mở phần này sau một vòng học. Đề được tạo để luyện tư duy, không phải đề bị lộ hay bài thi chính thức. Đây là bộ riêng, khó hơn 24 MCQ nhận diện của V3. Hãy làm trước, chỉ xem đáp án khi kết thúc toàn bộ phần cần chấm.

E0. Một vòng 70 phút

Phần Thời gian Sản phẩm
A. 20 MCQ tình huống 20 phút 20 đáp án + 1 dòng vì sao cho 5 câu khó nhất
B. Java/API đọc code lạ 10 phút Mô tả flow, 2 bugs/risks, 2 tests
C. LLD + basic system design 15 phút 3 câu hỏi clarify, entities, APIs, state, failure, trade-off
D. FDE cold case 15 phút Goal/MVP/data/acceptance + response khi đổi requirement
E. Nói tiếng Anh 7 phút 2 answers dài 45–60s, 2 follow-ups
F. Error log 3 phút 3 lỗ hổng ưu tiên nhất

Phần A — 20 câu MCQ tình huống, chọn MOST defensible

1. A service checks availableSeats > 0, then decreases the count. Two requests race for the last seat. What is the strongest fix among these options?

A. Put @Transactional around the existing read-then-write, using the default isolation without extra checks.
B. Use a transaction and an atomic conditional update or suitable row lock, then test competing requests.
C. Synchronize the controller method in one JVM, even if the service may run on multiple instances.
D. Refresh the seat count after each request in the frontend.

2. A client gets a read timeout from a provider after sending a request to create a reservation. There is no status lookup and no documented idempotency contract. Which conclusion is safest?

A. Treat the timeout as a documented provider rejection and create a new request immediately.
B. Retry once with a new generated operation ID, because that will improve safety.
C. Mark the outcome as uncertain and investigate/reconcile before retrying blindly.
D. Increase the timeout on every retry; duplicates are then impossible.

3. The same idempotency key is reused with a different request body. Which behavior is easiest to defend in an API with stored request hashes?

A. Treat the new body as a new operation with the same key.
B. Ignore both requests permanently.
C. Return the old result without telling the caller the bodies differ.
D. Return a conflict according to the contract because one key must identify one operation.

4. An API returns HTTP 201 with status: PENDING_APPROVAL. A product manager says “201 means the booking is confirmed.” What is the best correction?

A. Creation of a booking resource and approval of that booking are the same event.
B. HTTP 201 indicates resource creation; approval is a separate business state.
C. 201 must be changed to 202 whenever a staff review is needed, regardless of whether a resource was already created.
D. 201 implies the resource cannot transition into another state.

5. A query filters by workspace_id, orders by created_at DESC, and frequently limits to 20 results. Before recommending an index, what should you do?

A. Add separate indexes on workspace_id and created_at without reviewing the actual plan.
B. Create a partial index only on created_at because ordering is the slow part.
C. Inspect workload and query plans, then evaluate an index matching filter and sort order.
D. Add one composite index in the reverse order of the query and assume the planner must use it.

6. You want departments whose employee count is over 10. Which construct filters grouped results?

A. WHERE COUNT(*) > 10 before GROUP BY.
B. HAVING COUNT(*) > 10 after GROUP BY.
C. ORDER BY COUNT(*) > 10.
D. LIMIT COUNT(*) > 10.

7. A cache stores user roles for five minutes. A user is removed from an admin role but can still approve a change briefly. What is the direct underlying problem?

A. Cached authorization data is stale; revocation is not immediately reflected.
B. Database isolation changed the meaning of the role value.
C. Authentication automatically fails whenever an authorization role changes.
D. The frontend must be failing to read a successful 200 response.

8. A payment provider reports success, but the app crashes before saving the final payment state. Which claim is valid?

A. Wrap the local database write in a transaction; that makes the provider operation atomic with it.
B. Retry a fresh provider request using a new key because the DB lacks the old state.
C. Reconcile the provider's outcome using a stable reference before deciding whether to retry.
D. Rely on a circuit breaker to deduplicate the already-successful charge.

9. A product owner asks for 12 microservices for a 20-user internal admin tool. How should a junior engineer respond?

A. Start with microservices because the product owner requested twelve; decide service boundaries later.
B. Clarify team, deployment and workload constraints; propose a simpler modular MVP unless separate services are justified.
C. Choose a queue-first architecture so all operations become asynchronous from day one.
D. Choose a serverless architecture without identifying the workflow or operational constraints.

10. A LEFT JOIN returns unexpected missing customer rows after adding WHERE orders.status='PAID'. Why?

A. Filtering orders.status in WHERE can remove left rows whose joined order is NULL.
B. LEFT JOIN only preserves unmatched left rows if a primary key is present in both tables.
C. LEFT JOIN preserves unmatched left rows even after any WHERE filter.
D. A database index must be missing on the right table, changing the set of returned rows.

11. You need to allow staff approval but prevent users from approving their own requests. Where should the invariant live?

A. Hide the approval button and assume users cannot invoke its API directly.
B. Enforce role and self-approval checks in backend logic and test unauthorized calls.
C. Check only that the request contains a valid JWT signature, regardless of its actor.
D. Add a foreign key from the request to the approver and assume that enforces the role policy.

12. A notification worker receives a message twice under an at-least-once queue. Which practice addresses the duplicate effect?

A. Increase the message visibility timeout and rely on that to prevent every duplicate.
B. Deduplicate by durable message/event ID or make processing idempotent.
C. Run just one worker instance and assume redeliveries cannot occur.
D. Disable retries, accepting lost notifications as the required behavior.

13. A Java class overrides equals() by business ID but does not update the corresponding hash behavior. Where might you first notice a bug?

A. A HashSet can incorrectly treat logically equal business objects as distinct.
B. The equals method can no longer be called directly by the JVM.
C. Changing the DB isolation level is required to fix Java object equality.
D. The compiler will reject every class that overrides equals without hashCode.

14. Two threads run count++ on a shared volatile int. Which statement is defensible?

A. volatile provides visibility, so the compound count++ becomes atomic.
B. count++ can still lose updates because the read-modify-write sequence is not atomic.
C. Synchronizing only the getter guarantees atomic increments in every writer.
D. Atomics are unnecessary because integer writes are indivisible on common platforms.

15. An order import job is marked COMPLETE, but the customer says inventory is now different from yesterday's file. Which question matters first?

A. Reapply the whole nightly file until the DB matches it exactly.
B. Clarify whether the file is a snapshot/delta and whether valid sales occurred after its cutoff.
C. Treat the import job's COMPLETED state as proof every stock row is still identical to the input.
D. Retry the job with a new ID, even if corrections and sales may already have happened.

16. A team reports 100% line coverage but missed a concurrency defect. What is the best interpretation?

A. Line coverage alone is sufficient if there are no thrown exceptions.
B. Add concurrent integration scenarios that assert the business invariant under overlapping requests.
C. Raise line coverage above 100% by repeatedly executing the same single-thread tests.
D. Switch unit tests to mocks so scheduling becomes deterministic and races no longer matter.

17. A downstream service fails, but the system successfully serves cached catalog data. Which risk still needs review?

A. Cached availability may be too stale for the operation the user is about to perform.
B. Any successful cache read proves the downstream is healthy and database stock is correct.
C. Retrying the cache read always guarantees the newest business data.
D. Removing the cache TTL is enough to make reads immediately consistent.

18. An interviewer says “Which approach is LEAST likely to prevent duplicates?” You know three proposed approaches each have limitations. What should you do?

A. Pick the strongest approach.
B. Choose the one that appears least effective under stated assumptions, and explain why.
C. Ignore LEAST; all answers are equal.
D. Always choose the longest answer.

19. A customer says the MVP needs manual approval, and your design automatically approves requests after validation. Which issue is most direct?

A. A functional requirement has been missed; the workflow/state model needs manual approval.
B. The design is still correct if the frontend says "pending" while the backend auto-approves.
C. An asynchronous email after auto-approval is equivalent to staff approval.
D. The requested manual step can be excluded without stakeholder agreement because validation passed.

20. A vendor's fictional API spec says identical requestKey + payload is idempotent for 24 hours. The client retries after 48 hours. What is safest?

A. Reusing the key after 48 hours is guaranteed safe because it worked on the first day.
B. The documented window expired; do not assume provider deduplication still protects a retry.
C. Retrying with a new key at 48 hours is safer because each retry needs a new identifier.
D. An HTTP POST becomes idempotent after the first successful response, independent of key lifetime.

Phần B — đọc code lạ (10 phút)

class MembershipService {
    private final MemberRepository repo;
    private final EventPublisher events;

    void promote(UUID workspaceId, UUID memberId) {
        Member member = repo.find(workspaceId, memberId);
        if (member.role() == Role.ADMIN) return;
        member.setRole(Role.ADMIN);
        repo.save(member);
        events.publish("MEMBER_PROMOTED", memberId.toString());
    }
}

Chỉ dựa trên code đã thấy: Mô tả flow; nêu 2 câu hỏi về access/authorization và reliability; nếu events.publish lỗi sau repo.save, điều gì có thể xảy ra? Thiết kế 2 tests. Đừng tự khẳng định @Transactional, outbox, authorization ở nơi khác có hoặc không vì snippet chưa cho thấy.

Phần C — LLD + Basic System Design (15 phút)

Design a simple equipment loan system for a small office. Employees borrow laptops from IT. Only available items may be borrowed. IT staff record returns and damages.

Yêu cầu: 4 questions → actors → 4 entities → 3 endpoints → states → concurrency invariant → error case → 1 trade-off → 45-second English explanation.

Phần D — FDE Case (15 phút)

A client says: “We spend two hours every morning cleaning supplier data. Please automate it.”

Bắt đầu bằng discovery và ghi assumptions. Phút thứ 7, interviewer bổ sung: “Different suppliers use different product IDs, and corrections can arrive days later.” Điều chỉnh MVP, mapping, version/reconciliation và acceptance criteria. Không cần đề xuất AI nếu chưa có bằng chứng đây là giải pháp phù hợp.

Phần E — Technical English oral (7 phút)

Nói không nhìn script:

  1. Why is a database transaction different from a Java synchronized block?
  2. Could you walk me through a production-like failure case in your project without claiming something you did not verify?
  3. What assumptions would you validate before introducing a queue?
  4. What would you tell a nontechnical customer if the requested automation is unsafe without manual review?

E1. ĐÁP ÁN VÀ RUBRIC — KHÔNG XEM TRƯỚC KHI LÀM

Đáp án 20 câu MCQ + reasoning
# Đáp án Tại sao phương án đúng hơn các phương án gần đúng
1 B Phải có concurrency control ở nguồn dữ liệu; @Transactional đơn lẻ không tự làm điều kiện read-then-write an toàn.
2 C Timeout tạo uncertainty; tránh retry mù khi không có idempotency/status contract.
3 D One operation/key; payload khác nên báo conflict thay vì âm thầm replay kết quả không liên quan.
4 B HTTP resource creation khác business confirmation.
5 C Query plan/workload trước khi chọn index; composite index là ứng viên chứ không phải cam kết luôn tốt.
6 B HAVING lọc nhóm; WHERE lọc hàng trước aggregation.
7 A Cache TTL có cửa sổ quyền cũ. Cần quyết định invalidation/shorter TTL/DB check cho action nhạy cảm.
8 C Local DB transaction không bao phủ provider side effect; phải đối soát trạng thái.
9 B Requirements và constraints đi trước kiến trúc; microservices có operational cost.
10 A Filter trên right-side trong WHERE loại các NULL unmatched rows.
11 B Quy tắc quyền phải được enforcement ở server; UI hiding không đủ.
12 B At-least-once có duplicate; cần idempotent effect.
13 A equals/hashCode contract rất quan trọng trong HashMap/HashSet.
14 B volatile hỗ trợ visibility/order, không làm thao tác read-modify-write atomic.
15 B Reconciliation cần cutoff/delta và phân biệt sale hợp lệ; không mặc định chênh lệch là lỗi.
16 B Coverage không chứng minh correctness trên interleavings.
17 A Availability của cache khác correctness/freshness.
18 B LEAST là hiệu quả ít nhất; phải đọc đúng điều kiện.
19 A Vi phạm yêu cầu chức năng/workflow; phải sửa states/approval.
20 B Idempotency chỉ được bảo đảm trong scope/window tài liệu nêu.

Ngưỡng học: ≥16/20 và giải thích được tối thiểu 5 câu scenario không nhìn đáp án là tín hiệu tốt; nếu câu dễ vẫn sai, quay lại mô-đun tương ứng. Không suy ra điểm mock = xác suất pass.

Rubric phần B — Code reading

Flow: find member → if already admin return → set role → save → publish event. Questions: who may promote? does workspace/member access get validated? Is repo.save committed before event is published? Is there transaction/outbox? A failure in publication may leave state/event out of sync depending on transaction boundaries not shown; cannot conclude chính xác chỉ từ snippet. Tests: unauthorized promotion must be rejected where policy is enforced; publishing failure should be simulated and expected DB/event behavior asserted based on agreed consistency contract. Also test duplicate promotions and nonexistent member.

Rubric phần C — Equipment Loan

Questions: item-level vs model-level? maximum loan length? damage policy? who can borrow/record return? Actors employee/IT. Entities Employee, EquipmentItem, Loan, DamageReport (và optional audit). APIs POST /loans, POST /loans/{id}/return, POST /items/{id}/damage-reports. States AVAILABLE/LOANED/MAINTENANCE/LOST; loan active/returned. Invariant: một thiết bị vật lý không có hai active loans; transaction/lock/constraint đúng nguồn dữ liệu. Errors: invalid item, already loaned, unauthorized; tests concurrent last-item borrow, return twice, mark damaged then deny borrowing. Trade-off: một monolith + SQL đủ cho MVP, không cần tách hệ thống phân tán. English: 3–5 câu có actor/data/rule/test.

Rubric phần D — Data Cleanup Decomposition

Goal là giảm time spent và error rate, chưa giả định tự động hóa 100% an toàn. Hỏi sample data/schema/encoding/volume, existing mapping, current manual steps, rule for duplicates/conflicts, source-of-truth, corrections, validation owners. MVP: connectors một vài supplier → staging + normalization/mapping → reject/exception queue → review UI/report → controlled apply. Entities: Supplier, SourceRecord, CanonicalProduct, Mapping, ImportJob, Correction/Version. Correction days later cần stable source identity, lineage, effective time và recompute/reconcile thay vì append vĩnh viễn. Acceptance: số hàng hợp lệ/không hợp lệ có giải thích, không trùng canonical ID, rerun cùng batch không có duplicate effect, thời gian xử lý giảm khi đo so baseline. Không bịa % tăng năng suất.

Rubric phần E — Oral

Mỗi câu chấm correctness (0–2), structure (0–2), clarification/follow-up (0–2), understandable English (0–2). Không trừ nặng accent nếu vẫn hiểu. Một trả lời tốt nêu một ý chính → cơ chế → ví dụ → hạn chế hoặc test. Câu (2) chỉ nói chi tiết project đã tự kiểm chứng và thuộc đóng góp của mình. Câu (4) nêu rủi ro, đề xuất human review và acceptance, không hứa automation hoàn toàn.

E2. Chấm lỗi theo nguyên nhân để quyết định học tiếp

Khi sai Không cần làm Cần làm
Không hiểu từ LEAST, assuming, unless Học thêm UML Ôn Mô-đun 02, nghe lại D2
Lẫn transaction với external side effect Học mạng toàn bộ Mô-đun SQL + LAB B + một project flow
Không chia được entities/state/API Học thêm design patterns LAB A → Registration → Booking
Chọn tech trước requirement Vẽ thêm architecture FDE C0 + cold case C1/C2
Biết nhưng không nói được bằng English Chép 100 từ vựng Mô-đun English + D1/D2 10 phút/ngày
Bị code lạ làm đứng hình Chỉ luyện LeetCode thêm LAB D3–D6: read→trace→modify→test

Chốt: Đây chỉ là kiểm tra các phần học chung. Vẫn cần duy trì DSA Medium có chọn lọc, một project deep dive có bằng chứng, Java/Spring practical và Applied AI nếu vị trí FDE có vòng AI-focused.


PHỤ LỤC A — QUICK REVIEW P0 (15–20 PHÚT TRƯỚC PHỎNG VẤN)

Đây là phiên bản active recall thay cho đọc thuộc. Che cột phải/đáp án; nói trước khi mở.

A1. 10 câu tiếng Anh phải hiểu ngay (2–3 phút)

Interviewer hỏi Bạn phải làm gì
What is ...? định nghĩa + ví dụ
How does ... work? từng bước
Why did you choose ...? lý do + trade-off
What if ... fails? failure + recovery
Compare X and Y. 2–3 điểm khác nhau
Walk me through ... input → components → output
What assumptions ...? giả định + cách kiểm chứng
Clarify the requirements. hỏi ai/cái gì/điều kiện/dữ liệu
MOST/LEAST/EXCEPT kiểm tra hướng chọn đáp án
How would you verify ...? tests/metrics

A2. 12 flashcards CS phải tự nói (4 phút)

  1. Process vs Thread? — Address-space isolation vs shared process resources.
  2. Concurrency vs Parallelism? — Overlap of progress vs actually simultaneous execution.
  3. Deadlock vs Race condition? — Wait cycle vs wrong outcome due to interleaving.
  4. TCP vs UDP? — Reliable ordered byte stream vs unguaranteed datagrams.
  5. 401 vs 403 vs 409? — Auth / permission / state conflict.
  6. WHERE vs HAVING? — Rows before groups / groups after aggregation.
  7. Index trade-off? — Eligible reads vs write/storage maintenance.
  8. Atomicity vs Isolation? — All-or-nothing / interaction of concurrent transactions.
  9. == vs equals()? — Object identity vs logical equality.
  10. Unit vs integration test? — Isolated unit behavior vs component interaction.
  11. Idempotent operation? — Repeated calls same intended effect within semantics.
  12. Cache hit vs stale data? — Fast read vs risk outdated state.

A3. Nhớ thứ tự trả lời design (4 phút)

LLD: Actors → Entities → Rules → States → APIs → Classes → Edge cases → Tests.

System design: Requirements → APIs/Data → Components/Flow → Failures → Trade-offs/Tests.

Problem decomposition: GOAL → CLARIFY → SCOPE → BREAK DOWN → DESIGN → VALIDATE.

Không đảo thứ tự: đừng chọn Redis/queue/microservices trước khi hiểu pain point.

A4. Một mini-case nói 4 phút

Customers complain that booking confirmations are unreliable. What would you investigate and propose?

Đáp án nhắc nhanh

Hỏi: lỗi gửi email hay booking chưa được lưu? Tỷ lệ lỗi và logs? Lỗi chỉ lúc peak hay mọi lúc? Các nguồn dữ liệu là gì?
Giả thuyết: external email provider down, race condition, request timeout.
Đề xuất đo: tracking booking_id–notification_event_id, logs, success/delivery rate, pending status, retries có kiểm soát.
Không được tự kết luận “thêm queue là hết lỗi” khi chưa biết nguyên nhân.


LỘ TRÌNH 16 BUỔI — ĐI TỪ DỄ ĐẾN KHÓ (KHÔNG ÉP DEADLINE)

Bổ sung V3.2 cho ứng viên Java: sau buổi 7, xen thêm 2–4 buổi tự học 08A → 08B → LAB 08C tùy kết quả PRETEST; bảng 16 buổi dưới đây là tuyến CS/LLD/FDE gốc, không bao gồm các buổi Java bổ sung.

Một "buổi" là một đơn vị học 30–60 phút, không bắt buộc một buổi một ngày. Mỗi buổi thực hiện WATCH → COMPLETE → DO → EXPLAIN. Khi đã làm được cold test thì chuyển nhanh; khi chưa đạt thì dừng đúng chỗ vướng.

Buổi Học gì Bằng chứng đã hiểu (tự làm, không nhìn bài)
1 Mô-đun 01–02 (request flow + interview verbs) 1 request flow + phân loại 10 câu hỏi
2 LAB A: entity, state, rule, API tự thiết kế note/enrollment/leave request
3 Mô-đun 03: Registration LLD 1 biến thể password reset có entity + 2 API
4 Mô-đun 04: SQL, transactions 1 JOIN + giải thích race/rollback
5 Mô-đun 05–06: HTTP và OS diễn giải timeout/concurrency với 3 failure scenarios
6 Mô-đun 07: Booking states/API 1 sequence + 2 concurrent tests
7 Mô-đun 08: Testing/Cloud/Java recap pretest/MCQ, chỉ đọc các mục sai
8 Mô-đun 09: System Design MVP → components → reliability → 3 trade-offs
9 LAB B: Integration/Debug 1 scenario timeout + 1 CSV scenario
10 Mô-đun 10: FDE decomposition worked case + 5 discovery questions
11 LAB C: case 1–2 case không nhìn gợi ý + requirement change
12 LAB C: case 3–4 1 case bằng tiếng Anh 90 giây
13 Mô-đun 11: English & project tự nói một project 2 phút, nhận follow-up
14 LAB D: nghe và đọc code lạ 6 listening prompts + Java parsing exercise
15 Mô-đun 12: 4 case tích hợp 2 case không gợi ý; tự sửa 3 lỗi điển hình
16 Mô-đun 13 + HARD MOCK làm bài không tra cứu; phân loại lỗi và chọn mục ôn

Cách dùng ba tài liệu project mà bạn đã cung cấp

Bằng chứng cần phân loại rõ: Confirmed in code = nội dung của báo cáo đọc code, Inferred = suy luận, Not verified = chưa xác minh; việc có test trong source không chứng minh đã chạy lại hoặc CI hiện đang xanh. Giải thích trung thực phần bạn trực tiếp làm; không tự nhận ownership không có chứng cứ.

Error log template — copy sau mỗi mock

Date:
Question / situation:
What I answered (2 sentences):
What I missed:
Cause: [term] [knowledge] [reasoning] [code] [English/listening] [time]
One correction:
Retest on (tomorrow / +3 days / +7 days):

Tiêu chuẩn dừng ôn một chủ đề

Nếu đạt bốn điều này ở một nhóm, chuyển sang lỗ hổng tiếp theo. Tránh cố học mọi tài liệu đến mức như Senior mới dám apply.

Nguồn và giới hạn áp dụng

Phương pháp học: Dunlosky và cộng sự (2013), Improving Students' Learning With Effective Learning Techniques: https://doi.org/10.1177/1529100612453266 (practice testing, distributed practice); Renkl & Atkinson (worked examples / fading guidance) — xem tài liệu nghiên cứu giáo dục có cùng chủ đề. Đây là cơ sở cho cách bố trí học, không phải bảo đảm hiệu quả cho từng người hoặc định lượng thời gian chuẩn.

Kinh nghiệm phỏng vấn: Các ví dụ coding, decomposition, learning, client-facing, project deep dive đã được đối chiếu với tự thuật ứng viên FDE/FDSE và Java Backend trong quá trình biên soạn V3; không phải một blueprint chung cho mọi công ty. Câu hỏi được soạn trong V3.1 là mô phỏng phục vụ luyện tập, không phải bản sao câu hỏi tuyển dụng thực tế.

Phạm vi: Không thay thế luyện LeetCode Medium, Java/Spring implementation sâu, spoken English có feedback từ người thật, Applied AI/RAG/agents (khi vị trí FDE chuyên AI), hoặc phỏng vấn riêng từng công ty.


Nguồn tham khảo — phân biệt tài liệu gốc và phần bổ sung

Nghiên cứu phương pháp học (được dùng để thiết kế cách học, không phải chứng minh 16 buổi chắc chắn đủ):

  1. Dunlosky et al. (2013), Improving Students' Learning With Effective Learning Techniques, Psychological Science in the Public Interest — nhấn mạnh practice testing và distributed practice: https://www.psychologicalscience.org/journals/pspi/1529100612453266/
  2. The Learning Scientists, Six Strategies for Effective Learning — spacing, retrieval, elaboration, interleaving, concrete examples, dual coding: https://www.learningscientists.org/blog/2016/8/18-1
  3. Pooja K. Agarwal, How can we maximize students' learning with feedback? — retrieval practice + feedback: https://www.retrievalpractice.org/strategies/2018/5/25/feedback
  4. Van Gog & Rummel (2010/2011), Effects of worked examples, example-problem, and problem-example pairs on novices' learning: https://doi.org/10.1016/j.cedpsych.2010.10.004
  5. Shin et al. (2023), The Effects of Worked-Out Example and Metacognitive Scaffolding on Problem-Solving Programming — hướng dẫn bằng ví dụ trong học lập trình: https://doi.org/10.1177/07356331231174454

Trải nghiệm ứng viên (được dùng để chọn dạng bài thực hành, không phải dự đoán chính xác đề từng công ty):

  1. Glassdoor — FDE interview reports có API design, API data processing, retry logging, LeetCode: https://www.glassdoor.com/Interview/foward-deployed-engineer-interview-questions-SRCH_KO0%2C24.htm
  2. Glassdoor — FDE New Grad reports có DSA/SQL/API questions: https://www.glassdoor.com/Interview/forward-deployed-engineer-new-grad-interview-questions-SRCH_KO0%2C34.htm
  3. Reddit r/cscareerquestionsEU (09/10/2026) — một ứng viên đang phỏng vấn FDE kể về JSON parsing, Kubernetes ingress, project/design và client-facing case: https://www.reddit.com/r/cscareerquestionsEU/comments/1x1nuyb/forward_deployed_engineer_interviews/
  4. Reddit r/developersIndia (21/01/2026) — ứng viên 6 năm kinh nghiệm được hỏi Spring transactions, index, concurrency; không dùng làm chuẩn độ sâu cho Fresher: https://www.reddit.com/r/developersIndia/comments/1qiqpyn/recent_java_backend_developer_interview_experience/

Tài liệu kỹ thuật tham chiếu (mở khi muốn kiểm tra chi tiết, không cần học tất cả):

  1. Oracle Java — Object.equals() / hashCode(): https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html
  2. MDN — HTTP overview: https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
  3. PostgreSQL — Transactions: https://www.postgresql.org/docs/current/tutorial-transactions.html
  4. PostgreSQL — Transaction Isolation: https://www.postgresql.org/docs/current/transaction-iso.html
  5. Microsoft SQL Server data type families: https://learn.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql
  6. ISTQB Foundation syllabus (testing terms): https://istqb.org/wp-content/uploads/2024/11/ISTQB_CTFL_Syllabus_v4.0.1.pdf

KẾT THÚC — THẾ NÀO LÀ ĐỦ ĐỂ BẮT ĐẦU ĐI PHỎNG VẤN?

Bạn không cần đợi thuộc hết tài liệu. Hãy bắt đầu phỏng vấn khi tự làm được những việc sau không nhìn mẫu:

Nhớ câu này: A strong junior answer is not the most complicated architecture. It is a clear explanation of the problem, a sensible simple solution, its limitations, and how to verify that it works.

Cập nhật V3.2 cho Java Backend: trước khi coi phần Java đã xong, hãy hoàn thành 08A.6 (Java Mock), 08B.6–7 (Spring scenario + Mock) và LAB 08C. Đọc/hiểu code trong project thực tế quan trọng hơn thuộc lòng sample answer. Các bài thực hành tự soạn trong 08A–08C là đề luyện, không phải câu hỏi chính thức của công ty nào.


PHỤ LỤC V4 — LUYỆN PHẢN XẠ THỰC TẾ, KHÔNG HỌC SCRIPT

1. Bài luyện nghe không nhìn chữ: 15 prompt theo mức độ

Cách dùng: đưa các prompt cho người khác hoặc AI Voice, yêu cầu đọc ngẫu nhiên từng câu, không đọc đáp án. Trong 5 giây, phân loại dạng hỏi; sau đó trả lời 20–90 giây. Đánh dấu L nếu không bắt được âm, T nếu không hiểu thuật ngữ, S nếu hiểu mà không bật ra câu nói.

Cấp Prompt Loại đáp án cần có
1 What is a database transaction? Definition + one example
1 What does a controller do? Responsibility + flow
1 What's the difference between 401 and 403? Comparison
1 How do you validate a request body in Spring? Mechanism
1 Why do we use indexes? Reason + cost
2 Could you walk me through a registration request? Input → components → output
2 How would you avoid duplicate orders after retries? Failure + prevention
2 Why doesn't volatile guarantee atomic increments? Mechanism + example
2 What would you test if two clients reserve the last item? Concurrent test + invariant
2 Which assumption would you clarify before creating a booking API? Clarification
3 The request timed out. Can you prove that the operation was rolled back? Resist incorrect premise
3 Your SQL query is still slow despite an index. What would you inspect? Diagnosis
3 The business changes the approval rule. What needs to change in the design? Requirement change
3 What's the trade-off between caching availability and strong consistency? Trade-off
3 Explain your approach again to someone who isn't an engineer. Simplification

2. 5 cuộc hội thoại mô phỏng — nói phần Candidate trước khi xem gợi ý

Dialogue A — Java Core

Interviewer: What is the difference between equals and == in Java?

Your turn: tự trả lời 20–30 giây.

Interviewer: What can go wrong if a HashMap key changes after insertion?

Gợi ý sau khi tự nói

== thường so sánh identity của object reference; equals có thể biểu diễn logical equality. Mutable key thay đổi thông tin được dùng trong equality/hash có thể làm map không tìm lại key theo cách mong đợi. Không phải mọi object đều override equals.

Dialogue B — Spring Boot

Interviewer: Walk me through what happens when a POST request reaches a Spring controller.

Your turn: giải thích Controller → DTO validation → Service → Repository → response.

Interviewer: If @Valid passes, can we assume the email is unique?

Gợi ý sau khi tự nói

@Valid kiểm annotation validation tương ứng, nhưng không thay thế ràng buộc dữ liệu và concurrency control ở DB. Unique constraint của DB là cơ chế bảo vệ quan trọng khi có các request chồng lấn.

Dialogue C — SQL / reliability

Interviewer: A payment-like operation times out. What would you do?

Your turn: tránh kết luận đã thất bại; nói về xác minh status, idempotency, log, reconciliation theo contract. Không tự giả định provider hỗ trợ idempotency.

Interviewer: What if the downstream API has no idempotency key support?

Gợi ý sau khi tự nói

Điều tra trạng thái theo operation/reference nếu API hỗ trợ, thiết kế workflow với trạng thái UNKNOWN/PENDING, có reconciliation/đối soát; tránh retry mù gây duplicate side effects. Giới hạn của các biện pháp tùy hợp đồng external API.

Dialogue D — Project deep dive

Interviewer: Tell me about a project where you handled a difficult backend scenario.

Your turn: nói đúng contribution thật trong V-Market, V-Core, V-Pulse hoặc sản phẩm internship; không nhận implement khi chỉ thấy trong repo.

Interviewer: What is one test that proves the important business rule?

Gợi ý sau khi tự nói

Dùng cấu trúc: The main risk was... The invariant was... I checked... The test sent... I expected... Cần kiểm tra test có thực sự tồn tại và kết quả chạy trước khi nói “the test passed”.

Dialogue E — FDE discovery

Customer: Our staff waste time updating bookings every day. Can you build an AI system?

Your turn: đặt câu hỏi về workflow, loại thay đổi, volume, errors, nguồn dữ liệu, người phê duyệt và success metric trước khi đề xuất AI.

Customer: We only have two weeks, and our source data is sometimes wrong.

Gợi ý sau khi tự nói

Khoanh MVP nhỏ, làm rõ source of truth, quy trình kiểm dữ liệu và human review, đặt acceptance criteria khả thi. Không tự kết luận “AI solution” là phù hợp chỉ vì khách hàng gọi tên AI.

3. 4 phiên General English 7 phút (xen giữa buổi kỹ thuật)

General English là điều kiện hỗ trợ hội thoại tự nhiên, không thay thế các Speaking Lab chuyên môn.

Phiên Câu gợi mở Follow-up
A — Routine What did you work on today? What was easier or harder than expected?
B — Experience Tell me about a difficult task you completed. How did you decide what to do first?
C — Opinion Do you prefer working alone or with a team? Can you describe a time this mattered?
D — Plans What do you want to improve next month? How will you measure your progress?

Quy tắc: nhờ AI/partner hỏi ngẫu nhiên 3–5 câu, đừng đọc lại câu trả lời đã chuẩn bị. Nếu ngừng quá lâu, trả lời bằng câu ngắn và được phép tự sửa: What I mean is... / Let me say that more clearly.

4. Speaking project drill — đừng biến thành bản quảng cáo CV

Chỉ chọn một project chính để luyện sâu cho đến khi tự giải thích được bằng tiếng Anh; với Java Backend thường phù hợp dùng V-Market, mở chính source thật để xác minh. Bộ câu hỏi:

  1. What problem does the project solve, and who uses it?
  2. What was your personal contribution?
  3. Walk me through one request from API to database.
  4. What invariant does the backend have to protect?
  5. What can go wrong when two requests arrive together?
  6. Why did you choose this approach instead of an alternative?
  7. Which test did you actually write or run? What result can you confirm?
  8. What would you improve if you had more time?

Story format (90 giây): Problem (15s) → Flow (25s) → Challenge (20s) → Choice/trade-off (15s) → Verification (15s). Đây là mốc luyện, không phải thời lượng chuẩn hóa. Không nói “production-ready”, “deployed”, “tested in CI”, “I built” nếu không kiểm chứng/không đúng vai trò. Có thể nói trung thực: I can explain this code path, but I haven't personally deployed that component.

5. Lịch 20 buổi tích hợp (tự điều chỉnh theo checkpoint)

Một buổi không đồng nghĩa một ngày. Nếu kiến thức quá khó, tách buổi; nếu đã đạt checkpoint, chuyển nhanh. Với Java Backend tập trung 08A/08B/08C trước; với FDE tăng thời lượng 10/LAB C.

Buổi Core lesson Nhiệm vụ speaking tối thiểu
1 01 Requirements / flow Explain actor → rules → flow 40s
2 02 Question recognition Nghe 10 prompts; phân loại ≥8/10
3 LAB A Describe entities and invariant 45s
4 03 Registration LLD Explain two responsibilities and one race 60s
5 04 SQL/transactions Compare JOIN/index/lock; 1 follow-up
6 05 HTTP Explain uncertain timeout 60s
7 06 Concurrency Explain lost increment 60s
8 07 Booking Present state + one failure 90s
9 08 Testing/security Explain 3 tests and authorization 60s
10 08A Java Core Answer 5 random oral Java prompts
11 08B Spring/JPA Walk through a request; one N+1 follow-up
12 LAB 08C Fix code/query and defend in 60–90s
13 09 System Design Explain simple MVP + trade-off 90s
14 LAB B Diagnose 504 using evidence 90s
15 10 FDE Clarify/scope/metric 90s
16 LAB C Cold case + mid-answer requirement change
17 11 Project/English Explain own project 90s; 2 follow-ups
18 LAB D 5 blind listening questions + unfamiliar code
19 12 Integrated cases One independent system design 90s
20 13 Mock + HARD MOCK 5–8 min unscripted oral with K/S/L scoring

Tuyến rút gọn Java Backend: 02 → 04 → 08A → 08B → LAB 08C → 05/06 → 11 + project → LAB D → 13. Tuyến FDE: 02 → 01 → LAB A → 03/07 → 09 → LAB B → 10 → LAB C → 11 → LAB D → 13. Nhánh khác vẫn ở cùng file khi cần.

6. Error log hai chiều — copy sau mỗi buổi

Date / lesson:
Task and question:
Technical score K (0–3):
Speaking score S (0–3):
Listening score L (0–3):
Technical misconception (if any):
What I actually said (short transcript or summary):
1 pronunciation / word-choice correction:
1 technical / clarity correction:
Sentence I can now say without looking:
New follow-up question I answered:
Review on +1 / +3 / +7 / +14:

Cách phân loại để không học lan man: K thấp, S cao = đang nói trôi chảy nhưng sai → quay lại code/concept. K cao, S thấp = hiểu nhưng chưa nói được → luyện retrieval/speaking repetitions. K cao, L thấp = nghe không nhận ra câu hỏi → luyện nghe ẩn transcript. K/S/L đều tốt = tiếp tục bài mới.

7. Kết thúc: tiêu chuẩn “đã học được” chứ không chỉ “đã đọc xong”

Nguyên tắc: Understand it → Build it → Explain it → Defend it → Explain it again in simpler English.