Quiz Space

Programming in Python · Quiz 1 · 13 Jul 2025 · May 2025 term

Question 3: What is the output of the following Python code?\ data = …

Question 3

+3 marksOne correct option

What is the output of the following Python code?
data = ["alpha", "beta", "gamma"]
data[1] = data[1].replace("e", data[0][1])
data[2] = data[2][::-1].replace("a", data[0][3])
print(data)

  1. A

    ['alpha', 'blta', 'hmmhg']

  2. B

    ['alpha', 'blta', 'ghmmh']

  3. C

    ['alpha', 'blta', 'htlb']

  4. D

    ['alpha', 'blta', 'hmmh']

Show answer

Correct answer

  • A

    ['alpha', 'blta', 'hmmhg']

Question 3 of 14 in the IIT Madras BS Programming in Python (Python) Quiz 1 paper sat on 13 Jul 2025, in the May 2025 term (IIT M DIPLOMA AN EXAM QDD2 13 July 2025). It carries 3 marks.

More questions from this paper

  1. Q1Consider the following code:\ text = " >>> Hello, Python! \<\<\< "\ to_strip = " \<>"\ A = text.strip(to_strip)\ B = te…
  2. Q2Consider a Python program that takes a sentence (which may contain both uppercase and lowercase letters, spaces, and pu…
  3. Q4We want to print the following pattern.\ 1111\ 1001\ 1011\ 1111\ Which of these two snippets is correct?\ Snippet-1\ n …
  4. Q5P is a non-empty list of distinct integers that has already been defined. Which of the following statements are true at…
  5. Q6Consider the following Python code:\ def process(x, y):\ if x > y:\ return x - y\ elif x \< y:\ return y - x\ else:\ re…
  6. Q7Consider the following snippet of code. What will the output be?\ result = 0\ for i in range(1, 4):\ for j in range(1, …
  7. Q8What is the output of the following snippet of code? Enter an integer as your answer. lst = ['IIT', ['Madras', '2025'],…
  8. Q9What is the output of the following snippet of code? Enter an integer as your answer. lst = [x for x in [1,0,-2]]\ resu…
  9. Q10Consider the following snippet of code. What will the output be?\ names = ["alice", "bob", "charlie", "david", "eve"]\ …
  10. Q11What is the value of output after executing the given code?
  11. Q12Which of the following changes would also include SQL in the final result?
  12. Q13What is the value of output after executing the given code snippet?
  13. Q14In the given code, if we change the condition to if element % 2 == 0 at line 7, then what is the value of output after …