No student devices needed. Know more
50 questions
How do you create an empty list in python
[ ]
{ }
( )
How to create a new empty list in python
[ ]
list ( )
list.init( )
create.list ( )
grades = [2.0, 3.0, 4.0]
Which of the following code can be used to iterate over the grades list ?
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
grades = [2.0, 3.0, 4.0]
How do you get the length of the list above
len(grades)
length(grades)
list.length(grades)
list.len(grades)
a = [ 1, 3, 5 ]
b = [ 7, 9, 11 ]
How do you merge these two lists ?
a + b
a.extend(b)
a.merge(b)
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
numbers [-3]
What is numbers [-3]
8
9
7
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
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)
numbers = [1, 2, 3, 4, 5]
Which of the following code changes the element 4 to 9
numbers[3] = 9
numbers[4] = 9
numbers = [1, 2, 3, 4, 5]
print ( numbers.pop() )
The program above prints
5
syntax error
1
[2, 3, 4, 5]
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])
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()
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)
numbers = [1, 4, 2, 6, 3 ]
Which of the following code can sort this list
sorted(numbers)
numbers.sort()
sort(numbers
numbers.sorted()
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)
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]
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]
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]
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]
names = ["Hyderabad", "New Delhi", "New York"]
What gets printed when you say
names[1][-1]
i
d
k
y
What is the output of the output of the code above ?
1700
1200
800
2400
The output of the code above is
Chennai
Hyderabad
New York
New Delhi
What is the output of the program above
Error
-1
0
None
False
What is the output of the code above
City not found
Hyderabad
Nothing prints
What is the output of the code above ?
False
True
None
None of the above
What is the output of the code above
True
False
None
What is the output of the code above
Type Error
20
30
40
What is the output of the code above ?
6
12
9
18
What is the output of the code above
4
2
3
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
What is the output of the code above
['C', 'B', 'A']
['A','B','C']
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] ]
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]
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]
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]
What is the output of the program above
8
7
4
12
13
What is the output of the code above
6
7
3
12
10
What is the output of the code above
10
20
30
40
what does the code above print
5
4
3
5
4
3
2
1
No output
What is the output of the code above
9
14
15
6
10
What is the output of the program above
10
5
15
The output of the program above is
True
False
The output of the code above is
Equal
unequal
The output of the code above is
[3, 2]
[3, 2,1]
[3]
What is the output of the code above
[1, 2, 3, 4, 5]
[ ]
[5]
[1]
What is the output of the code above
[1, 2, 3, 4, 5]
[ ]
The output of the code above is to print "greater" how many times
2
1
3
5
9
The output of the code above is
1
5
10
15
4
7
11
15
1
4
8
12
4
6
9
12
What is the output of the program above
False
True
Index out of bounds error
What is the output of the code above
Equal
Unequal
Index out of bounds error
Explore all questions with a free account