Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Python Institute Exam PCAP-31-03 Topic 4 Question 86 Discussion

Actual exam question for Python Institute's PCAP-31-03 exam
Question #: 86
Topic #: 4
[All PCAP-31-03 Questions]

What can you deduce from the following statement? (Select two answers)

str = open('file.txt', "rt")

Show Suggested Answer Hide Answer
Suggested Answer: A, D

Contribute your Thoughts:

Doug
4 hours ago
Hmm, I'm not sure about C. I've never seen a file get created automatically like that. And D, really? Why would you think you can't write to the file? That's just silly.
upvoted 0 times
...
Stephane
2 days ago
I think C is also correct. If the file doesn't exist, it will be created when you try to open it. But D is wrong - you can definitely write to the file using the 'str' variable.
upvoted 0 times
...
Gracia
4 days ago
I believe D) the opened file cannot be written with the use of the str variable is the correct answer
upvoted 0 times
...
Carmen
6 days ago
I disagree with A), I think B) a newlina character translation will be performed during the reads
upvoted 0 times
...
Julian
7 days ago
I agree with A), and also think C) if file.txt does not exist, it will be created
upvoted 0 times
...
Lavonne
13 days ago
I think A) str is a string read in from the file named file.txt
upvoted 0 times
...
Leah
14 days ago
A and B are correct. The 'rt' mode stands for 'read text', which means the file will be opened for reading and any newline characters will be translated.
upvoted 0 times
Allene
4 hours ago
B) a newlina character translation will be performed during the reads
upvoted 0 times
...
Samira
1 days ago
A) str is a string read in from the file named file.txt
upvoted 0 times
...
...

Save Cancel