Python Directory Quiz
We offer you a brighter future with FREE online courses - Start Now!!
Quiz Summary
0 of 10 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 10 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 10
1. Question
What module is most commonly used when working with directories?
CorrectIncorrect -
Question 2 of 10
2. Question
Suppose the Python file we are executing is in the directory “/Users/apple”. Then what would be the current working directory of Python?
CorrectIncorrect -
Question 3 of 10
3. Question
What function is used to list all files and sub-directories in a directory?
CorrectIncorrect -
Question 4 of 10
4. Question
What does CWD stands for?
CorrectIncorrect -
Question 5 of 10
5. Question
What module is used to compare directories?
CorrectIncorrect -
Question 6 of 10
6. Question
import os
os.chdir(“/Users/apple”)
print(os.getcwd())
CorrectIncorrect -
Question 7 of 10
7. Question
import os
import datetime
time1 = os.path.getatime(“/Users/apple”)
time2 = datetime.datetime.fromtimestamp(time1).strftime(“%d-%m-%Y”)
print(time2)
CorrectIncorrect -
Question 8 of 10
8. Question
import os
import datetime
time1 = os.path.getmtime(“/Users/apple”)
time2 = datetime.datetime.fromtimestamp(time1).strftime(“%m-%d-%Y”)
print(time2)
CorrectIncorrect -
Question 9 of 10
9. Question
In what units does the function path.getsize() return the size of a file?
CorrectIncorrect -
Question 10 of 10
10. Question
import os
dir = “/Users/apple/PythonProjects”
if not os.listdir(dir):
try:
os.rmdir(dir)
except OSError:
print(“False”)
else:
print(“True”)
CorrectIncorrect