This Python Directory MCQ Quiz helps you practice how to interact with folders using Python’s built-in os and os.path modules. Learn how to create, rename, delete, and navigate directories programmatically using simple Python commands.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which module in Python is primarily used to work with directories?
Correct
Incorrect
Question 2 of 15
2. Question
Which function is used to create a new directory in Python?
Correct
Incorrect
Question 3 of 15
3. Question
Which method creates intermediate-level directories as needed?
Correct
Incorrect
Question 4 of 15
4. Question
What does os.getcwd() return?
Correct
Incorrect
Question 5 of 15
5. Question
Which function is used to change the current directory in Python?
Correct
Incorrect
Question 6 of 15
6. Question
Which function returns a list of files and folders in a directory?
Correct
Incorrect
Question 7 of 15
7. Question
How do you remove an empty directory in Python?
Correct
Incorrect
Question 8 of 15
8. Question
What function is used to delete a file?
Correct
Incorrect
Question 9 of 15
9. Question
What is the difference between os.rmdir() and os.removedirs()?
Correct
Incorrect
Question 10 of 15
10. Question
How do you check if a path exists in Python?
Correct
Incorrect
Question 11 of 15
11. Question
Which function checks if a path is a directory?
Correct
Incorrect
Question 12 of 15
12. Question
What is the use of os.path.join()?
Correct
Incorrect
Question 13 of 15
13. Question
What does os.path.basename(‘/home/user/file.txt’) return?
Correct
Incorrect
Question 14 of 15
14. Question
What does os.path.dirname(‘/home/user/file.txt’) return?
Correct
Incorrect
Question 15 of 15
15. Question
What is os.path.abspath() used for?
Correct
Incorrect
Summary
These Python Directory MCQs help you understand how to navigate, create, rename, delete, and check directories using Python’s os and os.path modules. Ideal for beginners learning file systems and automation tasks in Python.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.