Python Input and Output
Python Input and Output - Important Points
11. | Which symbol is used for the newline character in Python? |
---|
A. \n
B. \t
C. \r
D. \s
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The \n symbol is used for the newline character in Python.
12. | Which method is used to check if a file exists in Python? |
---|
A. exists()
B. isfile()
C. isdir()
D. D. both A and B
View Answer Discuss Work SpaceAnswer: option d
Explanation:
The exists() and isfile() methods are used to check if a file exists in Python.
13. | Which function is used to get the current working directory in Python? |
---|
A. os.getcwd()
B. os.listdir()
C. os.mkdir()
D. D. os.path()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The os.getcwd() function is used to get the current working directory in Python.
14. | Which function is used to change the working directory in Python? |
---|
A. os.chdir()
B. os.getcwd()
C. os.mkdir()
D. D. os.listdir()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The os.chdir() function is used to change the working directory in Python.
15. | Which function is used to create a directory in Python? |
---|
A. os.mkdir()
B. os.chdir()
C. os.getcwd()
D. D. os.listdir()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The os.mkdir() function is used to create a directory in Python.