1. Home
  2. Data Science
  3. Python
  4. nums = [3, 1, 2]; result = nums.sort(). What is result?

Added 2 Nov 2026

nums = [3, 1, 2]; result = nums.sort(). What is result?

  1. True
  2. [3, 1, 2]
  3. [1, 2, 3]
  4. None Correct answer

Correct answer

D. None

15 views

MCQSEXAM

Explanation

list.sort() sorts in place and returns None. Use sorted(nums) when you need a new sorted list returned.

Reference

Asked in: NTS, Python Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? 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