menu

Python Input and Output

Python Input and Output - Important Points


21. Which of the following is used to write data to a file in Python?

A. write()

B. read()

C. close()

D. D. open()

Discuss Work Space

Answer: option a

Explanation:

The write() method is used to write data to a file in Python.

22. Which of the following modes is used to read a file in Python?

A. 'w'

B. 'r'

C. 'a'

D. 'x'

Discuss Work Space

Answer: option b

Explanation:

The 'r' mode is used to read a file in Python.

23. Which of the following modes is used to write to a file in Python?

A. 'r'

B. 'w'

C. 'a'

D. 'x'

Discuss Work Space

Answer: option b

Explanation:

The 'w' mode is used to write to a file in Python.

24. Which of the following modes is used to append data to a file in Python?

A. 'r'

B. 'w'

C. 'a'

D. 'x'

Discuss Work Space

Answer: option c

Explanation:

The 'a' mode is used to append data to a file in Python.

25. Which of the following is used to close a file in Python?

A. close()

B. write()

C. read()

D. D. open()

Discuss Work Space

Answer: option a

Explanation:

The close() method is used to close a file in Python.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now