Multiple choice test on Python - Part 11
- Question 1: What is the variable declared outside the function?
- Global variable (Global)
- Local variable (Local)
- Static variable (Static)
- Automatic variable (Automatic)
-
- Question 2: What is the variable declared inside a function called?
- Global variable (Global)
- Local variable (Local)
- Automatic variable (Automatic)
- Volatile variable
-
- Question 3: What is the output of the program below?
i=0
def change(i):
i=i+1
return i
change(1)
print(i)- first
- 0
- Do not show results
- An exception occurs
-
- Question 4: What is the output of the program below?
def a(b):
b = b + [5]c = [1, 2, 3, 4]
a(c)
print(len(c))- 4
- 5
- first
- An exception occurs
-
- Question 5: What is the output of the program below?
a=10
b=20
def change():
global b
a=45
b=56
change()
print(a)
print(b)- ten
56 - 45
56 - ten
20 - Syntax Error
-
- Question 6: What is the output of the program below?
def change(i = 1, j = 2):
i = i + j
j = j + 1
print(i, j)
change(j = 1, i = 2)- An exception occurs
- twelfth
- 3 3
- 3 2
-
- Question 7: What is the output of the program below?
def change(one, *two):
print(type(two))
change(1,2,3,4)- Integer
- Tuple
- Dictionary
- List
-
- Question 8: What is the output of the program below?
def display(b, n):
while n > 0:
print(b,end="")
n=n-1
display('z',3)- zzz
- zz
- An exception occurs
- An infinite loop
-
- Question 9: What is the output of the program below?
def find(a, **b):
print(type(b))
find('letters',A='1',B='2')- String
- Tuple
- Dictionary
- List
-
- Question 10: What is the output of the program below?
x = 2
def vidu():
global x
y = "Biến cục bộ"
x = x * 2
print(x)
print(y)
vidu()- 4
Local variable -
Local variable
4
- 2
Local variable - Exception
-
5 ★ | 1 Vote