Multiple choice quiz about Python - Part 5

  1. Question 1: Which loop returns the following result?
     11111 
    22222
    33333
    44444
    55555
    1.  for i in range(1, 6): 
      print(i, i, i, i, i)
    2.  for i in range(1, 5): 
      print(str(i) * 5)
    3.  for i in range(1, 6): 
      print(str(i) * 5)
    4.  for i in range(0, 5): 
      print(str(i) * 5)
  2. Question 2: Fill in the missing part of the code to be out below:
    55555
    44444
    33333
    22222
    11111

     for i in range(5, 0, ____ ): 
    print(str(i) * 5)
    1. 0
    2. None
    3. first
    4. -first
  3. Question 3: What is the result of the code below?
     myList = [1, 5, 5, 5, 5, 1] 
    max = myList[0]
    indexOfMax = 0
    for i in range(1, len(myList)):
    if myList[i] > max:
    max = myList[i]
    indexOfMax = i
    print(indexOfMax)
    1. 0
    2. 4
    3. first
    4. 5
  4. Question 4: Which result is the output of the code below?
     x = True 
    y=False
    z= False

    if not x or y:
    print (1)
    elif not x or not y and z:
    print (2)
    elif not x or y or not y and x:
    print (3)
    else:
    print (4)
    1. 2
    2. None
    3. first
    4. 3
  5. Question 5: Follow the code below and choose the best answer:
     a = [1, 4, 20, 2, 5] 
    x = a[0]
    for i in a:
    if i > x:
    x = i
    print x
    1. x is the average value of the list.
    2. x is the smallest value of the list.
    3. x is the maximum value of the list.
    4. x is the total value of the numbers in the list.
  6. Question 6: Which result is the output of the code below?
     for i in range(10): 
    if i == 5:
    break
    else:
    print(i)
    else:
    print("Here")
    1. 0 1 2 3 4 Here
    2. 0 1 2 3 4 5 Here
    3. 0 1 2 3 4
    4. 1 2 3 4 5
  7. Question 7: The result of the program printed on the screen is?
     string = "my name is x" 
    for i in string:
    print (i, end=", ")
    1. m, y,, n, a, m, e,, i, s,, x,
    2. m, y,, n, a, m, e,, i, s,, x
    3. my, name, is, x,
    4. Lỗi
  8. Question 8: Follow the code below and choose the best answer:
     i = 0 
    x = 0
    while i < 10:
    if i % 2 == 0:
    x += 1
    i += 1

    x = _____.
    1. 3
    2. 4
    3. 5
    4. 0
  9. Question 9: Which result is the output of the code below?
     def f(value): 
    while True:
    value = (yield value)

    a=f(10)

    print(next(a))
    print(next(a))
    print(a.send(20))
    1. ten

      ten

    2. ten

      ten

      20

    3. ten

      None

      20

    4. ten

      None

      None

  10. Question 10: Is the result of the program printed on the screen?
     x = 1 
    y = "2"
    z = 3

    sum = 0
    for i in (x,y,z):
    if isinstance(i, int):
    sum += i
    print (sum)
    1. 2
    2. 3
    3. 4
    4. 6
4.2 ★ | 5 Vote

May be interested

  • What do you know about Data Mining? - Part 2Photo of What do you know about Data Mining?  - Part 2
    how much did you know about data mining? keep testing your knowledge with quantrimang through the following multiple choice questions!
  • What do you know about Data Mining? - Part 1Photo of What do you know about Data Mining?  - Part 1
    how much did you know about data mining? try your knowledge with quantrimang through the following data mining quiz questions!
  • Multiple choice quiz about Python - Part 6Photo of Multiple choice quiz about Python - Part 6
    to help readers add to their knowledge of python's built-in functions, the network administrator will send you multiple choice questions on this topic. please try.
  • Test about database security P11Photo of Test about database security P11
    testing of databases will help you gain more useful knowledge about this topic to apply to learning and working. the question set will have 10 sentences to test your knowledge.
  • Test your understanding about hackingPhoto of Test your understanding about hacking
    hacker is a job that brings a lot of income and is loved by many people. to become a true hacker you need to cultivate a lot of useful knowledge. the network administrator's quiz below will help you gain the knowledge to start your career as a hacker.
  • What do you know about P19 software technologyPhoto of What do you know about P19 software technology
    please read the test questions on software technology that network administrator has compiled and edited below. hope with these questions will give you more useful knowledge.