Kiến thức lập trình cơ bản

Kiến thức lập trình cơ bản

Assessment

Flashcard

Information Technology (IT)

10th Grade

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

7 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Kết quả của đoạn mã sau là gì?
x = 10
def my_function():
x = 5
print(x)
my_function()
print(x)

Back

5 10

2.

FLASHCARD QUESTION

Front

Điều gì xảy ra khi chạy đoạn mã sau?
y = 20
def change_y():
y = y + 5
print(y)
change_y()

Back

Error occurs

3.

FLASHCARD QUESTION

Front

To change the value of the global variable a in a function, what do we need to do?

Back

Use the global keyword a before assigning a value

4.

FLASHCARD QUESTION

Front

Kết quả của đoạn mã sau là gì?
def my_func():
a = 3
print(a)
my_func()
print(a)

Back

Error occurs

5.

FLASHCARD QUESTION

Front

Kết quả của đoạn mã sau là gì?
b = 7
def test():
global b
b = 12
test()
print(b)

Back

12

6.

FLASHCARD QUESTION

Front

When should we use global variables instead of local variables?

Back

When we need to share data between multiple functions

7.

FLASHCARD QUESTION

Front

Đoạn mã sau in ra kết quả gì?
c = 8
def show():
print(c)
show()

Back

8