1. Home
  2. Data Science
  3. Python
  4. What exception is raised when calling a method on None…

Added 25 Nov 2026

What exception is raised when calling a method on None, e.g. None.upper() in Python?

  1. AttributeError Correct answer
  2. TypeError
  3. NoneError
  4. NameError

Correct answer

A. AttributeError

11 views

MCQSEXAM

Explanation

None has no attribute upper, so AttributeError is raised.

Reference

Asked in: Python Interview Exception Handling

https://docs.python.org/3/tutorial/errors.html

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