Câu hỏi phỏng vấn lập trình Python

Luyện 80 câu hỏi phỏng vấn lập trình Python miễn phí kèm đáp án và giải thích.

Cấp độ: Coding Interview Độ khó: medium 80 câu hỏi 60 phút
Trả lời từng câu Python rồi kiểm tra điểm. Câu sai được lưu cục bộ để ôn lại.
Chuỗi ngày: 0 ngày Chỉ lưu trên thiết bị này
Tiến độ 0 / 80
Câu hỏi 1

Which data type is immutable in Python?

Chọn một đáp án
Câu hỏi 2

What does len("hello") return?

Chọn một đáp án
Câu hỏi 3

Which operator checks whether two values are equal?

Chọn một đáp án
Câu hỏi 4

What is the result of 2 ** 3?

Chọn một đáp án
Câu hỏi 5

Which method removes the last item from a list and returns it?

Chọn một đáp án
Câu hỏi 6

What does print(type([])) output?

Chọn một đáp án
Câu hỏi 7

Which keyword defines a function?

Chọn một đáp án
Câu hỏi 8

Which values does list(range(3)) produce?

Chọn một đáp án
Câu hỏi 9

Which built-in function converts a string to an integer?

Chọn một đáp án
Câu hỏi 10

What is the result of "a" + "b"?

Chọn một đáp án
Câu hỏi 11

Which collection stores only unique values?

Chọn một đáp án
Câu hỏi 12

What is the result of 5 // 2?

Chọn một đáp án
Câu hỏi 13

What is the result of 5 % 2?

Chọn một đáp án
Câu hỏi 14

Which keyword exits a loop immediately?

Chọn một đáp án
Câu hỏi 15

Which method adds one item to the end of a list?

Chọn một đáp án
Câu hỏi 16

What is the output of bool(0)?

Chọn một đáp án
Câu hỏi 17

Which statement handles exceptions?

Chọn một đáp án
Câu hỏi 18

What is the result of [1, 2] + [3]?

Chọn một đáp án
Câu hỏi 19

Which syntax creates a dictionary?

Chọn một đáp án
Câu hỏi 20

What does dict.get("missing", 0) return when the key is missing?

Chọn một đáp án
Câu hỏi 21

Which keyword creates a class?

Chọn một đáp án
Câu hỏi 22

What does self represent inside a Python class method?

Chọn một đáp án
Câu hỏi 23

Which method is called automatically when a class instance is created?

Chọn một đáp án
Câu hỏi 24

What is the output of "abc".upper()?

Chọn một đáp án
Câu hỏi 25

Which function returns the largest item in a list?

Chọn một đáp án
Câu hỏi 26

What is the result of sum([1, 2, 3])?

Chọn một đáp án
Câu hỏi 27

Which slice returns the last item of list x?

Chọn một đáp án
Câu hỏi 28

What is the output of sorted([3, 1, 2])?

Chọn một đáp án
Câu hỏi 29

Which keyword defines an anonymous function?

Chọn một đáp án
Câu hỏi 30

What is the result of list(map(str, [1, 2]))?

Chọn một đáp án
Câu hỏi 31

Which data structure gives the fastest average membership test?

Chọn một đáp án
Câu hỏi 32

What is the worst-case time complexity of searching for a value in a list?

Chọn một đáp án
Câu hỏi 33

What is the average time complexity of looking up a key in a dict?

Chọn một đáp án
Câu hỏi 34

Which statement is true about tuples?

Chọn một đáp án
Câu hỏi 35

What does isinstance(3, int) return?

Chọn một đáp án
Câu hỏi 36

Which function returns the number of items in a container?

Chọn một đáp án
Câu hỏi 37

What is the output of "hello".count("l")?

Chọn một đáp án
Câu hỏi 38

Which built-in function returns index-value pairs from an iterable?

Chọn một đáp án
Câu hỏi 39

What is list(zip([1, 2], ["a", "b"]))?

Chọn một đáp án
Câu hỏi 40

Which keyword is used inside a function to create a generator?

Chọn một đáp án
Câu hỏi 41

What does next(iter([1, 2])) return?

Chọn một đáp án
Câu hỏi 42

Which exception is raised by 1 / 0?

Chọn một đáp án
Câu hỏi 43

Which exception is raised by [1, 2][5]?

Chọn một đáp án
Câu hỏi 44

Which exception is raised by {"a": 1}["b"]?

Chọn một đáp án
Câu hỏi 45

What is the output of print(1 == 1.0)?

Chọn một đáp án
Câu hỏi 46

Which expression evaluates to True?

Chọn một đáp án
Câu hỏi 47

What is the result of "x" in "example"?

Chọn một đáp án
Câu hỏi 48

Which method joins a list of strings into one string?

Chọn một đáp án
Câu hỏi 49

What does set([1, 1, 2]) produce?

Chọn một đáp án
Câu hỏi 50

Which operator performs floor division?

Chọn một đáp án
Câu hỏi 51

What is the result of 3 * "ab"?

Chọn một đáp án
Câu hỏi 52

Which built-in function applies a function to every item and returns an iterator?

Chọn một đáp án
Câu hỏi 53

What is list(filter(lambda x: x > 2, [1, 2, 3]))?

Chọn một đáp án
Câu hỏi 54

Which keyword imports a module?

Chọn một đáp án
Câu hỏi 55

What is the purpose of a docstring?

Chọn một đáp án
Câu hỏi 56

Which file commonly marks a directory as a Python package?

Chọn một đáp án
Câu hỏi 57

What does the global keyword do inside a function?

Chọn một đáp án
Câu hỏi 58

Which built-in function returns an object identity?

Chọn một đáp án
Câu hỏi 59

What is the output of bool([])?

Chọn một đáp án
Câu hỏi 60

Which is a valid variable name in Python?

Chọn một đáp án
Câu hỏi 61

Which of the following built-in types are immutable?

Chọn một đáp án
Câu hỏi 62

Which methods can add items to a list?

Chọn một đáp án
Câu hỏi 63

Which expressions create a set?

Chọn một đáp án
Câu hỏi 64

Which statements are true about dictionaries?

Chọn một đáp án
Câu hỏi 65

Which built-in functions return iterables?

Chọn một đáp án
Câu hỏi 66

Which keywords are used for exception handling?

Chọn một đáp án
Câu hỏi 67

Python lists are zero-indexed.

Chọn một đáp án
Câu hỏi 68

A Python string can be changed in place.

Chọn một đáp án
Câu hỏi 69

None is a valid value in Python.

Chọn một đáp án
Câu hỏi 70

A while loop always runs at least once.

Chọn một đáp án
Câu hỏi 71

Dictionaries preserve insertion order in Python 3.7 and later.

Chọn một đáp án
Câu hỏi 72

The is operator compares object identity, not value.

Chọn một đáp án
Câu hỏi 73

A function without a return statement returns None.

Chọn một đáp án
Câu hỏi 74

Python uses && for logical AND.

Chọn một đáp án
Câu hỏi 75

What is the output of print(2 + 3 * 4)? Type the number only.

Câu hỏi 76

Type the keyword used to define a function.

Câu hỏi 77

Type the method used to add one item to the end of a list.

Câu hỏi 78

Type the keyword that raises an exception manually.

Câu hỏi 79

Type the keyword used to produce values from a generator.

Câu hỏi 80

What does type(3.5) return? Type the short class name.