1. Home
  2. Data Science
  3. Python
  4. What is the result of 'ab' * 3 in Python?

Added 2 Nov 2026

What is the result of 'ab' * 3 in Python?

  1. 'ababab' Correct answer
  2. TypeError
  3. 'aaabbb'
  4. 'ab3'

Correct answer

A. 'ababab'

21 views

MCQSEXAM

Explanation

Multiplying a sequence by an integer repeats it. The same works for lists: [0] * 3 gives [0, 0, 0].

Reference

Asked in: NTS, PPSC, Python Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs