Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

How do you create a list in Python?
A. {}
B. list()
C. []
D. Both A and B
Direction: Choose the correct option

Q2.

What is the output of `len([1,2,3])`?
A. 4
B. 1
C. 2
D. 3
Direction: Choose the correct option

Q3.

How do you access the last element of a list `lst`?
A. lst[-1]
B. Both A and C
C. lst[len(lst)-1]
D. lst[last]
Direction: Choose the correct option

Q4.

What does `lst.append(5)` do?
A. Adds 5 at the end
B. Removes 5
C. Adds 5 at the beginning
D. Replaces last element
Direction: Choose the correct option

Q5.

How do you insert an element at index 0?
A. lst.insert(0, val)
B. lst[0] = val
C. lst.add(0, val)
D. lst.append(val, index=0)
Direction: Choose the correct option

Q6.

What is the difference between `extend` and `append`?
A. `append` adds multiple, `extend` adds one
B. They are the same
C. `extend` adds at beginning
D. `extend` adds multiple items, `append` adds one
Direction: Choose the correct option

Q7.

What does `lst.pop()` return?
A. The first element
B. The last element
D. The list length
Direction: Choose the correct option

Q8.

How do you remove an element by value?
A. lst.pop(val)
B. lst.delete(val)
C. lst.discard(val)
D. lst.remove(val)
Direction: Choose the correct option

Q9.

What is the output of `[1,2,3] + [4,5]`?
A. [1,2,3,4,5]
B. [5,7,9]
C. [1,2,3] [4,5]
D. Error
Direction: Choose the correct option

Q10.

What does `lst = [1,2,3]; lst[1:2] = [4,5]` produce?
A. [1,4,5,3]
B. [1,4,5,3]
C. [1,2,3,4,5]
D. [1,4,5,3]