Python Lists
3 months ago
ajaytech
Save
Edit
Start a multiplayer game
Play LiveLive
Assign HW
Solo Practice
Practice
Preview (50 questions)Show answers
  • Question 1
    30 seconds
    Report an issue
    Q.

    How do you create an empty list in python

    answer choices

    [ ]

    { }

    ( )

  • Question 2
    30 seconds
    Report an issue
    Q.

    How to create a new empty list in python

    answer choices

    [ ]

    list ( )

    list.init( )

    create.list ( )

  • Question 3
    30 seconds
    Report an issue
    Q.

    grades = [2.0, 3.0, 4.0]


    Which of the following code can be used to iterate over the grades list ?

    answer choices

    for grade in grades :

    # todo

    i = 0

    while i < len(grades) :

    #todo

    i = i + 1

    [print ( i ) for i in grades]

    for i, grade in enumerate(grades) :

    # todo

  • Question 4
    30 seconds
    Report an issue
    Q.

    grades = [2.0, 3.0, 4.0]


    How do you get the length of the list above

    answer choices

    len(grades)

    length(grades)

    list.length(grades)

    list.len(grades)

  • Question 5
    30 seconds
    Report an issue
    Q.

    a = [ 1, 3, 5 ]

    b = [ 7, 9, 11 ]


    How do you merge these two lists ?

    answer choices

    a + b

    a.extend(b)

    a.merge(b)

  • Question 6
    30 seconds
    Report an issue
    Q.

    numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


    numbers [-3]


    What is numbers [-3]

    answer choices

    8

    9

    7

  • Question 7
    30 seconds
    Report an issue
    Q.

    numbers = [1,2,3,4,5,6,7,8,9,10]


    print ( numbers[-3] == numbers[7])


    The output of the program above is

    answer choices

    True

    False

  • Question 8
    30 seconds
    Report an issue
    Q.

    numbers = [1,3,5,7]


    Which of the following code inserts 9 into the list above at index 2

    answer choices

    numbers.insert(2,9)

    numbers.insert(1,9)

    numbers.insert(3,9)

  • Question 9
    30 seconds
    Report an issue
    Q.

    numbers = [1, 2, 3, 4, 5]


    Which of the following code changes the element 4 to 9

    answer choices

    numbers[3] = 9

    numbers[4] = 9

  • Question 10
    30 seconds
    Report an issue
    Q.

    numbers = [1, 2, 3, 4, 5]


    print ( numbers.pop() )


    The program above prints

    answer choices

    5

    syntax error

    1

    [2, 3, 4, 5]

  • Question 11
    30 seconds
    Report an issue
    Q.

    numbers = [1, 2, 3, 4, 5]


    Which of the following code removes the element 5 from the list

    answer choices

    numbers.pop()

    numbers.remove(5)

    del(numbers[4])

    del(numbers[5])

  • Question 12
    30 seconds
    Report an issue
    Q.

    numbers = [1, 2, 3, 4, 5]


    Which of the following code removes all the elements from the list but retains the list

    answer choices

    numbers.clear()

    del numbers

    delete numbers

    numbers.del()

  • Question 13
    30 seconds
    Report an issue
    Q.

    Which of the following are examples of lists

    answer choices

    person = ["Ajay", 32, 160.5]

    person = ["Ajay", "Tech"]

    person = [1, 2, 3, 4, 5]

    person = {1, 2, 3, 4, 5}

    person = (1, 2, 3, 4, 5)

  • Question 14
    30 seconds
    Report an issue
    Q.

    numbers = [1, 4, 2, 6, 3 ]


    Which of the following code can sort this list

    answer choices

    sorted(numbers)

    numbers.sort()

    sort(numbers

    numbers.sorted()

  • Question 15
    30 seconds
    Report an issue
    Q.

    numbers = [1, 3, 2, 4, 5]


    Which of the following code can output a sorted list without actually sorting the original list

    answer choices

    sorted(numbers)

    numbers.sort()

    numbers.sorted()

    sort(numbers)

  • Question 16
    30 seconds
    Report an issue
    Q.

    numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


    Which of the following code gives the following list as the output


    [4, 5, 6]

    answer choices

    numbers[3:6]

    numbers[3,4,5]

    numbers[4,5,6]

    numbers[4:6]

  • Question 17
    30 seconds
    Report an issue
    Q.

    numbers = [1,2, 3, 4, 5, 6, 7, 8, 9, 10]


    Which of the following code will give you the output as the array below


    [1, 3, 5, 7, 9]

    answer choices

    numbers[::2]

    numbers[:2]

    numbers[0:9:2]

    numbers[2:0:9]

  • Question 18
    30 seconds
    Report an issue
    Q.

    numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


    Which of the following code will give the output as below


    [7, 8, 9, 10]

    answer choices

    numbers[6:]

    numbers[7:10]

    numbers[7,10]

    numbers[7-10]

  • Question 19
    30 seconds
    Report an issue
    Q.

    numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


    Which of the following code will give the output as


    [4, 6, 8]

    answer choices

    [numbers[i] for i in [3, 5,7]]

    numbers[4,6,8]

    numbers[3,5,7]

  • Question 20
    30 seconds
    Report an issue
    Q.

    names = ["Hyderabad", "New Delhi", "New York"]


    What gets printed when you say


    names[1][-1]

    answer choices

    i

    d

    k

    y

  • Question 21
    30 seconds
    Report an issue
    Q.

    What is the output of the output of the code above ?

    answer choices

    1700

    1200

    800

    2400

  • Question 22
    30 seconds
    Report an issue
    Q.

    The output of the code above is

    answer choices

    Chennai

    Hyderabad

    New York

    New Delhi

  • Question 23
    30 seconds
    Report an issue
    Q.

    What is the output of the program above

    answer choices

    Error

    -1

    0

    None

    False

  • Question 24
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    City not found

    Hyderabad

    Nothing prints

  • Question 25
    30 seconds
    Report an issue
    Q.

    What is the output of the code above ?

    answer choices

    False

    True

    None

    None of the above

  • Question 26
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    True

    False

    None

  • Question 27
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    Type Error

    20

    30

    40

  • Question 28
    30 seconds
    Report an issue
    Q.

    What is the output of the code above ?

    answer choices

    6

    12

    9

    18

  • Question 29
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    4

    2

    3

  • Question 30
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    AA-B-CBA-B-CC

    A-B-CAA-B-CBA-B-C

    AA-B-CBA-B-CC

    AA-B-CBA-B-CCA-B-C

  • Question 31
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    ['C', 'B', 'A']

    ['A','B','C']

  • Question 32
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

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

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

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

    [1, 2, 3, 4, 5, 6]

    [1, 2, 3, [ 4, 5, 6] ]

  • Question 33
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

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

    [2,4,6,8]

    [2,4,6,8,10]

  • Question 34
    30 seconds
    Report an issue
    Q.

    What is the output of the program above

    answer choices

    [1, 2, 3, 4, 3, 4, 3, 4]

    [1, 2, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4]

    [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 4, 3, 4, 3, 4]

  • Question 35
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    [3, 4]

    [1, 2, 3, 4, 3, 4, 3, 4]

    [1, 2, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4]

    [1, 2, 1, 2, 3, 4, 3, 4, 3, 4]

  • Question 36
    30 seconds
    Report an issue
    Q.

    What is the output of the program above

    answer choices

    8

    7

    4

    12

    13

  • Question 37
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    6

    7

    3

    12

    10

  • Question 38
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    10

    20

    30

    40

  • Question 39
    30 seconds
    Report an issue
    Q.

    what does the code above print

    answer choices

    5

    4

    3

    5

    4

    3

    2

    1

    No output

  • Question 40
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    9

    14

    15

    6

    10

  • Question 41
    30 seconds
    Report an issue
    Q.

    What is the output of the program above

    answer choices

    10

    5

    15

  • Question 42
    30 seconds
    Report an issue
    Q.

    The output of the program above is

    answer choices

    True

    False

  • Question 43
    30 seconds
    Report an issue
    Q.

    The output of the code above is

    answer choices

    Equal

    unequal

  • Question 44
    30 seconds
    Report an issue
    Q.

    The output of the code above is

    answer choices

    [3, 2]

    [3, 2,1]

    [3]

  • Question 45
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    [1, 2, 3, 4, 5]

    [ ]

    [5]

    [1]

  • Question 46
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    [1, 2, 3, 4, 5]

    [ ]

  • Question 47
    30 seconds
    Report an issue
    Q.

    The output of the code above is to print "greater" how many times

    answer choices

    2

    1

    3

    5

    9

  • Question 48
    30 seconds
    Report an issue
    Q.

    The output of the code above is

    answer choices

    1

    5

    10

    15

    4

    7

    11

    15

    1

    4

    8

    12

    4

    6

    9

    12

  • Question 49
    30 seconds
    Report an issue
    Q.

    What is the output of the program above

    answer choices

    False

    True

    Index out of bounds error

  • Question 50
    30 seconds
    Report an issue
    Q.

    What is the output of the code above

    answer choices

    Equal

    Unequal

    Index out of bounds error

Report an issue
Why show ads?
Report Ad
Join a game