1. Home
  2. Data Science
  3. Python
  4. What does the dir() function do with no arguments in Python?

Added 25 Nov 2026

What does the dir() function do with no arguments in Python?

  1. Lists names in the current scope Correct answer
  2. Lists files in a directory
  3. Changes directory
  4. Returns the current path

Correct answer

A. Lists names in the current scope

7 views

MCQSEXAM

Explanation

dir() lists the names defined in the current local scope.

Reference

Asked in: Python Interview Basics

https://docs.python.org/3/tutorial/introduction.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