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

How do you create an empty list in python

[ ]

{ }

( )

• Question 2
30 seconds
Report an issue
Q.

How to create a new empty list in python

[ ]

list ( )

list.init( )

create.list ( )

• Question 3
30 seconds
Report an issue
Q.

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

# todo

i = 0

#todo

i = i + 1

[print ( i ) for i in grades]

# todo

• Question 4
30 seconds
Report an issue
Q.

How do you get the length of the list above

• Question 5
30 seconds
Report an issue
Q.

a = [ 1, 3, 5 ]

b = [ 7, 9, 11 ]

How do you merge these two lists ?

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]

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

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

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

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

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

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

numbers.clear()

del numbers

delete numbers

numbers.del()

• Question 13
30 seconds
Report an issue
Q.

Which of the following are examples of lists

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

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

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]

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]

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]

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]

[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]

i

d

k

y

• Question 21
30 seconds
Report an issue
Q.

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

1700

1200

800

2400

• Question 22
30 seconds
Report an issue
Q.

The output of the code above is

Chennai

New York

New Delhi

• Question 23
30 seconds
Report an issue
Q.

What is the output of the program above

Error

-1

0

None

False

• Question 24
30 seconds
Report an issue
Q.

What is the output of the code above

Nothing prints

• Question 25
30 seconds
Report an issue
Q.

What is the output of the code above ?

False

True

None

None of the above

• Question 26
30 seconds
Report an issue
Q.

What is the output of the code above

True

False

None

• Question 27
30 seconds
Report an issue
Q.

What is the output of the code above

Type Error

20

30

40

• Question 28
30 seconds
Report an issue
Q.

What is the output of the code above ?

6

12

9

18

• Question 29
30 seconds
Report an issue
Q.

What is the output of the code above

4

2

3

• Question 30
30 seconds
Report an issue
Q.

What is the output of the code above

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

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

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

• Question 32
30 seconds
Report an issue
Q.

What is the output of the code above

[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

[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

[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

[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

8

7

4

12

13

• Question 37
30 seconds
Report an issue
Q.

What is the output of the code above

6

7

3

12

10

• Question 38
30 seconds
Report an issue
Q.

What is the output of the code above

10

20

30

40

• Question 39
30 seconds
Report an issue
Q.

what does the code above print

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

9

14

15

6

10

• Question 41
30 seconds
Report an issue
Q.

What is the output of the program above

10

5

15

• Question 42
30 seconds
Report an issue
Q.

The output of the program above is

True

False

• Question 43
30 seconds
Report an issue
Q.

The output of the code above is

Equal

unequal

• Question 44
30 seconds
Report an issue
Q.

The output of the code above is

[3, 2]

[3, 2,1]

[3]

• Question 45
30 seconds
Report an issue
Q.

What is the output of the code above

[1, 2, 3, 4, 5]

[ ]

[5]

[1]

• Question 46
30 seconds
Report an issue
Q.

What is the output of the code above

[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

2

1

3

5

9

• Question 48
30 seconds
Report an issue
Q.

The output of the code above is

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

False

True

Index out of bounds error

• Question 50
30 seconds
Report an issue
Q.

What is the output of the code above