{"id":19138,"date":"2026-05-05T11:10:05","date_gmt":"2026-05-05T04:10:05","guid":{"rendered":"https:\/\/mb668s.com\/cam-nang-7mb66-xoc-dia\/?p=19138"},"modified":"2026-05-28T12:01:05","modified_gmt":"2026-05-28T05:01:05","slug":"cau-hoi-ngon-ngu-lap-trinh-python","status":"publish","type":"post","link":"https:\/\/mb668s.com\/cam-nang-7mb66-xoc-dia\/phong-van-viec-lam\/cau-hoi-ngon-ngu-lap-trinh-python","title":{"rendered":"30 c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Python \u2013 Data Structures, OOP, Async"},"content":{"rendered":"\n
Python l\u00e0 ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh ph\u1ed5 bi\u1ebfn nh\u1ea5t t\u1ea1i Vi\u1ec7t Nam 2026 v\u1edbi 38% Senior Engineer d\u00f9ng l\u00e0m ng\u00f4n ng\u1eef ch\u00ednh (theo kh\u1ea3o s\u00e1t Stack Overflow Vietnam 2025). Nhu c\u1ea7u tuy\u1ec3n Python Developer, Data Scientist, ML Engineer lu\u00f4n cao \u2013 CareerLink (05\/2026) ghi nh\u1eadn 1.500+ tin tuy\u1ec3n d\u1ee5ng y\u00eau c\u1ea7u Python skill. B\u1ed9 c\u00e2u h\u1ecfi ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh Python hay g\u1eb7p nh\u1ea5t<\/strong> trong ph\u1ecfng v\u1ea5n 2026 th\u01b0\u1eddng t\u1eadp trung v\u00e0o 5 nh\u00f3m: C\u00fa ph\u00e1p c\u01a1 b\u1ea3n, Data Structures, OOP, Concurrency, v\u00e0 Pythonic best practices. B\u00e0i vi\u1ebft t\u1ed5ng h\u1ee3p 30 c\u00e2u h\u1ecfi ph\u1ed5 bi\u1ebfn v\u1edbi code examples.<\/p>\n\n\n\n T\u1ed5ng quan nhanh:<\/strong><\/p>\n \u2013 5 nh\u00f3m c\u00e2u h\u1ecfi ph\u1ed5 bi\u1ebfn: C\u00fa ph\u00e1p & built-in (30%), Data Structures (25%), OOP (20%), Concurrency (15%), Pythonic (10%).<\/p>\n \u2013 Ph\u1ecfng v\u1ea5n Python t\u1ea1i VN 2026 th\u01b0\u1eddng c\u00f3 1\u20132 live coding challenge tr\u00ean LeetCode ho\u1eb7c Hackerrank.<\/p>\n \u2013 L\u01b0\u01a1ng Python Developer 2026 (CRL Q2): Junior 14\u201322 tri\u1ec7u, Mid 25\u201345 tri\u1ec7u, Senior 50\u201390 tri\u1ec7u.<\/p>\n \u2013 Top framework \u0111\u01b0\u1ee3c h\u1ecfi: Django, FastAPI, Flask, Pandas, NumPy, PyTorch, TensorFlow.<\/p>\n<\/div>\n\n\n\n \u0110\u00e2y l\u00e0 nh\u00f3m s\u00e0ng l\u1ecdc Junior \u2013 \u0111\u1ea3m b\u1ea3o \u1ee9ng vi\u00ean th\u1ef1c s\u1ef1 code Python, kh\u00f4ng ch\u1ec9 h\u1ecdc l\u00fd thuy\u1ebft.<\/p>\n\n\n\n \u2013 C\u00e2u 1:<\/strong> “List vs Tuple kh\u00e1c nhau?”. Khung: List mutable (c\u00f3 th\u1ec3 th\u00eam\/xo\u00e1\/s\u1eeda), tuple immutable. Tuple nhanh h\u01a1n ~20% v\u00e0 d\u00f9ng l\u00e0m dict key \u0111\u01b0\u1ee3c. List d\u00f9ng cho collection c\u00f3 th\u1ec3 thay \u0111\u1ed5i; tuple cho fixed data nh\u01b0 coordinates, RGB.<\/p>\n\n\n\n \u2013 C\u00e2u 2:<\/strong> “ \u2013 C\u00e2u 3:<\/strong> “ \u2013 C\u00e2u 4:<\/strong> “List comprehension vs generator expression?”. Khung: List \u2013 C\u00e2u 5:<\/strong> “Decorator l\u00e0 g\u00ec?”. Khung: Function nh\u1eadn function l\u00e0m input, return function kh\u00e1c \u2013 syntax sugar cho higher-order function. Ph\u1ed5 bi\u1ebfn: Ph\u1ea7n n\u00e0y quan tr\u1ecdng cho Mid+ v\u00e0 c\u00e1c vai tr\u00f2 Backend Developer.<\/p>\n\n\n\n \u2013 C\u00e2u 11:<\/strong> “Inheritance vs Composition \u2013 khi n\u00e0o d\u00f9ng?”. Khung: Inheritance (is-a) \u2013 Dog k\u1ebf th\u1eeba Animal. Composition (has-a) \u2013 Car c\u00f3 Engine. Composition flexible h\u01a1n, tr\u00e1nh inheritance hierarchy ph\u1ee9c t\u1ea1p.<\/p>\n\n\n\n \u2013 C\u00e2u 12:<\/strong> “Method Resolution Order (MRO) trong multiple inheritance?”. Khung: Python d\u00f9ng C3 linearization. Quy t\u1eafc: depth-first, left-to-right, kh\u00f4ng l\u1eb7p. Check qua \u2013 C\u00e2u 13:<\/strong> “ \u2013 C\u00e2u 14:<\/strong> “Dataclass vs NamedTuple vs TypedDict?”. Khung: Dataclass (3.7+) \u2013 mutable, h\u1ed7 tr\u1ee3 defaults, methods. NamedTuple \u2013 immutable, faster. TypedDict \u2013 dict v\u1edbi type hints, static check.<\/p>\n\n\n\n \u2013 C\u00e2u 15:<\/strong> “Property decorator d\u00f9ng \u0111\u1ec3 l\u00e0m g\u00ec?”. Khung: T\u1ea1o getter\/setter cho attribute m\u00e0 gi\u1eef syntax dot notation. Ph\u1ed5 bi\u1ebfn cho validation, computed property. C\u00e2u h\u1ecfi ph\u1ed5 bi\u1ebfn cho c\u1ea5p Senior, \u0111\u1eb7c bi\u1ec7t vai tr\u00f2 Backend\/Web Developer.<\/p>\n\n\n\n \u2013 C\u00e2u 16:<\/strong> “GIL (Global Interpreter Lock) l\u00e0 g\u00ec?”. Khung: Lock cho ph\u00e9p ch\u1ec9 1 thread th\u1ef1c thi Python bytecode t\u1ea1i 1 th\u1eddi \u0111i\u1ec3m. H\u1eadu qu\u1ea3: multi-threading kh\u00f4ng t\u0103ng performance cho CPU-bound tasks. Multi-processing ho\u1eb7c async l\u00e0 alternative.<\/p>\n\n\n\n \u2013 C\u00e2u 17:<\/strong> “Threading vs Multiprocessing vs Asyncio \u2013 khi n\u00e0o d\u00f9ng?”. Khung: Threading \u2013 I\/O bound, \u00edt overhead. Multiprocessing \u2013 CPU bound, true parallelism nh\u01b0ng overhead cao. Asyncio \u2013 nhi\u1ec1u I\/O concurrent (HTTP requests, DB queries).<\/p>\n\n\n\n \u2013 C\u00e2u 18:<\/strong> “ \u2013 C\u00e2u 19:<\/strong> “Race condition trong threading \u2013 c\u00e1ch ph\u00f2ng tr\u00e1nh?”. Khung: D\u00f9ng Lock, RLock, Semaphore, Queue thread-safe. Atomic operations nh\u01b0 Counter. Tr\u00e1nh shared state khi c\u00f3 th\u1ec3.<\/p>\n\n\n\n
<\/figure>\n\n\n\n1. Nh\u00f3m c\u00fa ph\u00e1p v\u00e0 built-in c\u01a1 b\u1ea3n<\/h2>\n\n\n\n
is<\/code> vs ==<\/code> kh\u00e1c g\u00ec?”. Khung: ==<\/code> so s\u00e1nh gi\u00e1 tr\u1ecb (g\u1ecdi __eq__<\/code>). is<\/code> so s\u00e1nh identity (c\u00f9ng memory address). VD: [1,2] == [1,2]<\/code> True nh\u01b0ng [1,2] is [1,2]<\/code> False. D\u00f9ng is None<\/code> kh\u00f4ng d\u00f9ng == None<\/code>.<\/p>\n\n\n\n*args<\/code> v\u00e0 **kwargs<\/code> d\u00f9ng khi n\u00e0o?”. Khung: *args<\/code> \u2013 nh\u1eadn positional args d\u1ea1ng tuple. **kwargs<\/code> \u2013 nh\u1eadn keyword args d\u1ea1ng dict. D\u00f9ng khi function nh\u1eadn s\u1ed1 l\u01b0\u1ee3ng args kh\u00f4ng c\u1ed1 \u0111\u1ecbnh.<\/p>\n\n\n\n[x*2 for x in range(1000)]<\/code> \u2013 t\u1ea1o list ngay, l\u01b0u memory to\u00e0n b\u1ed9. Generator (x*2 for x in range(1000))<\/code> \u2013 lazy evaluation, l\u01b0u state. Generator ph\u00f9 h\u1ee3p large data ho\u1eb7c streaming.<\/p>\n\n\n\n@property<\/code>, @staticmethod<\/code>, @functools.cache<\/code>, @app.route<\/code> (Flask).<\/p>\n\n\n\n2. Nh\u00f3m Data Structures<\/h2>\n\n\n\n
\n\n
\n \nC\u00e2u h\u1ecfi<\/th>\n \u0110i\u1ec3m tr\u1ecdng t\u00e2m<\/th>\n<\/tr>\n<\/thead>\n \n Dict implementation c\u01a1 b\u1ea3n?<\/td>\n Hash table v\u1edbi open addressing. Average O(1) lookup. T\u1eeb Python 3.7+ gi\u1eef insertion order<\/td>\n<\/tr>\n \n Set vs Dict?<\/td>\n Set l\u00e0 dict kh\u00f4ng value \u2013 ch\u1ec9 key. D\u00f9ng cho membership test, deduplication. O(1) check<\/td>\n<\/tr>\n \n collections.deque d\u00f9ng khi n\u00e0o?<\/td>\n Append\/pop t\u1eeb 2 \u0111\u1ea7u O(1). Ph\u00f9 h\u1ee3p queue, sliding window, undo history. T\u1ed1t h\u01a1n list cho operations \u0111\u1ea7u<\/td>\n<\/tr>\n \n defaultdict vs dict.get()?<\/td>\n defaultdict t\u1ef1 t\u1ea1o default value khi key ch\u01b0a t\u1ed3n t\u1ea1i. dict.get() c\u1ea7n specify default m\u1ed7i l\u1ea7n<\/td>\n<\/tr>\n \n Counter trong collections d\u00f9ng l\u00e0m g\u00ec?<\/td>\n \u0110\u1ebfm t\u1ea7n su\u1ea5t ph\u1ea7n t\u1eed. Counter(\"hello\")<\/code> \u2192 {h:1, e:1, l:2, o:1}. C\u00f3 method most_common(n)<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n3. Nh\u00f3m OOP (Object-Oriented Programming)<\/h2>\n\n\n\n
ClassName.__mro__<\/code>.<\/p>\n\n\n\n__init__<\/code> vs __new__<\/code> kh\u00e1c g\u00ec?”. Khung: __new__<\/code> t\u1ea1o instance (return new obj). __init__<\/code> initialize sau khi t\u1ea1o. Override __new__<\/code> cho singleton, immutable types.<\/p>\n\n\n\n@property<\/code> getter, @x.setter<\/code> setter.<\/p>\n\n\n\n4. Nh\u00f3m Concurrency & Async<\/h2>\n\n\n\n
<\/figure>\n\n\n\nasync<\/code>\/await<\/code> ho\u1ea1t \u0111\u1ed9ng th\u1ebf n\u00e0o?”. Khung: Coroutine (defined v\u1edbi async def<\/code>) \u2013 c\u00f3 th\u1ec3 pause\/resume. await<\/code> \u2013 yield control khi g\u1eb7p I\/O. Event loop manage execution. Single-threaded nh\u01b0ng concurrent qua cooperative multitasking.<\/p>\n\n\n\n