Lists and Tuples Interview Questions

    Question 1: Python Lists - Creation

    Which of the following is a valid way to create a list?

    Question 2: Python Tuples - Immutability

    What happens when you execute the following?

    t = (1, 2, 3) t[0] = 10

    Question 3: Python Lists - Indexing

    What will this code output?

    lst = [10, 20, 30] print(lst[1])

    Question 4: Python Lists - Negative Index

    What does lst[-1] return?

    lst = [1, 2, 3, 4]

    Question 5: Python Lists - Append Method

    What is the output?

    lst = [1, 2] lst.append(3) print(lst)

    Question 6: Python Tuples - Single Element

    Which of the following correctly creates a tuple with a single element 5?

    Question 7: Python Lists - Slicing

    What will this code output?

    lst = [0, 1, 2, 3, 4] print(lst[1:4])

    Question 8: Python Lists - Nested Lists

    What is the output?

    lst = [[1, 2], [3, 4]] print(lst[1][0])

    Question 9: Python Tuples - Concatenation

    What will this code print?

    t1 = (1, 2) t2 = (3, 4) print(t1 + t2)

    Question 10: Python Lists - Length

    What is the output?

    lst = [10, 20, 30, 40] print(len(lst))