Multiple choice test on Python - Part 11

Python's multiple-choice questions series help you update and review useful knowledge for your work and learn your Python programming language.

  1. Question 1: What is the variable declared outside the function?
    1. Global variable (Global)
    2. Local variable (Local)
    3. Static variable (Static)
    4. Automatic variable (Automatic)
  2. Question 2: What is the variable declared inside a function called?
    1. Global variable (Global)
    2. Local variable (Local)
    3. Automatic variable (Automatic)
    4. Volatile variable
  3. Question 3: What is the output of the program below?
     i=0 
    def change(i):
    i=i+1
    return i
    change(1)
    print(i)
    1. first
    2. 0
    3. Do not show results
    4. An exception occurs
  4. 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))
    1. 4
    2. 5
    3. first
    4. An exception occurs
  5. 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)
    1. ten
      56
    2. 45
      56
    3. ten
      20
    4. Syntax Error
  6. 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)
    1. An exception occurs
    2. twelfth
    3. 3 3
    4. 3 2
  7. Question 7: What is the output of the program below?
     def change(one, *two): 
    print(type(two))
    change(1,2,3,4)
    1. Integer
    2. Tuple
    3. Dictionary
    4. List
  8. 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)
    1. zzz
    2. zz
    3. An exception occurs
    4. An infinite loop
  9. Question 9: What is the output of the program below?
     def find(a, **b): 
    print(type(b))
    find('letters',A='1',B='2')
    1. String
    2. Tuple
    3. Dictionary
    4. List
  10. 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()
    1. 4
      Local variable
    2. Local variable

      4

    3. 2
      Local variable
    4. Exception

You've just finished reading the article "Multiple choice test on Python - Part 11" edited by the TipsMake team. You can save multiple-choice-test-on-python-part-11.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.

« PREV : eQuiz - Multiple...
What do you know... : NEXT »