Python List Quiz

    Last Updated :
    Discuss
    Comments

    Question 1

    Find the output of the following program:

    Python
    name = ['Alex', 'Emma', 'Bob', 'Lucas']
    pos = name.index("GeeksforGeeks")
    print(pos * 3)
    
    • 0

    • 3

    • None

    • ValueError: 'GeeksforGeeks' is not in list

    Question 2

    Find the output of the following program: 

    Python
    li = ['Alex', 'Emma', 'Bob', 'Lucas']
    print(li[1][-1])
    
    • r

    • b

    • s

    • a

    Question 3

    Find the output of the following program: 

    Python
    li = [1, 2, 3, 4]
    li.append([5, 6, 7, 8])
    print(li)
    
    • [1, 2, 3, 4, 5, 6, 7, 8]

    • [1, 2, 3, 4]

    • [1, 2, 3, 4, [5, 6, 7, 8]]

    • [[1, 2, 3, 4], [5, 6, 7, 8]]

    Question 4

    Find the output of the following program: 

    Python
    def addToList(a):
        a += [10]
    
    b = [10, 20, 30, 40]
    addToList(b)
    print(len(b))
    
    • 4

    • 5

    • 6

    • 10

    Question 5

    Find the output of the following program: 

    Python
    a = ['Python', 'Java', 'C++', 'Go']
    b = a
    c = a[:]
    b[0] = 'Code'
    c[1] = 'Quiz'
    count = 0
    
    for x in (a, b, c):
        if x[0] == 'Code':
            count += 1
    
        if x[1] == 'Quiz':
            count += 10
    
    print(count)
    
    • 4

    • 5

    • 11

    • 12

    Question 6

    Find the output of the following program: 

    Python
    def square_list(x, li=[]):
        for i in range(x):
            li.append(i * i)
        print(li)
    
    square_list(3, [3, 2, 1])
    
    • [3, 2, 1, 0, 1, 4]

    • [0, 1, 0, 1, 4]

    • [0, 1]

    • [ ]

    Question 7

    Find the output of the following program: 

    Python
    li = list(range(100, 110))
    print(li.index(105))
    
    • 105

    • 5

    • 106

    • 104

    Question 8

    Find the output of the following program: 

    Python
    a = [1, 2, 3, 4, 5]
    
    b = a
    b[0] = 0
    print(a)
    
    • [1, 2, 3, 4, 5, 0]

    • [0, 1, 2, 3, 4, 5]

    • [0, 2, 3, 4, 5]

    • [1, 2, 3, 4, 0]

    Question 9

    Find the output of the following program: 

    Python
    a = [1998, 2002]
    b = [2014, 2016]
    print((a + b) * 2)
    
    • [1998, 2002, 2014, 2016, 1998, 2002, 2014, 2016]

    • [1998, 2002, 2014, 2016]

    • [1998, 2002, 1998, 2002]

    • [2014, 2016, 2014, 2016]

    Question 10

    Find the output of the following program: 

    Python
    a = ['Apple', 'Banana', 'Mango', 'Orange']
    print(a[2][1])
    
    • a

    • n

    • m

    • g

    There are 25 questions to complete.

    Take a part in the ongoing discussion