JavaScript is required

Kết quả nào là output của đoạn code dưới đây?

A.

10

10

B.

10

10

20

C.

10

None

20

D.

10

None

None

Trả lời:

Đáp án đúng: C


The code defines a function `func` with a default argument `b=10`. The first call `func(10)` prints 10 (for `a`) and 10 (for `b`), and then returns 20, which is printed. The second call `func(10, 20)` prints 10 (for `a`) and 20 (for `b`), and returns 30, but the return value is not printed. Therefore, the output is 10, 10, 20.

Tổng hợp 200 câu hỏi trắc nghiệm lập trình Python có đáp án đầy đủ nhằm giúp các bạn dễ dàng ôn tập lại toàn bộ các kiến thức.


50 câu hỏi 60 phút

Câu hỏi liên quan