
Câu hỏi về Python
Authored by Khoa Nguyen Dang
Social Studies
University
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
49 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Lệnh nào dưới đây sẽ thêm một cặp khóa-giá trị mới vào dictionary person = {'name': 'John', 'age': 30}?
person['address'] = 'New York'
person.add('address', 'New York')
person.insert('address', 'New York')
person.update({'address': 'New York'})
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả khi đoạn code Python sau được thực hiện: #---------------------------- my_list = [1, 2, 3, 4, 5] my_list.append([6, 7]) print(len(my_list)) #----------------------------
5
6
7
8
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả khi đoạn code Python sau được thực hiện: #---------------------------- set1 = {1, 2, 3} set2 = {3, 4, 5} set3 = {5, 6, 7} result = set1 | set2 | set3 print(result) #----------------------------
{1, 2, 3, 4, 5, 6, 7}
{3, 4, 5}
{1, 2, 3}
Error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Lệnh nào dưới đây sẽ xóa tất cả các phần tử trong danh sách my_list = [10, 20, 30, 40] mà không thay đổi tên danh sách?
del my_list
my_list.clear()
my_list = []
my_list.delete()
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả khi đoạn code Python sau được thực hiện: #---------------------------- my_dict = {'a': 1, 'b': 2, 'c': 3} my_dict['a'], my_dict['d'] = my_dict['d'], my_dict['a'] print(my_dict) #----------------------------
{'a': 3, 'b': 2, 'c': 3, 'd': 1}
{'a': 1, 'b': 2, 'c': 3, 'd': None}
{'a': None, 'b': 2, 'c': 3, 'd': 1}
{'a': 3, 'b': 2, 'c': 3, 'd': 1}
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả khi đoạn code Python sau được thực hiện: #---------------------------- def add(x, y=10): return x + y print(add(5)) #----------------------------
15
5
TypeError
10
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả khi đoạn code Python sau được thực hiện: #---------------------------- x = 0 while x < 5: if x == 3: break x += 1 else: print("Loop completed") #----------------------------
Loop completed
0 1 2 3
Không in gì cả
0 1 2
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Microsoft
or continue with
%20(1).png)
Apple
Others
Already have an account?